From a29a45d40bad75f52f1a13ecc63cc16c220171cb Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 13 Jun 2014 19:50:43 -0700 Subject: [PATCH] CRM-14856 - CRM_Profile_Form_Edit - Reimplement cancelURL --- CRM/Core/Invoke.php | 16 ---------------- CRM/Profile/Form/Edit.php | 6 ++---- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/CRM/Core/Invoke.php b/CRM/Core/Invoke.php index 7df01124bf..b06fd360e8 100644 --- a/CRM/Core/Invoke.php +++ b/CRM/Core/Invoke.php @@ -418,22 +418,6 @@ class CRM_Core_Invoke { $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/profile', 'reset=1')); - $buttonType = CRM_Utils_Array::value('_qf_Edit_cancel', $_POST); - // CRM-5849: we should actually check the button *type*, but we get the *value*, potentially translated; - // we should keep both English and translated checks just to make sure we also handle untranslated Cancels - if ($buttonType == 'Cancel' or $buttonType == ts('Cancel')) { - $cancelURL = CRM_Utils_Request::retrieve('cancelURL', - 'String', - CRM_Core_DAO::$_nullObject, - FALSE, - NULL, - $_POST - ); - if ($cancelURL) { - CRM_Utils_System::redirect($cancelURL); - } - } - if ($secondArg == 'edit') { $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit', ts('Create Profile'), diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php index 1bb06d497b..da71bedbc5 100644 --- a/CRM/Profile/Form/Edit.php +++ b/CRM/Profile/Form/Edit.php @@ -211,10 +211,6 @@ SELECT module $this->_postURL = str_replace('&', '&', $this->_postURL); $this->_cancelURL = str_replace('&', '&', $this->_cancelURL); - if ($this->_cancelURL) { - $this->addElement('hidden', 'cancelURL', $this->_cancelURL); - } - // also retain error URL if set $this->_errorURL = CRM_Utils_Array::value('errorURL', $_POST); if ($this->_errorURL) { @@ -242,6 +238,7 @@ SELECT module 'type' => 'cancel', 'name' => ts('Cancel'), 'isDefault' => TRUE, + 'js' => array('onclick' => "location.href='{$this->_cancelURL}'; return false;"), ); $this->addButtons($buttons); return; @@ -269,6 +266,7 @@ SELECT module 'type' => 'cancel', 'name' => ts('Cancel'), 'isDefault' => TRUE, + 'js' => array('onclick' => "location.href='{$this->_cancelURL}'; return false;"), ); } -- 2.25.1