From 064af72749711403c8e68e4fd6673d54bb268468 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Sun, 16 Aug 2015 07:40:19 +1200 Subject: [PATCH] CRM-16955 load billing details on processor form --- CRM/Core/Form.php | 4 +++- CRM/Member/Form/Membership.php | 2 +- templates/CRM/common/paymentBlock.tpl | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index f865ed1d91..08b815fb80 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1912,7 +1912,9 @@ class CRM_Core_Form extends HTML_QuickForm_Page { CRM_Core_Resources::singleton()->addVars('coreForm', array('contact_id' => (int) $tempID)); return $tempID; } - + if (is_numeric($userID)) { + CRM_Core_Resources::singleton()->addVars('coreForm', array('contact_id' => (int) $userID)); + } return is_numeric($userID) ? $userID : NULL; } diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 06b2868aaa..e3ff392356 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -186,13 +186,13 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { CRM_Core_Error::fatal(ts("This Membership is linked to a contribution. You must have 'delete in CiviContribute' permission in order to delete this record.")); } } + CRM_Core_Resources::singleton()->addVars('coreForm', array('contact_id' => (int) $this->_contactID)); if ($this->_action & CRM_Core_Action::ADD) { if (!CRM_Member_BAO_Membership::statusAvailabilty($this->_contactID)) { // all possible statuses are disabled - redirect back to contact form CRM_Core_Error::statusBounce(ts('There are no configured membership statuses. You cannot add this membership until your membership statuses are correctly configured')); } - if ($this->_contactID) { //check whether contact has a current membership so we can alert user that they may want to do a renewal instead $contactMemberships = array(); diff --git a/templates/CRM/common/paymentBlock.tpl b/templates/CRM/common/paymentBlock.tpl index b46276c2db..1aa8d69d48 100644 --- a/templates/CRM/common/paymentBlock.tpl +++ b/templates/CRM/common/paymentBlock.tpl @@ -49,14 +49,24 @@ {/if} var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="`$urlPathVar``$contributionPageID`processor_id="}" + type; - {literal} + if (typeof(CRM.vars) != "undefined") { + if (typeof(CRM.vars.coreForm) != "undefined") { + if (typeof(CRM.vars.coreForm.contact_id) != "undefined") { + dataUrl = dataUrl + "&cid=" + CRM.vars.coreForm.contact_id; + } + + if (typeof(CRM.vars.coreForm.checksum) != "undefined" ) { + dataUrl = dataUrl + "&cs=" + CRM.vars.coreForm.checksum; + } + } + } + // Processors like pp-express will hide the form submit buttons, so re-show them when switching $('.crm-submit-buttons', $form).show().find('input').prop('disabled', true); - CRM.loadPage(dataUrl, {target: '#billing-payment-block'}); } - + $('.crm-group.payment_options-group').show(); $('[name=payment_processor_id]').on('change.paymentBlock', function() { buildPaymentBlock($(this).val()); -- 2.25.1