Quintiq file version 2.0
#parent: #root
Method EnableDisableCampaignOptimization (
  Boolean isEnable
) id:Method_ScenarioManager_DialogEditAdvancedStrategy_EnableDisableCampaignOptimization
{
  #keys: '[150660.2.992286551]'
  Body:
  [*
    // Enable/Disable components under campaign optimization
    fullTooltip := Translations::Strategy_CampaignOptimizer_EnableTooltip() + String::NewLine() + Translations::Strategy_CampaignOptimizer_DisableTooltip();
    
    // Enable disabled component & set tooltip according to state
    ApplicationLibMacroPlanner.SetTooltip( CheckBoxUseCampaignSequenceOptimizer, fullTooltip );
    EditorMaxNrOfElemementsCampaignOptimizerCombi.Enabled( isEnable );
    
    // Set default value = 4 when unchecked
    data :=  Dialog.Data();
    defaultMaxNrOfCampaignCombi := defaultvalue( Strategy, MaxNrOfElemementsCampaignOptimizerCombi );
    hasChangeToggle := data.UseCampaignSequenceOptimizer() <> isEnable;
    EditorMaxNrOfElemementsCampaignOptimizerCombi.Text( ifexpr( isEnable and not hasChangeToggle,
                                                                [String] Dialog.Data().MaxNrOfElemementsCampaignOptimizerCombi(),
                                                                [String] defaultMaxNrOfCampaignCombi ) );
  *]
}
