Lai,Risheng
2023-11-02 30c02e0c981b16be0918483543f4b812956c45d4
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
Quintiq file version 2.0
#parent: #root
Method New (
  Unit unit,
  FormCampaignTypes formCampaignTypes
) id:Method_DialogCreateEditCampaignType_New_715
{
  #keys: '[139394.0.1842030469]'
  Body:
  [*
    // Default campaign type name = unit name (append '1' if found exist)
    defaultCampaignName := this.GetDefaultCampaignTypeName( guard( unit.Name(), '' ), unit );
    
    // New campaigntype with unit
    if( isnull( unit ) )
    {
      unit := select( DataHolderUnit.Data(), Elements, u, true );
    }
    
    data := unit.CampaignType_MP( relshadow,
                                  UnitID := unit.ID(),
                                  Name := defaultCampaignName );
    
    DataHolderDialogData.Data( &data );
    
    // Default input type & color
    data.Color( "$66CCFF" );
    data.InputType( CampaignType_MP::GetInputType( data.DefaultMinQuantity(),
                                                   data.HasInputMaxQuantity(),
                                                   data.DefaultMinDuration(),
                                                   data.HasInputMaxDuration() ) );
    
    // Set form campaign type into DH
    DataHolderForm.Data( formCampaignTypes );
    
    // Update actionlinks when initialize
    this.UpdateActionLinks();
    
    ApplicationMacroPlanner.ShowFormModal( this );
  *]
}