From 2286d17375eb28820c64c1a9f3152c6463ae1096 Mon Sep 17 00:00:00 2001 From: Pratiksha Dubey Date: Wed, 6 Aug 2014 19:16:56 +0530 Subject: [PATCH] VAT-578-source participant_source ,contribution_source and membership_source is added to display source into invoice.pdf --- CRM/Event/Form/Participant.php | 9 +++++++-- CRM/Event/Form/Registration/Confirm.php | 2 +- CRM/Member/BAO/Membership.php | 6 +++++- CRM/Member/Form/Membership.php | 13 +++++++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 06a73a5b26..624d429d3d 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1338,8 +1338,13 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task { //build contribution params if (!$this->_onlinePendingContributionId) { - $contributionParams['source'] = "{$eventTitle}: Offline registration (by {$userName})"; - } + if (empty($params['source'])) { + $contributionParams['source'] = "{$eventTitle}: Offline registration (by {$userName})"; + } + else { + $contributionParams['source'] = $params['source']; + } + } $contributionParams['currency'] = $config->defaultCurrency; $contributionParams['non_deductible_amount'] = 'null'; diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index e44af41128..fd65d6f727 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -877,7 +877,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { 'amount_level' => $params['amount_level'], 'invoice_id' => $params['invoiceID'], 'currency' => $params['currencyID'], - 'source' => $params['description'], + 'source' => !empty($params['participant_source']) ? CRM_Utils_Array::value('participant_source', $params) : CRM_Utils_Array::value('description', $params), 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params), ); diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 2b859c5c8f..8b83718c8e 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -1270,7 +1270,11 @@ AND civicrm_membership.is_test = %2"; $contributionTypeId = CRM_Utils_Array::value('financial_type_id' ,$membershipParams); } } - + + if (CRM_Utils_Array::value('membership_source', $form->_params)) { + $membershipParams['contribution_source'] = $form->_params['membership_source']; + } + //amount must be greater than zero for //adding contribution record to contribution table. //this condition arises when separate membership payment is diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 14f6d4ba39..c21251630f 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -1298,10 +1298,15 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } if (!$this->_onlinePendingContributionId) { - $params['contribution_source'] = ts('%1 Membership: Offline signup (by %2)', - array(1 => $membershipType, 2 => $userName) - ); - } + if (empty($formValues['source'])) { + $params['contribution_source'] = ts('%1 Membership: Offline signup (by %2)', + array(1 => $membershipType, 2 => $userName) + ); + } + else { + $params['contribution_source'] = $formValues['source']; + } + } if (empty($params['is_override']) && CRM_Utils_Array::value('contribution_status_id', $params) == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name')) -- 2.25.1