Created
October 9, 2015 15:46
-
-
Save monishdeb/de1536eb029c58ff197a to your computer and use it in GitHub Desktop.
RM-12989, Editing memberships, contributions or event registrations in multiple tabs replaces data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php | |
index 7fb7a90..162c37d 100644 | |
--- a/CRM/Contribute/Form/AbstractEditPayment.php | |
+++ b/CRM/Contribute/Form/AbstractEditPayment.php | |
@@ -209,7 +209,15 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task { | |
* Pre process function with common actions. | |
*/ | |
public function preProcess() { | |
- $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this); | |
+ //CRM-12989, allocate entity and contact id, retrieved from controller->_entryURL rather than REQUEST to | |
+ //resolve overriding of values due to opening multiple tabs although a hackish fix | |
+ if ($this->controller->_entryURL && | |
+ ($queryParams = str_replace('&', '&', parse_url($this->controller->_entryURL, PHP_URL_QUERY))) | |
+ ) { | |
+ parse_str($queryParams, $urlParts); | |
+ $this->_contactID = CRM_Utils_Array::value('cid', $urlParts); | |
+ $this->_id = CRM_Utils_Array::value('id', $urlParts); | |
+ } | |
$this->assign('contactID', $this->_contactID); | |
CRM_Core_Resources::singleton()->addVars('coreForm', array('contact_id' => (int) $this->_contactID)); | |
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add'); | |
diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php | |
index abe7be6..85e8b81 100644 | |
--- a/CRM/Contribute/Form/Contribution.php | |
+++ b/CRM/Contribute/Form/Contribution.php | |
@@ -228,8 +228,6 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP | |
$this->assign('action', $this->_action); | |
- // Get the contribution id if update | |
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); | |
if (!empty($this->_id)) { | |
$this->assign('contribID', $this->_id); | |
} | |
diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php | |
index ca06acb..e4faf3f 100644 | |
--- a/CRM/Member/Form.php | |
+++ b/CRM/Member/Form.php | |
@@ -99,7 +99,7 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { | |
parent::preProcess(); | |
$params = array(); | |
$params['context'] = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'membership'); | |
- $params['id'] = CRM_Utils_Request::retrieve('id', 'Positive', $this); | |
+ $params['id'] = $this->_id; | |
$params['mode'] = CRM_Utils_Request::retrieve('mode', 'String', $this); | |
$this->setContextVariables($params); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment