Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetHasValidPlanningPeriod ( 
 | 
  output Strings feedback_o, 
 | 
  output Strings sanitycheckfeedback_o 
 | 
) declarative remote as Boolean 
 | 
{ 
 | 
  Description: 'check if macroplan has valid period ( at least a period )' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // ODE2 Jun-01-2017 (created) 
 | 
    //compare base on end time, the sorted relation( baseperiod/ lastperiod) is base on start time not consider of the end time 
 | 
    end := guard( maxselect( this, Period_MP, period,  
 | 
                             not isnull( period.PeriodSpecification_MP() ), period.End() ).End() ,  
 | 
                  DateTime::MaxDateTime() ); 
 | 
     
 | 
    isvalid := guard( this.FirstPlanningPeriod().Start() = this.FirstBasePeriod().Start() 
 | 
                      and this.LastPlanningPeriod().End() = end, 
 | 
                      false ); 
 | 
     
 | 
    if( not isnull( feedback_o ) and not isvalid ) 
 | 
    { 
 | 
      feedback_o.Add( Translations::MP_MacroPlan_ViolateHasValidPlanningPeriod() ); 
 | 
      sanitycheckfeedback_o.Add( SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning() ); 
 | 
    } 
 | 
     
 | 
    return isvalid; 
 | 
  *] 
 | 
} 
 |