From 367b5943204ee8253953d5eb2a994901c544766f Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Fri, 30 Sep 2016 16:06:08 +0530 Subject: [PATCH] CRM-18027: No credit card transaction details after 4.7 update --- CRM/Contribute/BAO/Contribution.php | 6 +++++- CRM/Core/SelectValues.php | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 2937689fd2..db99e14b49 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -2801,6 +2801,11 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $template->assign('first_name', $this->_relatedObjects['contact']->first_name); $template->assign('last_name', $this->_relatedObjects['contact']->last_name); $template->assign('displayName', $this->_relatedObjects['contact']->display_name); + + // For some unit tests contribution cannot contain paymentProcessor information + $billingMode = empty($this->_relatedObjects['paymentProcessor']) ? CRM_Core_Payment::BILLING_MODE_NOTIFY : $this->_relatedObjects['paymentProcessor']['billing_mode']; + $template->assign('contributeMode', CRM_Utils_Array::value($billingMode, CRM_Core_SelectValues::contributeMode())); + if (!empty($values['lineItem']) && !empty($this->_relatedObjects['membership'])) { $values['useForMember'] = TRUE; } @@ -2884,7 +2889,6 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac CRM_Utils_Date::processDate($this->receive_date) ); $values['receipt_date'] = (empty($this->receipt_date) ? NULL : $this->receipt_date); - $template->assign('contributeMode', 'notify'); $template->assign('action', $this->is_test ? 1024 : 1); $template->assign('receipt_text', CRM_Utils_Array::value('receipt_text', diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index af7f6510b8..c316d6adbb 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -1012,6 +1012,17 @@ class CRM_Core_SelectValues { ); } + /** + * @return array + */ + public static function contributeMode() { + return array( + CRM_Core_Payment::BILLING_MODE_FORM => 'direct', + CRM_Core_Payment::BILLING_MODE_BUTTON => 'directIPN', + CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify', + ); + } + /** * Frequency unit for schedule reminders. * -- 2.25.1