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
26
27
28
29
30
31
32
33
34
35
36
37
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method SetShelfLife ( 
 |    MacroPlan macroplan, 
 |    String product_info, 
 |    Boolean isUsableWithinExpiryPeriod 
 |  ) 
 |  { 
 |    TextBody: 
 |    [* 
 |      // Set shelf life global parameters 
 |      gp := macroplan.GlobalParameters_MP(); 
 |      gp.IsUsableIfExpiredWithinPeriod( isUsableWithinExpiryPeriod ); 
 |      gp.UpdateCommitLogic(); 
 |       
 |      // Find product, set shelf life 
 |      traverse( product_info.Tokenize( String::NewLine() ), Elements, line ) 
 |      { 
 |        line_info := line.Tokenize( ',' ); 
 |        prod := line_info.Element( 0 ).TrimBoth(); 
 |        shelflife := this.ConvertToReal( line_info.Element( 1 ) ); 
 |        product := select( macroplan, Product_MP, e, e.Name() = prod ); 
 |        product.Update( product.ID(), 
 |                        product.Name(), 
 |                        product.ParentID(),  
 |                        product.UnitOfMeasureName(), 
 |                        product.IsByProduct(),  
 |                        product.Notes(), 
 |                        shelflife > 0.0, 
 |                        shelflife,  
 |                        product.HasMaturation(),  
 |                        product.MaturationDays(),  
 |                        false, false, false, false ); 
 |      } 
 |    *] 
 |    InterfaceProperties { Accessibility: 'Module' } 
 |  } 
 |  
  |