admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
59
60
61
62
Quintiq file version 2.0
#parent: #root
StaticMethod ValidateInput (
  output String feedback_o,
  output String sanitycheckfeedback_o,
  MacroPlan macroplan,
  String id,
  String currencyname,
  Currency_MP currency,
  Boolean checkuniqueid
) declarative remote as Boolean
{
  Description: 'Validate input, called from designer'
  TextBody:
  [*
    feedback_o := '';
    sanitycheckfeedback_o := '';
    
    //Name length limit
    lengthlimit := GlobalParameters_MP::GetLengthOfNames();
    
    name := MacroPlan::GetSubstituteName( currencyname );
    
    //no record with the same name
    if( exists( macroplan, Currency_MP, c,
                     c <> currency,
                     c.Name() = currencyname ) )
    {
      feedback_o := Translations::MP_Currency_ValidateInput_IsNotUniqueName();
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
    }
    //no record with the same id
    else if( checkuniqueid
             and exists( macroplan, Currency_MP, c,
                         c <> currency,
                         c.ID() = id ) )
    {
      feedback_o := Translations::MP_Currency_ValidateInput_IsNotUniqueID();
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
    }
    else if( currencyname = ''
        or  currencyname.Length() > lengthlimit )
    {
      feedback_o := Translations::MP_Currency_ValidateInput_IsInvalidName( lengthlimit );
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning();
    }
    else if( id = ''
             or  id.Length() > lengthlimit )
    {
      feedback_o := Translations::MP_Currency_ValidateInput_IsInvalidID( lengthlimit );
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning();
    }
    
    if( feedback_o <> '' )
    {
      instance := Translations::MP_Currency_Instance( name );
      feedback_o := SanityCheckMessage::GetFormattedMessage( instance, feedback_o );
    }
    
    return feedback_o = '';
  *]
}