1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  StaticMethod CreateValidPeriodTask ( 
 |    Operation operation, 
 |    UnitPeriod unitperiod, 
 |    Real quantity, 
 |    Boolean hasuser 
 |  ) as PeriodTaskOperation 
 |  { 
 |    TextBody: 
 |    [* 
 |      // soh yee Aug-24-2015 (created) 
 |       
 |      pt := null( PeriodTaskOperation ); 
 |      // unit period may be null if the to be created period task is falled outside of planning horizon 
 |      isvalid := guard( operation.CanCreateSupply( unitperiod.Period_MP() ), false ); 
 |       
 |      if( isvalid ) 
 |      { 
 |        pt := PeriodTaskOperation::Create( operation, unitperiod, quantity, hasuser ); 
 |      } 
 |       
 |      return pt; 
 |    *] 
 |  } 
 |  
  |