Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod GetChangeOfPlanningPeriodsAtEdition ( 
 | 
  MacroPlan macroplan, 
 | 
  PeriodSpecification_MP periodspecification, 
 | 
  Boolean isusedforplanning, 
 | 
  DateTime periodalignment, 
 | 
  Number nroftimeunit, 
 | 
  String timeunit, 
 | 
  Number nrofhistoricalperiod, 
 | 
  Number nroffutureperiod, 
 | 
  Boolean isnew 
 | 
) declarative remote as Boolean 
 | 
{ 
 | 
  Description: 'Returns TRUE if period specification creation/edition would result in modifications on planning periods.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    /* 
 | 
    Warn user at period specification creation/edition in the following cases: 
 | 
    - Create a planning period spec 
 | 
    - Edit a period specification and change its isusedforplanning value (false>true or true>false) 
 | 
    - Change duration of a planning period specification 
 | 
    - Change period alignment of a planning period specification 
 | 
    Warning will only be raised if plan contains period tasks with qty > 0 
 | 
    */ 
 | 
     
 | 
    value := false; 
 | 
     
 | 
    if( isnew ) 
 | 
    { 
 | 
      value := isusedforplanning; 
 | 
    } 
 | 
    else 
 | 
    {      
 | 
      if( ( isusedforplanning <> periodspecification.IsUsedForPlanning() ) 
 | 
          or( isusedforplanning 
 | 
              and( nroftimeunit <> periodspecification.NrOfTimeUnit() 
 | 
                   or nroffutureperiod <> periodspecification.NrOfFuturePeriod() 
 | 
                   or nrofhistoricalperiod <> periodspecification.NrOfHistoricalPeriod() 
 | 
                   or timeunit <> periodspecification.TimeUnit() ) ) ) 
 | 
      { 
 | 
        value := true; 
 | 
      } 
 | 
    } 
 | 
     
 | 
    hasperiodtasks := exists( macroplan, Unit.UnitPeriod.PeriodTask_MP, pt, pt.Quantity() > 0 ); 
 | 
     
 | 
    return value and hasperiodtasks; 
 | 
  *] 
 | 
} 
 |