陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
StaticMethod DataValidation (LibDMF_SystemOnChannel owner_i, String name_i, String group_i, 
  LibDMF_SetType existingSetType_i, output Strings feedbacks_o) declarative remote as Boolean
{
  Description: 'Method to validate input from UI'
  TextBody:
  [*
    // Timothy Guan 30-Jun-2015 (Created)
    // Mind: This implementation assumes that owner is NEVER null
    
    value := true;
    ccr := owner_i.GetCommunicationChannelRoot();
    
    //Name shouldn't be empty
    if( name_i = '' )
    {
      value := LibDMF_Util::CollectFeedback( ccr.GetTranslation( 'DM_SetType_DataValidation_IsNameEmpty' ),
                                             feedbacks_o );
    }
    
    //Group shouldn't be empty
    if( group_i = '' )
    {
      value := LibDMF_Util::CollectFeedback( ccr.GetTranslation( 'DM_SetType_DataValidation_IsGroupEmpty' ),
                                                                     feedbacks_o );
    }
    
    //Check for unique name (Across all channels)
    setType := select( ccr, CommunicationChannel.SystemOnChannel.SetType, setType,
                       setType <> existingSetType_i,
                       setType.Name() = name_i );
    
    if( not isnull( setType ) )
    {
      channelName := setType.SystemOnChannel().ChannelName();
    
      value := LibDMF_Util::CollectFeedback( ccr.GetTranslation( 'DM_SetType_DataValidation_IsNameExists', channelName ),
                                             feedbacks_o );
    }
    
    return value;
  *]
}