Quintiq file version 2.0
#parent: #root
Method EnableDisableCampaignOptimization (
  Boolean isenable
) id:Method_DialogCreateEditStrategy_EnableDisableCampaignOptimization
{
  #keys: '[150660.2.965263422]'
  Body:
  [*
    // tooltip
    fullTooltip := Translations::Strategy_CampaignOptimizer_EnableTooltip()
                   + String::NewLine() + Translations::Strategy_CampaignOptimizer_DisableTooltip();
    
    // Enable disabled component & set tooltip according to state
    CheckboxUseCampaignSequencingOptimizer.Tooltip( fullTooltip );
    EditFieldMaxNrOfElementsInCampaignCombi.Enabled( isenable, fullTooltip );
    
    // Set default value when unchecked
    data := DataHolderDialogData.Data();
    defaultMaxNrOfCampaignCombi := defaultvalue( Strategy, MaxNrOfElemementsCampaignOptimizerCombi );
    hasChangeToggle := data.UseCampaignSequenceOptimizer() <> isenable;
    if( not hasChangeToggle or not isenable )
    {
      EditFieldMaxNrOfElementsInCampaignCombi.Text( ifexpr( isenable and not hasChangeToggle,
                                                            [String] data.MaxNrOfElemementsCampaignOptimizerCombi(),
                                                            [String] defaultMaxNrOfCampaignCombi ) );
    }
  *]
}
