| 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
38
39
40
41
42
43
44
45
46
47
48
49
 | | Quintiq file version 2.0 |  | #parent: #root |  | StaticMethod Update ( |  |   OperationCosts operationCosts, |  |   Operations operations, |  |   Account_MP account, |  |   String costDriver, |  |   Date start, |  |   Boolean editTimeUnit, |  |   String timeUnit, |  |   Boolean editLengthOfTime, |  |   Number lengthOfTime, |  |   Boolean editCost, |  |   Real cost |  | ) as owning OperationCosts |  | { |  |   TextBody: |  |   [* |  |     // Batch update operationcosts |  |     result := construct( OperationCosts ); |  |     isFromDB := false; |  |     singleEdit := operationCosts.Size() = 1; |  |      |  |     if( singleEdit ) |  |     { // If only single update, update all |  |       editTimeUnit := true; |  |       editLengthOfTime := true; |  |       editCost := true; |  |     } |  |      |  |     traverse( operationCosts, Elements, operationcost ) |  |     { |  |       // If batch edit different operation, UI will not be able change operation this safe to check for single operation to change owner |  |       if( singleEdit ) |  |       { |  |         operationcost.ChangeOwnerOperation( operations.First() ); |  |       } |  |       operationcost.Update( ifexpr( singleEdit, account, operationcost.Account_MP() ),  |  |                             ifexpr( singleEdit, costDriver, operationcost.CostDriver() ),  |  |                             ifexpr( singleEdit, start, operationcost.Start() ),  |  |                             ifexpr( editTimeUnit, timeUnit, operationcost.TimeUnit() ) ,  |  |                             ifexpr( editLengthOfTime, lengthOfTime, operationcost.LengthOfTime()),  |  |                             ifexpr( editCost, cost, operationcost.Cost() ),  |  |                             isFromDB ); |  |       result.Add( operationcost ); |  |     } |  |     return &result; |  |   *] |  | } | 
 |