admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Quintiq file version 2.0
#parent: #root
StaticMethod CanExportToDataManager (
  output String feedback_o,
  LibDEF_DataBroker libDEF,
  Boolean hassalesdemand,
  LibDEF_SetMeta sdsetmeta,
  String sdsetname,
  Boolean ismpscdef,
  Boolean hasmpsplan,
  LibDEF_SetMeta mpssetmeta,
  Boolean isnewdefset,
  String mpsplansetname,
  Boolean invalidexcelpath
) declarative remote as Boolean
{
  Description: 'Check whether we can export to data manager.'
  TextBody:
  [*
    // Adhi Nov-27-2015 (created)
    
    feedback_o := '';
    /* If the checkbox is ticked but its respective chosen set is empty, show precondition message
       Special case for manufacturing demand channel, where we can create new set(s) */
    
    // Check export salesdemand / constrained forecast
    if( hassalesdemand ) // no set type exists or when creating new, editor is empty
    {
      if( sdsetname = '' and isnull( sdsetmeta ) )
      {
        feedback_o := Translations::MP_GlobalParameters_MP_CanExportToDataManager_InvalidExport();
      }
      else if( exists( sdsetmeta, SetTypeMeta.SetMeta, setmeta, setmeta.Name() = sdsetname ) )
      {
        feedback_o := Translations::MP_GlobalParameters_MP_CanExportToDataManager_SetNotUnique();
      }
    }
    
    // Check export salesdemand / constrained forecast
    if( feedback_o = '' and hasmpsplan )
    {
      if( ismpscdef )
      {
        isToggle := isnewdefset;
        if( ( isToggle and mpsplansetname = '' ) or ( not isToggle and isnull( mpssetmeta ) ) )
        {
          feedback_o := Translations::MP_GlobalParameters_MP_CanExportToDataManager_InvalidExport();
        }
        else if( exists( mpssetmeta, SetTypeMeta.SetMeta, setmeta, setmeta.Name() = mpsplansetname ) )
        {
          feedback_o := Translations::MP_GlobalParameters_MP_CanExportToDataManager_SetNotUnique();
        }
      }
      else
      {
        if( invalidexcelpath )
        {
          feedback_o := Translations::MPSync_ImportProfile_ValidateInput_IsInvalidExcelPath();
        }
      }
    }
    
    return feedback_o = ''
  *]
}