chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
Quintiq file version 2.0
#parent: Toolbar746/btnOk
Response OnClick () id:Response_Toolbar746_btnOk_OnClick
{
  #keys: '[130036.1.306632896]'
  Body:
  [*
    // Apply changes
    stucData := construct( PostponementSpecifications );
    stucData.Add( Dialog.Data().WrappedInstance() );       
    
    hasChangedSalesSegment := guard( SelectionSalesSegment.Data() <> Dialog.Data().SalesSegment_MP(), 
                              false ); // Guard false for handling New and Copy 
    
    
    // Doing the dialog prompt here instead of in Edit method because we want the dialog to promt before EndModal
    if( not hasChangedSalesSegment // If not changing sales segment, skip dialog prompt
        or ( hasChangedSalesSegment // If chaging sales segment, prompt dialog 
             and ApplicationLibMacroPlanner.GetConfirmation_DeletePostponementSpecification( Dialog, stucData ) ) )
    {   
      Dialog.ApplyChanges();
      Dialog.EndModal(1);
    }
  *]
  DefinitionID: 'Responsedef_GUIButtonBase_OnClick'
  Precondition:
  [*
    feedback := '';                                 
    sanitycheckfeedback := '';
    return PostponementSpecification::ValidateInput( feedback,
                                                     sanitycheckfeedback,
                                                     true,
                                                     Dialog.Data().WrappedInstance(),
                                                     SelectionSalesSegment.Data(),
                                                     StringSelectionHorizonTimeUnit.Text(),
                                                     ApplicationLibMacroPlanner.FormatStringToNumber( EditorHorizonNrOfTimeUnit.Text() ),
                                                     StringSelectionMaxTimeUnit.Text(),
                                                     ApplicationLibMacroPlanner.FormatStringToNumber( EditorMaxNrOfTimeUnit.Text() ) );
  *]
}