From 685dc43355ed3125952a99f39aeb8f49cde5d7d3 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Tue, 20 Sep 2016 16:19:05 +0530 Subject: [PATCH] CRM-16189, added link on contribution edit form to record payment for pending pay later and partially paid contribution ---------------------------------------- * CRM-16189: Improve support for Accrual Method bookkeeping https://issues.civicrm.org/jira/browse/CRM-16189 Conflicts: CRM/Contribute/Form/AdditionalPayment.php --- CRM/Contribute/BAO/Contribution.php | 33 ++++---- CRM/Contribute/BAO/Query.php | 5 -- CRM/Contribute/Form/AdditionalPayment.php | 46 +++++------ CRM/Contribute/Form/ContributionView.php | 22 ++++-- CRM/Contribute/Page/PaymentInfo.php | 3 + CRM/Contribute/Selector/Search.php | 40 +++++----- CRM/Core/BAO/FinancialTrxn.php | 78 +++++++++---------- CRM/Event/BAO/Participant.php | 6 +- CRM/Event/Form/EventFees.php | 2 +- CRM/Event/Form/Participant.php | 2 + CRM/Event/Form/ParticipantFeeSelection.php | 9 +-- CRM/Event/Form/ParticipantView.php | 2 + .../CRM/Contribute/Form/AdditionalPayment.tpl | 10 ++- .../CRM/Contribute/Form/ContributionView.tpl | 12 ++- templates/CRM/Contribute/Page/PaymentInfo.tpl | 21 +++-- templates/CRM/Event/Form/Participant.tpl | 2 +- templates/CRM/Event/Form/ParticipantView.tpl | 2 +- 17 files changed, 145 insertions(+), 150 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 99c909c8e9..f70b16578d 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3939,6 +3939,10 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) $entityObj = CRM_Event_BAO_Participant::getValues($inputParams, $values, $ids); $entityObj = $entityObj[$participantId]; } + else { + $entityObj = $contributionDAO; + $component = 'contribution'; + } $activityType = ($paymentType == 'refund') ? 'Refund' : 'Payment'; self::addActivityForPayment($entityObj, $financialTrxn, $activityType, $component, $contributionId); @@ -3957,14 +3961,17 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) */ public static function addActivityForPayment($entityObj, $trxnObj, $activityType, $component, $contributionId) { if ($component == 'event') { - $date = CRM_Utils_Date::isoToMysql($trxnObj->trxn_date); - $paymentAmount = CRM_Utils_Money::format($trxnObj->total_amount, $trxnObj->currency); - $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Event', $entityObj->event_id, 'title'); - $subject = "{$paymentAmount} - Offline {$activityType} for {$eventTitle}"; - $targetCid = $entityObj->contact_id; - // source record id would be the contribution id - $srcRecId = $contributionId; + $title = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Event', $entityObj->event_id, 'title'); } + else { + $title = ts('Contribution'); + } + $paymentAmount = CRM_Utils_Money::format($trxnObj->total_amount, $trxnObj->currency); + $subject = "{$paymentAmount} - Offline {$activityType} for {$title}"; + $date = CRM_Utils_Date::isoToMysql($trxnObj->trxn_date); + $targetCid = $entityObj->contact_id; + // source record id would be the contribution id + $srcRecId = $contributionId; // activity params $activityParams = array( @@ -4032,17 +4039,7 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) $baseTrxnId = $baseTrxnId['financialTrxnId']; } if (!CRM_Utils_Array::value('total_amount', $total) || $usingLineTotal) { - // for additional participants - if ($entityTable == 'civicrm_participant') { - $ids = CRM_Event_BAO_Participant::getParticipantIds($contributionId); - $total = 0; - foreach ($ids as $val) { - $total += CRM_Price_BAO_LineItem::getLineTotal($val, $entityTable); - } - } - else { - $total = CRM_Price_BAO_LineItem::getLineTotal($id, $entityTable); - } + $total = CRM_Price_BAO_LineItem::getLineTotal($contributionId); } else { $baseTrxnId = $total['trxn_id']; diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 1cd6eb9277..b152dedf5c 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -236,11 +236,6 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { $query->_element['contribution_campaign_title'] = $query->_tables['civicrm_campaign'] = 1; } - if (!empty($query->_returnProperties['contribution_participant_id'])) { - $query->_select['contribution_participant_id'] = "civicrm_participant.id as contribution_participant_id"; - $query->_whereTables['contribution_participant'] = $query->_tables['contribution_participant'] = 1; - } - // Adding address_id in a way that is more easily extendable since the above is a bit ... wordy. $supportedBasicReturnValues = array('address_id'); foreach ($supportedBasicReturnValues as $fieldName) { diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index 99bea89c7d..da4c596c92 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -100,12 +100,17 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $this->_formType = CRM_Utils_Array::value('formType', $_GET); $enitityType = NULL; + $enitityType = 'contribution'; if ($this->_component == 'event') { $enitityType = 'participant'; $this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id'); + $eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id'); + $this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId); + } + else { + $this->_contributionId = $this->_id; + $this->_fromEmails['from_email_id'] = CRM_Core_BAO_Email::getFromEmail(); } - $eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id'); - $this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId); $paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_id, $enitityType); $paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, FALSE, TRUE); @@ -369,17 +374,27 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract public function postProcess() { $participantId = NULL; + $childTab = 'contribute'; if ($this->_component == 'event') { $participantId = $this->_id; + $childTab = 'participant'; } $submittedValues = $this->controller->exportValues($this->_name); $submittedValues['confirm_email_text'] = CRM_Utils_Array::value('receipt_text', $submittedValues); - + $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', + 'contribution_status_id', + array('labelColumn' => 'name') + ); + $contributionStatusID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $this->_contributionId, 'contribution_status_id'); + if ($contributionStatuses[$contributionStatusID] == 'Pending') { + CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_Contribution', $this->_contributionId, 'contribution_status_id', array_search('Partially paid', $contributionStatuses)); + } $submittedValues['trxn_date'] = CRM_Utils_Date::processDate($submittedValues['trxn_date'], $submittedValues['trxn_date_time']); if ($this->_mode) { // process credit card $this->assign('contributeMode', 'direct'); $this->processCreditCard($submittedValues); + $submittedValues = $this->_params; } else { $defaults = array(); @@ -413,7 +428,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $session = CRM_Core_Session::singleton(); $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', - "reset=1&cid={$this->_contactId}&selectedChild=participant" + "reset=1&cid={$this->_contactId}&selectedChild={$childTab}" )); } } @@ -602,29 +617,6 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract ); $this->_params['source'] = ts('Submit Credit Card Payment by: %1', array(1 => $userSortName)); } - - // process the additional payment - $participantId = NULL; - if ($this->_component == 'event') { - $participantId = $this->_id; - } - $trxnRecord = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId); - - if ($trxnRecord->id && !empty($this->_params['is_email_receipt'])) { - $sendReceipt = $this->emailReceipt($this->_params); - } - - if ($trxnRecord->id) { - $statusMsg = ts('The payment record has been processed.'); - if (!empty($this->_params['is_email_receipt']) && $sendReceipt) { - $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); - } - - CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success'); - $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', - "reset=1&cid={$this->_contactId}&selectedChild=participant" - )); - } } /** diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index 0ef43f4e3a..ee75bd0460 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -219,13 +219,21 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { NULL, $recentOther ); - - $participantID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', - $values['id'], 'participant_id', 'contribution_id' - ); - $this->assign('contactId', $values['contact_id']); - $this->assign('hasPayment', $values['id']); - $this->assign('participantId', $participantID); + $contributionStatus = $status[$values['contribution_status_id']]; + if (in_array($contributionStatus, array('Partially paid', 'Pending refund')) + || ($contributionStatus == 'Pending' && $values['is_pay_later']) + ) { + if ($contributionStatus == 'Pending refund') { + $this->assign('paymentButtonName', ts('Record Refund')); + } + else { + $this->assign('paymentButtonName', ts('Record Payment')); + } + $this->assign('addRecordPayment', TRUE); + $this->assign('contactId', $values['contact_id']); + $this->assign('componentId', $id); + $this->assign('component', 'contribution'); + } } /** diff --git a/CRM/Contribute/Page/PaymentInfo.php b/CRM/Contribute/Page/PaymentInfo.php index 9975748dc8..b4a519c581 100644 --- a/CRM/Contribute/Page/PaymentInfo.php +++ b/CRM/Contribute/Page/PaymentInfo.php @@ -42,6 +42,9 @@ class CRM_Contribute_Page_PaymentInfo extends CRM_Core_Page { $this->assign('id', $this->_id); $this->assign('context', $this->_context); $this->assign('component', $this->_component); + if ($this->_component != 'event') { + $this->assign('hideButtonLinks', TRUE); + } } public function browse() { diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index 79155fd50b..efb4b786ce 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -82,7 +82,6 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'contribution_soft_credit_contact_id', 'contribution_soft_credit_amount', 'contribution_soft_credit_type', - 'contribution_participant_id', ); /** @@ -185,7 +184,6 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C // type of selector $this->_action = $action; $returnProperties = CRM_Contribute_BAO_Query::selectorReturnProperties(); - $returnProperties['contribution_participant_id'] = 1; $this->_includeSoftCredits = CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled($this->_queryParams); $this->_query = new CRM_Contact_BAO_Query( $this->_queryParams, @@ -418,7 +416,9 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C $contributionStatuses ); + $isPayLater = FALSE; if ($result->is_pay_later && CRM_Utils_Array::value('contribution_status_name', $row) == 'Pending') { + $isPayLater = TRUE; $row['contribution_status'] .= ' (' . ts('Pay Later') . ')'; $links[CRM_Core_Action::ADD] = array( 'name' => ts('Pay with Credit Card'), @@ -441,26 +441,26 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'id' => $result->contribution_id, 'cid' => $result->contact_id, 'cxt' => $this->_context, - 'pid' => $result->contribution_participant_id, + 'compId' => $result->contribution_id, + 'comp' => 'contribution', ); - if (!empty($row['contribution_participant_id'])) { - if ($row['contribution_status_name'] == 'Partially paid') { - $links[CRM_Core_Action::ADD] = array( - 'name' => ts('Record Payment'), - 'url' => 'civicrm/payment', - 'qs' => 'reset=1&id=%%pid%%&cid=%%cid%%&action=add&component=event', - 'title' => ts('Record Payment'), - ); - } - if ($row['contribution_status_name'] == 'Pending refund') { - $links[CRM_Core_Action::ADD] = array( - 'name' => ts('Record Refund'), - 'url' => 'civicrm/payment', - 'qs' => 'reset=1&id=%%pid%%&cid=%%cid%%&action=add&component=event', - 'title' => ts('Record Refund'), - ); - } + if ($row['contribution_status_name'] == 'Partially paid' || $isPayLater) { + $links[CRM_Core_Action::ADD] = array( + 'name' => ts('Record Payment'), + 'url' => 'civicrm/payment', + 'qs' => 'reset=1&id=%%compId%%&cid=%%cid%%&action=add&component=%%comp%%', + 'title' => ts('Record Payment'), + ); + } + + if ($row['contribution_status_name'] == 'Pending refund') { + $links[CRM_Core_Action::ADD] = array( + 'name' => ts('Record Refund'), + 'url' => 'civicrm/payment', + 'qs' => 'reset=1&id=%%pid%%&cid=%%cid%%&action=add&component=event', + 'title' => ts('Record Refund'), + ); } $row['action'] = CRM_Core_Action::formLink( diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index 0e75bb1d1d..dc9c835916 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -469,55 +469,47 @@ WHERE ceft.entity_id = %1"; if ($entityName == 'participant') { $contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $entityId, 'contribution_id', 'participant_id'); - $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'financial_type_id'); - - if ($contributionId && $financialTypeId) { - $statusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name'); - $refundStatusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Refunded', 'name'); - - $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' ")); - $toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeId, $relationTypeId); - $feeRelationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Expense Account is' ")); - $feeFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeId, $feeRelationTypeId); - - if (empty($lineItemTotal)) { - $ids = CRM_Event_BAO_Participant::getParticipantIds($contributionId); - if (count($ids) > 1) { - $total = 0; - foreach ($ids as $val) { - $total += CRM_Price_BAO_LineItem::getLineTotal($val, 'civicrm_participant'); - } - $lineItemTotal = $total; - } - else { - $lineItemTotal = CRM_Price_BAO_LineItem::getLineTotal($entityId, 'civicrm_participant'); - } - } - $sqlFtTotalAmt = " + } + else { + $contributionId = $entityId; + } + $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'financial_type_id'); + + if ($contributionId && $financialTypeId) { + $statusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name'); + $refundStatusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Refunded', 'name'); + + $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' ")); + $toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeId, $relationTypeId); + $feeRelationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Expense Account is' ")); + $feeFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeId, $feeRelationTypeId); + + if (empty($lineItemTotal)) { + $lineItemTotal = CRM_Price_BAO_LineItem::getLineTotal($contributionId); + } + $sqlFtTotalAmt = " SELECT SUM(ft.total_amount) FROM civicrm_financial_trxn ft - LEFT JOIN civicrm_entity_financial_trxn eft ON (ft.id = eft.financial_trxn_id AND eft.entity_table = 'civicrm_contribution') - LEFT JOIN civicrm_contribution c ON (eft.entity_id = c.id) - LEFT JOIN civicrm_participant_payment pp ON (pp.contribution_id = c.id) -WHERE pp.participant_id = {$entityId} AND ft.to_financial_account_id != {$toFinancialAccount} AND ft.to_financial_account_id != {$feeFinancialAccount} + INNER JOIN civicrm_entity_financial_trxn eft ON (ft.id = eft.financial_trxn_id AND eft.entity_table = 'civicrm_contribution' AND eft.entity_id = {$contributionId}) +WHERE ft.to_financial_account_id != {$toFinancialAccount} AND ft.to_financial_account_id != {$feeFinancialAccount} AND ft.status_id IN ({$statusId}, {$refundStatusId}) "; - $ftTotalAmt = CRM_Core_DAO::singleValueQuery($sqlFtTotalAmt); - $value = 0; - if ($ftTotalAmt) { - $value = $paymentVal = $lineItemTotal - $ftTotalAmt; + $ftTotalAmt = CRM_Core_DAO::singleValueQuery($sqlFtTotalAmt); + $value = 0; + if (!$ftTotalAmt) { + $ftTotalAmt = 0; + } + $value = $paymentVal = $lineItemTotal - $ftTotalAmt; + if ($returnType) { + $value = array(); + if ($paymentVal < 0) { + $value['refund_due'] = $paymentVal; } - if ($returnType) { - $value = array(); - if ($paymentVal < 0) { - $value['refund_due'] = $paymentVal; - } - elseif ($paymentVal > 0) { - $value['amount_owed'] = $paymentVal; - } - elseif ($lineItemTotal == $ftTotalAmt) { - $value['full_paid'] = $ftTotalAmt; + elseif ($paymentVal > 0) { + $value['amount_owed'] = $paymentVal; } + elseif ($lineItemTotal == $ftTotalAmt) { + $value['full_paid'] = $ftTotalAmt; } } } diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index c63041d35f..0428b1a18e 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -2035,11 +2035,7 @@ WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantI // the recordAdjustedAmt code would execute over here $ids = CRM_Event_BAO_Participant::getParticipantIds($contributionId); if (count($ids) > 1) { - $total = 0; - foreach ($ids as $val) { - $total += CRM_Price_BAO_LineItem::getLineTotal($val, 'civicrm_participant'); - } - $updatedAmount = $total; + $updatedAmount = CRM_Price_BAO_LineItem::getLineTotal($contributionId); } else { $updatedAmount = $params['amount']; diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index 2ce9618fca..a607057c7b 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -414,7 +414,7 @@ SELECT id, html_type CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, FALSE, TRUE); } elseif (!$form->_mode) { - $form->addElement('checkbox', 'record_contribution', ts('Record Invoice?'), NULL, + $form->addElement('checkbox', 'record_contribution', ts('Record Payment?'), NULL, array('onclick' => "return showHideByValue('record_contribution','','payment_information','table-row','radio',false);") ); // Check permissions for financial type first diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 3a27183ccf..38b453fa7e 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -244,6 +244,8 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment ); $this->assign('hasPayment', $this->_paymentId); + $this->assign('componentId', $this->_id); + $this->assign('component', 'event'); // CRM-12615 - Get payment information from the primary registration if ((!$this->_paymentId) && ($this->_action == CRM_Core_Action::UPDATE)) { diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index 52c78fd53a..3d9aeb4f70 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -106,14 +106,9 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { $ids = CRM_Event_BAO_Participant::getParticipantIds($this->_contributionId); if (count($ids) > 1) { - $total = 0; - foreach ($ids as $val) { - $total += CRM_Price_BAO_LineItem::getLineTotal($val, 'civicrm_participant'); - } + $total = CRM_Price_BAO_LineItem::getLineTotal($this->_contributionId); $this->assign('totalLineTotal', $total); - - $lineItemTotal = CRM_Price_BAO_LineItem::getLineTotal($this->_participantId, 'civicrm_participant'); - $this->assign('lineItemTotal', $lineItemTotal); + $this->assign('lineItemTotal', $total); } $title = ts("Change selections for %1", array(1 => $this->_contributorDisplayName)); diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index ee52b4b3c7..45ac7a1a6c 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -74,6 +74,8 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $participantID, 'id', 'participant_id' ); $this->assign('hasPayment', $paymentId); + $this->assign('componentId', $participantID); + $this->assign('component', 'event'); if ($parentParticipantId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $participantID, 'registered_by_id' diff --git a/templates/CRM/Contribute/Form/AdditionalPayment.tpl b/templates/CRM/Contribute/Form/AdditionalPayment.tpl index 7f210de946..d302860ac7 100644 --- a/templates/CRM/Contribute/Form/AdditionalPayment.tpl +++ b/templates/CRM/Contribute/Form/AdditionalPayment.tpl @@ -84,14 +84,16 @@ - + {if $contributionMode} {/if} - - - + {if $eventName} + + + + {/if} {/if} - {if $participantId and $hasPayment} + {if $addRecordPayment} @@ -328,8 +331,8 @@ {/if} -{if $participantId and $hasPayment} - {include file="CRM/Contribute/Page/PaymentInfo.tpl" show='event-payment'} +{if $addRecordPayment} + {include file="CRM/Contribute/Page/PaymentInfo.tpl" show='payments'} {/if}
@@ -340,6 +343,9 @@ {assign var='urlParams' value="reset=1&id=$id&cid=$contact_id&action=update&context=$context&key=$searchKey"} {/if} {ts}Edit{/ts} + {if $paymentButtonName} + {ts}{$paymentButtonName}{/ts} + {/if} {/if} {if (call_user_func(array('CRM_Core_Permission','check'), 'delete in CiviContribute') && call_user_func(array('CRM_Core_Permission', 'check'), "delete contributions of type $financial_type") && $canDelete) || (call_user_func(array('CRM_Core_Permission','check'), 'delete in CiviContribute') && $noACL)} {assign var='urlParams' value="reset=1&id=$id&cid=$contact_id&action=delete&context=$context"} diff --git a/templates/CRM/Contribute/Page/PaymentInfo.tpl b/templates/CRM/Contribute/Page/PaymentInfo.tpl index 2080ff0b55..6a0c8019a7 100644 --- a/templates/CRM/Contribute/Page/PaymentInfo.tpl +++ b/templates/CRM/Contribute/Page/PaymentInfo.tpl @@ -23,12 +23,12 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if $show eq 'event-payment'} +{if $show eq 'payments'} {literal}
{ts}Participant{/ts}{$displayName}{if $component eq 'event'}{ts}Participant{/ts}{else}{ts}Contact{/ts}{/if}{$displayName}
{$form.payment_processor_id.label} * {$form.payment_processor_id.html}
{ts}Event{/ts}{$eventName}
{ts}Event{/ts}{$eventName}
{$form.total_amount.label} diff --git a/templates/CRM/Contribute/Form/ContributionView.tpl b/templates/CRM/Contribute/Form/ContributionView.tpl index 175fd5b4ba..4ebef343e7 100644 --- a/templates/CRM/Contribute/Form/ContributionView.tpl +++ b/templates/CRM/Contribute/Form/ContributionView.tpl @@ -35,6 +35,9 @@ {ts}Edit{/ts} + {if $paymentButtonName} + {ts}{$paymentButtonName}{/ts} + {/if} {/if} {if (call_user_func(array('CRM_Core_Permission','check'), 'delete in CiviContribute') && call_user_func(array('CRM_Core_Permission', 'check'), "delete contributions of type $financial_type") && $canDelete) || (call_user_func(array('CRM_Core_Permission','check'), 'delete in CiviContribute') && $noACL)} {assign var='urlParams' value="reset=1&id=$id&cid=$contact_id&action=delete&context=$context"} @@ -227,7 +230,7 @@ {$thankyou_date|crmDate}
{ts}Fees{/ts}