lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
Quintiq file version 2.0
#parent: #root
StaticMethod CanEdit (
  output String feedback_o,
  Unit unit,
  CampaignType_MP fromcampaigntype,
  CampaignType_MP tocampaigntype
) declarative remote as Boolean
{
  TextBody:
  [*
    // Validate input for TransitionType_MP
    feedback_o := '';
    
    // Check if unit is null
    if( isnull( unit ) )
    {
      feedback_o := Translations::MP_TransitionType_ValidateInput_IsNullUnit() ;
    }
    // Check if from/to campaign type is null
    else if( isnull( fromcampaigntype ) or isnull( tocampaigntype ) )
    {
      feedback_o := Translations::MP_TransitionType_ValidateInput_IsNullFromToCampaignType() ;
    }
    // Check if from & to campaign type has different UnitID
    else if( fromcampaigntype.UnitID() <> tocampaigntype.UnitID() )
    {
      feedback_o := Translations::MP_TransitionType_ValidateInput_IsDifferentUnit();
    }
    // Check if from & to campaign type is the same campaign type
    else if( fromcampaigntype = tocampaigntype )
    {
      feedback_o := Translations::MP_TransitionType_ValidateInput_HasSameFromToCampaignTypes();
    }
    
    return feedback_o.Length() = 0;
  *]
}