From f61437d3e85c5458b06403a5118ab9f04ac7a1dc Mon Sep 17 00:00:00 2001 From: KarinG Date: Tue, 2 Feb 2016 16:14:06 -0700 Subject: [PATCH] JIRA-17952 - adding currency into the AJAX request. --- CRM/Core/Payment/ProcessorForm.php | 2 ++ CRM/Financial/Form/Payment.php | 11 +++++++++++ templates/CRM/common/paymentBlock.tpl | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CRM/Core/Payment/ProcessorForm.php b/CRM/Core/Payment/ProcessorForm.php index adcd41cf5a..463c6abeec 100755 --- a/CRM/Core/Payment/ProcessorForm.php +++ b/CRM/Core/Payment/ProcessorForm.php @@ -66,6 +66,8 @@ class CRM_Core_Payment_ProcessorForm { $form->assign('suppressSubmitButton', $form->_paymentObject->isSuppressSubmitButtons()); + $form->assign('currency', $form->_values['currency']); + // also set cancel subscription url if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) { $form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL(NULL, NULL, 'cancel'); diff --git a/CRM/Financial/Form/Payment.php b/CRM/Financial/Form/Payment.php index b3fca54abf..33958a4c86 100644 --- a/CRM/Financial/Form/Payment.php +++ b/CRM/Financial/Form/Payment.php @@ -36,6 +36,7 @@ class CRM_Financial_Form_Payment extends CRM_Core_Form { * @var int */ protected $_paymentProcessorID; + protected $currency; /** * @var array @@ -48,6 +49,8 @@ class CRM_Financial_Form_Payment extends CRM_Core_Form { parent::preProcess(); $this->_paymentProcessorID = CRM_Utils_Request::retrieve('processor_id', 'Integer', CRM_Core_DAO::$_nullObject, TRUE); + $this->currency = CRM_Utils_Request::retrieve('currency', 'String', CRM_Core_DAO::$_nullObject, + TRUE); $this->assignBillingType(); @@ -58,11 +61,19 @@ class CRM_Financial_Form_Payment extends CRM_Core_Form { self::addCreditCardJs(); $this->assign('paymentProcessorID', $this->_paymentProcessorID); + $this->assign('currency', $this->currency); $this->assign('suppressForm', TRUE); $this->controller->_generateQFKey = FALSE; } + /** + * @return string + */ + public function getCurrency() { + return $this->currency; + } + /** * Build quickForm. */ diff --git a/templates/CRM/common/paymentBlock.tpl b/templates/CRM/common/paymentBlock.tpl index 75d1505077..8710e439b6 100644 --- a/templates/CRM/common/paymentBlock.tpl +++ b/templates/CRM/common/paymentBlock.tpl @@ -100,7 +100,7 @@ {capture assign='profilePathVar'}{/capture} {/if} - var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="`$urlPathVar``$profilePathVar``$contributionPageID`processor_id="}" + type; + var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="currency=`$currency`&`$urlPathVar``$profilePathVar``$contributionPageID`processor_id="}" + type; {literal} if (typeof(CRM.vars) != "undefined") { if (typeof(CRM.vars.coreForm) != "undefined") { -- 2.25.1