| Quintiq file version 2.0 | 
| #parent: #root | 
| Method ResetPeriodTaskCampaign ( | 
|   const RunContextForCapacityPlanning runcontext, | 
|   LibOpt_Scope scope | 
| ) | 
| { | 
|   Description: 'Reset period task quantity, return period task has user quantity' | 
|   TextBody: | 
|   [* | 
|     isoverridemanualplanning := runcontext.HasOverwrittenManualPlanning();  | 
|     algorithmusecampaign := runcontext.UseCampaign();  | 
|      | 
|     if( ( not algorithmusecampaign  | 
|           and not runcontext.IsFrozenRun() ) | 
|           or isoverridemanualplanning ) | 
|     { | 
|       regularoptimizerrun := not runcontext.IsSmartPlan() and not runcontext.IsMetaIteration();  | 
|       ismetafullrun := runcontext.IsMetaIteration() and not this.GetPeriodsFromPeriodTaskOperation();    | 
|       checkfor_pto_inscope := not regularoptimizerrun  | 
|                               and not ismetafullrun; | 
|       if ( checkfor_pto_inscope )  | 
|       { | 
|         traverse( scope.GetPeriodTaskOperationInOptimizerRun(), Elements, pt )  | 
|         { | 
|           pt.PeriodTaskInCampaign( relflush );  | 
|           pt.PeriodTaskInTransition( relflush );  | 
|         } | 
|       } | 
|       else | 
|       { | 
|         traverse( scope.GetOperationInOptimizerRun(),  | 
|                   Elements.PeriodTaskOperation,  | 
|                   pt, | 
|                   not pt.UnitPeriod().IsPeriodFrozen()  | 
|                   and scope.Contains( pt.UnitPeriod().Period_MP().PeriodInOptimizerRun() )  ) | 
|         { | 
|           pt.PeriodTaskInCampaign( relflush );  | 
|           pt.PeriodTaskInTransition( relflush );  | 
|         } | 
|       } | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |