From 76bb4f66c40df84fce278c0a155685bb8a03d7cd Mon Sep 17 00:00:00 2001 From: "s.samko" Date: Thu, 6 Jun 2024 12:32:39 +0100 Subject: [PATCH] Fix #2009 - Default for Campaign Type field causes incorrect wizard --- modules/Campaigns/WizardNewsletter.php | 31 ++++--------- modules/Campaigns/utils.php | 64 ++++++++++++++++++++++++-- 2 files changed, 70 insertions(+), 25 deletions(-) diff --git a/modules/Campaigns/WizardNewsletter.php b/modules/Campaigns/WizardNewsletter.php index c05e4fcabae..f5e4fd231e4 100755 --- a/modules/Campaigns/WizardNewsletter.php +++ b/modules/Campaigns/WizardNewsletter.php @@ -1,14 +1,12 @@ campaign_type=='NewsLetter')) { - $campaign_type = 'newsletter'; - $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose()); -} elseif ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype']==2) || ($focus->campaign_type=='Email')) { - $campaign_type = 'email'; - $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose()); -} elseif ((isset($_REQUEST['wizardtype']) && $_REQUEST['wizardtype']==4) || ($focus->campaign_type == 'Survey')) { - $campaign_type = 'survey'; - $ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose()); -} else { - $campaign_type = 'general'; -} +$campaign_type = ''; + +$wizardType = $_REQUEST['wizardtype'] ?? ''; +$campaign_type = assignCampaignType($focus, $wizardType, checkRequestWizardType($wizardType)); +$ss->assign("CAMPAIGN_DIAGNOSTIC_LINK", diagnose()); //******** CAMPAIGN HEADER AND BUDGET UI DIV Stuff (both divs) **********/ /// Users Popup diff --git a/modules/Campaigns/utils.php b/modules/Campaigns/utils.php index 1599f7fe3df..a0c86d2c532 100755 --- a/modules/Campaigns/utils.php +++ b/modules/Campaigns/utils.php @@ -1,14 +1,12 @@ 'newsletter', + 'Email' => 'email', + 'General' => 'general', + 'Survey' => 'survey', + ]; + + if ($requestWizardType) { + switch ($wizardType) { + case '1': + $campaignType = $campaignTypes['NewsLetter']; + break; + case '2': + $campaignType = $campaignTypes['Email']; + break; + case '4': + $campaignType = $campaignTypes['Survey']; + break; + case '3': + default: + $campaignType = $campaignTypes['General']; + } + } else { + $campaignType = $campaignTypes[$focus->campaign_type] ?? $campaignTypes['General']; + } + + return $campaignType; +}