Quintiq file version 2.0
#parent: #root
Method GetChangeOfLeadTimeStrategyWarningDialog (
  String laneleadtime,
  String operationleadtime
) as Boolean id:Method_FormGeneralSettings_GetChangeOfLeadTimeStrategyWarningDialog
{
  #keys: '[144528.1.1737103871]'
  Body:
  [*
    // Prompt user with warning dialog if user changes lead time settings
    proceedSave := true;
    hasnewleadtimestrategy := MacroPlan.GlobalParameters_MP().LaneLeadTimeLogic() <> laneleadtime
                                or MacroPlan.GlobalParameters_MP().OperationLeadTimeLogic() <> operationleadtime;
                                
    if( hasnewleadtimestrategy )
    {
      message := Translations::MP_MacroPlan_ChangeOfLeadTimeStrategy();
      showModal := true;
      proceedSave := WebMessageBox::Warning( message, Translations::MessageBox_YesNo(), showModal ) = 0;
      
      // Reset here as no code executed after Form.ApplyChanges() 
      if( proceedSave )
      {
        MacroPlan.ResetPeriodTasksAndFlushTrips();
      }
    }
    
    return proceedSave;
  *]
}
