| Quintiq file version 2.0 | 
| #parent: #root | 
| Method SetPeriodTaskOperationUser ( | 
|   Boolean isoverridemanualplanning, | 
|   LibOpt_Scope scope, | 
|   Boolean doglobal | 
| ) | 
| { | 
|   Description: 'return period task has user quantity' | 
|   TextBody: | 
|   [* | 
|     this.UserPeriodTask( relflush ); | 
|      | 
|     ptasks := null( PeriodTaskOperations );  | 
|     if ( doglobal )  | 
|     { | 
|       ptasks := selectset( this, FirstPeriod_MP.MacroPlan.Unit.Operation.PeriodTaskOperation, pt, true, pt.HasUserQuantity() );  | 
|     } | 
|     else | 
|     { | 
|       ptasks := selectset( scope.GetOperationInOptimizerRun(),  | 
|                            Elements.PeriodTaskOperation,  | 
|                            pt, | 
|                            not pt.UnitPeriod().IsPeriodFrozen() and scope.Contains(  pt.UnitPeriod().Period_MP().PeriodInOptimizerRun() ) ); | 
|     } | 
|     traverse( ptasks, Elements, pt ) | 
|     { | 
|       if( not this.IsSmartPlan()    // All PT within the active horizon are relevant for a regular optimizer run | 
|           or scope.Contains(  pt.PeriodTaskOperationInOptimizerRun() ) )    // For a Smart plan run, the PT must be part of PTOperationForOptimization | 
|       { | 
|         // user quantity | 
|         if( ( pt.HasUserQuantity() or pt.HasDependentDemandUserQuantity() ) and not isoverridemanualplanning ) | 
|         { | 
|           this.UserPeriodTask( relinsert, pt );  | 
|         } | 
|       } | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |