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
41
42
43
44
45
Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditPostponementSpecification_OnOK
{
  #keys: '[135040.0.192208574]'
  Body:
  [*
    // When the user clicks ok,       
    // we either create or edit the data
    hasChangedSalesSegment := guard( selSalesSegment.Data() <> DataHolderDialogData.Data().SalesSegment_MP(), 
                              false ); // Guard false for handling New and Copy 
    
    haspostponed := exists( DataHolderDialogData.Data().WrappedInstance(), SalesDemandInPeriod, sdip, sdip.IsPostponed() ) 
    this.ApplyChanges();
    
    data := DataHolderDialogData.Data();
    
    if( isnull( data.WrappedInstance() ) )
    {
      data.Commit();
      this.Close();
    }
    else
    {
      
      if ( not ( hasChangedSalesSegment and haspostponed ) or WebMessageBox::Warning( Translations::MP_Designer_GetConfirmation_DeletePostponementSpecification(),
                                                               Translations::MP_Designer_YesNo(),
                                                               true ) = 0 )
      {
        PostponementSpecification::Update( DataHolderDialogDatas.Data(),
                                           selSalesSegment.Data(),
                                           CheckBoxBatchEditHorizon.Checked(),
                                           data.HorizonTimeUnit(),
                                           data.HorizonNrOfTimeUnit(),       
                                           CheckBoxBatchEditMaximum.Checked(),
                                           data.MaxTimeUnit(),
                                           data.MaxNrOfTimeUnit()
                                         );                                      
      
       this.Close();
      }
     
    }
  *]
}