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 ); 
 | 
  *] 
 | 
} 
 |