Quintiq file version 2.0
#parent: #root
Method EditPeriodSpecification (
  PeriodSpecification_MP selection,
  internal[GUIComponent] parent
) id:Method_DialogCreateEditPeriodSpecification_EditPeriodSpecification
{
  #keys: '[11660.0.59749510]'
  Body:
  [*
    // Edit period specification
    
    data := shadow( selection );
    
    Dialog.Data( data );
    
    result := this.DoModal( parent );
    
    if ( result > 0 )
    {
      if( ApplicationLibMacroPlanner.GetChangeOfPlanningPeriodAtEditionWarningDialog( selection.MacroPlan(),
                                                                                   selection,
                                                                                   data.IsUsedForPlanning(),
                                                                                   data.PeriodAlignment(),
                                                                                   data.NrOfTimeUnit(),
                                                                                   data.TimeUnit(),
                                                                                   data.NrOfHistoricalPeriod(),
                                                                                   data.NrOfFuturePeriod(),
                                                                                   false ) )
      {     
        selection.Update( EditorID.Text(),        // Read-only attribute wont be update during apply changes
                          data.TimeUnit(),
                          data.NrOfTimeUnit(),
                          data.PeriodAlignment(),
                          data.NrOfHistoricalPeriod(),
                          data.NrOfFuturePeriod(),
                          true,
                          false,
                          data.IsUsedForPlanning(),
                          true /*iscleanupactuals*/);
      }
    }
  *]
}
