From 93a11cd6c3ebd969fccdd390ad913b07769451e9 Mon Sep 17 00:00:00 2001 From: kurund Date: Thu, 13 Mar 2014 21:12:24 +0530 Subject: [PATCH] fixes for CRM-14180, also notice fixes ---------------------------------------- * CRM-14180: Declined Credit card redirects user to wrong page. http://issues.civicrm.org/jira/browse/CRM-14180 --- CRM/Contribute/Form/Contribution/Confirm.php | 13 +++++++++---- CRM/Core/Error.php | 2 +- CRM/Member/BAO/Membership.php | 9 +-------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 3363a49b02..85aa0167ff 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -939,10 +939,15 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } } - CRM_Member_BAO_Membership::postProcessMembership($membershipParams, $contactID, - $this, $premiumParams, $customFieldsFormatted, - $fieldTypes - ); + try { + CRM_Member_BAO_Membership::postProcessMembership($membershipParams, $contactID, + $this, $premiumParams, $customFieldsFormatted, + $fieldTypes + ); + } catch (CRM_Core_Exception $e) { + CRM_Core_Session::singleton()->setStatus($e->getMessage()); + CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', "_qf_Main_display=true&qfKey={$this->_params['qfKey']}")); + } } } else { diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index ed6be358d1..251633afd0 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -106,7 +106,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { $this->setDefaultCallback(array($this, 'handlePES')); } - function getMessages(&$error, $separator = '
') { + static public function getMessages(&$error, $separator = '
') { if (is_a($error, 'CRM_Core_Error')) { $errors = $error->getErrors(); $message = array(); diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 8cee375460..6f27098fd7 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -1436,14 +1436,7 @@ AND civicrm_membership.is_test = %2"; } } $message = ts('Payment Processor Error message') . ': ' . implode('
', $message); - // Redirect the form in case of error - // @todo this redirect in the BAO layer is really bad & should be moved to the form layer - // however since we have no idea how (if) this is triggered we can't safely move / remove it - $errorParams = array( - 'legacy_redirect_path' => 'civicrm/contribute/transact', - 'legacy_redirect_query' => "_qf_Main_display=true&qfKey={$form->_params['qfKey']}", - ); - throw new CRM_Core_Exception($message, 0, $errorParams); + throw new CRM_Core_Exception($message); } // CRM-7851 -- 2.25.1