Quintiq file version 2.0
#parent: #root
Method Edit (
  GlobalParameters_MP selection,
  internal[GUIComponent] parent
) id:Method_DialogEditGlobalParameter_Edit
{
  #keys: '[108486.1.1039359704]'
  Body:
  [*
    // Edit global parameter
    
    data := shadow( selection );
    Dialog.Data( data );
    
    result := Dialog.DoModal(  parent );
    
    if ( result > 0  )
    {
      edit := true;
      hasnewleadtimestrategy := false;
      // Prompt user with warning that plan will be reset in case of change of lead time strategy
      if( ApplicationLibMacroPlanner.GetChangeOfLeadTimeStrategyWarningDialog( selection,
                                                                            hasnewleadtimestrategy,
                                                                            Dialog.StringSelectionLanesLeadTimeLogic().Text(),
                                                                            Dialog.StringSelectionOperationLeadTimeLogic().Text() ) )                                                    
      {
        selection.HasNewLeadTimeStrategy( hasnewleadtimestrategy );
      
        if( selection.StartOfKPIHorizon() <> Dialog.GUIDateTimeSelectorStartOfKPIHorizon().DateTime().Date()
            or selection.EndOfKPIHorizon() <> Dialog.GUIDateTimeSelectorEndOfKPIHorizon().DateTime().Date() )
        {
          selection.HasNewKPIHorizon( true );
        }
    
      }   
      else
      {
        // Cancel action
        edit := false;
      }
    
      if( edit )
      {
       // Prompt message to warn user on forecast netting rule changed
       ApplicationLibMacroPlanner.GetChangeOfForecastNettingRuleWarningDialog( selection, Dialog.StringSelectionForecastNettingRule().Text() );
       data.Commit();
      }
    }
  *]
}
