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