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(); 
 | 
      } 
 | 
      
 | 
    } 
 | 
  *] 
 | 
} 
 |