Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Function CalcHasFulfilledMinimumShiftPatternDuration 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    value := true; 
 | 
     
 | 
    if( this.IsPlanning() and not this.Period_MP().IsHistorical() and not isnull( this.ShiftPattern() ) ) 
 | 
    { 
 | 
      next := this.NextPlanningUnitPeriod(); 
 | 
      // If the next period is using the same shift pattern, retrieve the value of its attribute instead. 
 | 
      if( not isnull( next ) and next.astype( UnitPeriodTime ).ShiftPattern() = this.ShiftPattern() ) 
 | 
      { 
 | 
        value := next.astype( UnitPeriodTime ).HasFulfilledMinimumShiftPatternDuration(); 
 | 
      } 
 | 
      // Otherwise, set the attribute to true if the current shift pattern has been used at least as long as its minimum duration. 
 | 
      else 
 | 
      { 
 | 
        value := this.CumulativeShiftPatternDuration() >= this.ShiftPattern().MinimumDuration(); 
 | 
      } 
 | 
    } 
 | 
     
 | 
    this.HasFulfilledMinimumShiftPatternDuration( value ); 
 | 
  *] 
 | 
} 
 |