yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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,
  InventorySupply owner,
  InventorySupplyCost createOrEditCost
) declarative remote as Boolean
{
  Description: 'Used in web, to validate user input and uniqueness for inventory supply cost. Web does not allow multiple costs for the same external supply.'
  TextBody:
  [*
    // Validate using thin client method
    tempfeedback_o := ''; // AccountCost validate method will reset the feedback, thus we use temp feedback
    isValid := AccountCost::ValidateInput( tempfeedback_o,
                                           sanitycheckfb_o,
                                           account,
                                           costDriver,
                                           start,
                                           timeUnit,
                                           lengthOfTime,
                                           cost,
                                           null( InventorySupplyCost ) /* Skip unique cost checking as thin client only validates during Edit */ );
    
    if( tempfeedback_o <> '' )
    {
      if( feedback_o <> '' )
      {
        feedback_o := feedback_o + String::NewLine();
      }
      feedback_o := feedback_o + tempfeedback_o;
    }
    
    if( isValid )
    {
      existingCosts := owner.InventorySupplyCost( relget );
      isValid := AccountCost::GetIsUniqueCost( createOrEditCost, guard( account.Name(), '' ), costDriver, start, existingCosts );
                            
      if( not isValid )
      {
        if( feedback_o <> '' )
        {
          feedback_o := feedback_o + String::NewLine();
        }
        feedback_o := feedback_o + Translations::MP_AccountCost_Web_IsNotUnique( Translations::MP_AccountCost_Web_SupplyCost() ); 
      }
    }
    
    return isValid;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}