From 188bf7c3da72d3fc7379c7ef02d405e2d9c3eff8 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 15 Oct 2020 08:55:57 +1300 Subject: [PATCH] dev/core#2066 Use shared function to set the next url Extends https://github.com/civicrm/civicrm-core/pull/18767 to more places --- CRM/Campaign/Form/Task.php | 10 +--------- CRM/Event/Form/Task.php | 19 +------------------ CRM/Grant/Form/Task.php | 10 +--------- CRM/Member/Form/Task.php | 20 +------------------- CRM/Pledge/Form/Task.php | 13 ++----------- 5 files changed, 6 insertions(+), 66 deletions(-) diff --git a/CRM/Campaign/Form/Task.php b/CRM/Campaign/Form/Task.php index 61411931d0..f5193017a2 100644 --- a/CRM/Campaign/Form/Task.php +++ b/CRM/Campaign/Form/Task.php @@ -58,15 +58,7 @@ class CRM_Campaign_Form_Task extends CRM_Core_Form_Task { $this->_voterIds = $this->_contactIds = $this->_componentIds = $ids; $this->assign('totalSelectedContacts', count($this->_contactIds)); - - //set the context for redirection for any task actions - $session = CRM_Core_Session::singleton(); - $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); - $urlParams = 'force=1'; - if (CRM_Utils_Rule::qfKey($qfKey)) { - $urlParams .= '&qfKey=' . $qfKey; - } - $session->replaceUserContext(CRM_Utils_System::url('civicrm/survey/search', $urlParams)); + $this->setNextUrl('survey'); } /** diff --git a/CRM/Event/Form/Task.php b/CRM/Event/Form/Task.php index 4da684f513..745fe3c06f 100644 --- a/CRM/Event/Form/Task.php +++ b/CRM/Event/Form/Task.php @@ -86,24 +86,7 @@ class CRM_Event_Form_Task extends CRM_Core_Form_Task { $form->_participantIds = $form->_componentIds = $ids; - //set the context for redirection for any task actions - $session = CRM_Core_Session::singleton(); - - $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form); - $urlParams = 'force=1'; - if (CRM_Utils_Rule::qfKey($qfKey)) { - $urlParams .= "&qfKey=$qfKey"; - } - - $searchFormName = strtolower($form->get('searchFormName')); - if ($searchFormName == 'search') { - $session->replaceUserContext(CRM_Utils_System::url('civicrm/event/search', $urlParams)); - } - else { - $session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName", - $urlParams - )); - } + $form->setNextUrl('event'); } /** diff --git a/CRM/Grant/Form/Task.php b/CRM/Grant/Form/Task.php index 893077cfb7..a5096f9160 100644 --- a/CRM/Grant/Form/Task.php +++ b/CRM/Grant/Form/Task.php @@ -81,15 +81,7 @@ class CRM_Grant_Form_Task extends CRM_Core_Form_Task { $form->_grantIds = $form->_componentIds = $ids; - //set the context for redirection for any task actions - $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form); - $urlParams = 'force=1'; - if (CRM_Utils_Rule::qfKey($qfKey)) { - $urlParams .= "&qfKey=$qfKey"; - } - - $session = CRM_Core_Session::singleton(); - $session->replaceUserContext(CRM_Utils_System::url('civicrm/grant/search', $urlParams)); + $form->setNextUrl('grant'); } /** diff --git a/CRM/Member/Form/Task.php b/CRM/Member/Form/Task.php index 6718d6eaeb..b2a6225c75 100644 --- a/CRM/Member/Form/Task.php +++ b/CRM/Member/Form/Task.php @@ -88,25 +88,7 @@ class CRM_Member_Form_Task extends CRM_Core_Form_Task { } $form->_memberIds = $form->_componentIds = $ids; - - //set the context for redirection for any task actions - $session = CRM_Core_Session::singleton(); - - $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form); - $urlParams = 'force=1'; - if (CRM_Utils_Rule::qfKey($qfKey)) { - $urlParams .= "&qfKey=$qfKey"; - } - - $searchFormName = strtolower($form->get('searchFormName')); - if ($searchFormName === 'search') { - $session->replaceUserContext(CRM_Utils_System::url('civicrm/member/search', $urlParams)); - } - else { - $session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/$searchFormName", - $urlParams - )); - } + $form->setNextUrl('member'); } /** diff --git a/CRM/Pledge/Form/Task.php b/CRM/Pledge/Form/Task.php index 12df902a91..9de09f6666 100644 --- a/CRM/Pledge/Form/Task.php +++ b/CRM/Pledge/Form/Task.php @@ -38,7 +38,7 @@ class CRM_Pledge_Form_Task extends CRM_Core_Form_Task { /** * Common pre-processing. * - * @param CRM_Core_Form $form + * @param CRM_Pledge_Form_Task $form */ public static function preProcessCommon(&$form) { $form->_pledgeIds = []; @@ -79,16 +79,7 @@ class CRM_Pledge_Form_Task extends CRM_Core_Form_Task { } $form->_pledgeIds = $form->_componentIds = $ids; - - // set the context for redirection for any task actions - $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form); - $urlParams = 'force=1'; - if (CRM_Utils_Rule::qfKey($qfKey)) { - $urlParams .= "&qfKey=$qfKey"; - } - - $session = CRM_Core_Session::singleton(); - $session->replaceUserContext(CRM_Utils_System::url('civicrm/pledge/search', $urlParams)); + $form->setNextUrl('pledge'); } /** -- 2.25.1