Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method MPSyncShiftPattern ( 
 | 
  Boolean isoverwritemanualconfig, 
 | 
  IOShiftPatterns ioshiftpatterns 
 | 
) 
 | 
{ 
 | 
  Description: 'Synchronization of ShiftPattern for MPSync' 
 | 
  TextBody: 
 | 
  [* 
 | 
     
 | 
    existing := selectset( this, ShiftPattern, item, true ); 
 | 
    updates := construct( ShiftPatterns ); 
 | 
     
 | 
    traverse( ioshiftpatterns , Elements, io, io.IsValid() ) 
 | 
    { 
 | 
      indexkey := io.Name(); 
 | 
      objectinstance := ShiftPattern::FindShiftPatternTypeIndex( indexkey ); 
 | 
       
 | 
      if( isnull( objectinstance ) ) 
 | 
      { 
 | 
        objectinstance := ShiftPattern::Create( this, indexkey ,true ); 
 | 
      } 
 | 
      if( guard( not objectinstance.IsManuallyConfigured() or isoverwritemanualconfig, false ) ) 
 | 
      { 
 | 
        nrofdays := objectinstance.NumberOfDays(); 
 | 
         
 | 
        // Update shift pattern 
 | 
        objectinstance.Update( indexkey, 
 | 
                               nrofdays, 
 | 
                               io.MinimumDuration(), 
 | 
                               true ); 
 | 
         
 | 
        updates.Add( objectinstance ); 
 | 
      } 
 | 
      if( not isnull( objectinstance ) ) 
 | 
      { 
 | 
        objectinstance.CustomUpdate( io, isoverwritemanualconfig ); 
 | 
        this.MPSyncShiftDay( isoverwritemanualconfig, io, objectinstance ); 
 | 
      } 
 | 
    } 
 | 
     
 | 
    tobedeleteset := existing.Difference( updates ); 
 | 
     
 | 
    traverse( tobedeleteset, Elements, ele, not ele.IsManuallyConfigured() or isoverwritemanualconfig) 
 | 
    { 
 | 
      ele.Delete(); 
 | 
    } 
 | 
  *] 
 | 
} 
 |