Quintiq file version 2.0
#parent: #root
Method SetDefaultValue (
  CampaignType_MP campaigntype
) id:Method_DialogCreateEditCampaign_SetDefaultValue
{
  #keys: '[134266.1.1951137787]'
  Body:
  [*
    // Set default value for the fields in the dialog
    data := DataHolderDialogData.Data();
    
    data.CampaignType_MP( relset, campaigntype );
    
    RadioButtonGroupQuantityDuration.BoundValue( campaigntype.InputType() );
    
    hasdefaultmaxquantity := campaigntype.HasInputMaxQuantity();
    hasdefaultmaxduration := campaigntype.HasInputMaxDuration();
    data.CampaignTypeName( campaigntype.Name() );
    data.HasInputMaxQuantity( hasdefaultmaxquantity );
    data.HasInputMaxDuration( hasdefaultmaxduration );
    
    if(  data.EarliestStart().IsInfinite() )
    {
      data.EarliestStart( MacroPlan.StartOfPlanning() );
      dsEarliestStart.DateTime( data.EarliestStart() );
    }
    
    data.MinQuantity( campaigntype.DefaultMinQuantity() );
    EditorCampaignMinQuantity.Text( [String] campaigntype.DefaultMinQuantity() );
    
    data.MaxQuantity( campaigntype.DefaultMaxQuantity() );
    EditorCampaignMaxQuantity.Text( [String] campaigntype.DefaultMaxQuantity() );
    
    data.MinDuration( campaigntype.DefaultMinDuration() );
    DurationSelectorMinDuration.Duration( campaigntype.DefaultMinDuration() );
    
    data.MaxDuration( campaigntype.DefaultMaxDuration() );
    DurationSelectorMaxDuration.Duration( campaigntype.DefaultMaxDuration() );
  *]
}
