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
50
51
52
53
54
55
56
57
58
| Quintiq file version 2.0
| #parent: #root
| StaticMethod ValidateInput (
| output String feedback_o,
| output String sanitycheckfb_o,
| Account_MP account,
| String costDriver,
| Date start,
| String timeUnit,
| Number lengthOfTime,
| Real cost,
| InventorySupplys owners,
| InventorySupplyCosts inventorySupplyCosts
| ) declarative remote as Boolean
| {
| Description: 'Validate one or more inventory supply cost create/edit for valid user input and cost uniqueness'
| TextBody:
| [*
| isCreate := inventorySupplyCosts.Size() = 0;
|
| if( isCreate )
| {
| traverse( owners, Elements, invSupply )
| {
| InventorySupplyCost::ValidateInput( feedback_o,
| sanitycheckfb_o,
| account,
| costDriver,
| start,
| timeUnit,
| lengthOfTime,
| cost,
| invSupply,
| null( InventorySupplyCost ) );
| }
| }
| else // Edit
| {
| isBatchEdit := inventorySupplyCosts.Size() > 1;
|
| traverse( inventorySupplyCosts, Elements, invCost )
| {
| InventorySupplyCost::ValidateInput( feedback_o,
| sanitycheckfb_o,
| ifexpr( isBatchEdit, invCost.Account_MP(), account ), // Only allow change if single edit
| invCost.CostDriver(), // Other fields read-only
| invCost.Start(),
| invCost.TimeUnit(),
| invCost.LengthOfTime(),
| cost,
| invCost.InventorySupply(), // UI not allowed to change owner (inv supply)
| invCost );
| }
| }
|
| return feedback_o = '';
| *]
| }
|
|