diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index c5d67555b39d..f2f7f737c34b 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3942,6 +3942,10 @@ public static function recordAdditionalPayment($contributionId, $trxnsData, $pay $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); @@ -3960,14 +3964,17 @@ public static function recordAdditionalPayment($contributionId, $trxnsData, $pay */ 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( @@ -4035,17 +4042,7 @@ public static function getPaymentInfo($id, $component, $getTrxnInfo = FALSE, $us $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 439080773c61..60769cedc870 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -236,11 +236,6 @@ public static function select(&$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 bbfcc709c569..3e45e415a06b 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -100,12 +100,17 @@ public function preProcess() { $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,56 +374,63 @@ public static function formRule($fields, $files, $self) { 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(); - $contribution = civicrm_api3('Contribution', 'getsingle', array( - 'return' => array("contribution_status_id"), - 'id' => $this->_contributionId, - )); - $contributionStatusId = CRM_Utils_Array::value('contribution_status_id', $contribution); - $result = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId); - // Fetch the contribution & do proportional line item assignment - $params = array('id' => $this->_contributionId); - $contribution = CRM_Contribute_BAO_Contribution::retrieve($params, $defaults, $params); - $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($this->_contributionId); - if (!empty($lineItems)) { - CRM_Contribute_BAO_Contribution::addPayments($lineItems, array($contribution), $contributionStatusId); - } - - // email sending - if (!empty($result) && !empty($submittedValues['is_email_receipt'])) { - $submittedValues['contact_id'] = $this->_contactId; - $submittedValues['contribution_id'] = $this->_contributionId; - - // to get 'from email id' for send receipt - $this->fromEmailId = $submittedValues['from_email_address']; - $sendReceipt = $this->emailReceipt($submittedValues); - } - - $statusMsg = ts('The payment record has been processed.'); - if (!empty($submittedValues['is_email_receipt']) && $sendReceipt) { - $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); - } - - CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success'); + $defaults = array(); + $contribution = civicrm_api3('Contribution', 'getsingle', array( + 'return' => array("contribution_status_id"), + 'id' => $this->_contributionId, + )); + $contributionStatusId = CRM_Utils_Array::value('contribution_status_id', $contribution); + $result = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId); + // Fetch the contribution & do proportional line item assignment + $params = array('id' => $this->_contributionId); + $contribution = CRM_Contribute_BAO_Contribution::retrieve($params, $defaults, $params); + $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($this->_contributionId); + if (!empty($lineItems)) { + CRM_Contribute_BAO_Contribution::addPayments($lineItems, array($contribution), $contributionStatusId); + } + + // email sending + if (!empty($result) && !empty($submittedValues['is_email_receipt'])) { + $submittedValues['contact_id'] = $this->_contactId; + $submittedValues['contribution_id'] = $this->_contributionId; + + // to get 'from email id' for send receipt + $this->fromEmailId = $submittedValues['from_email_address']; + $sendReceipt = $this->emailReceipt($submittedValues); + } + + $statusMsg = ts('The payment record has been processed.'); + if (!empty($submittedValues['is_email_receipt']) && $sendReceipt) { + $statusMsg .= ' ' . ts('A receipt has been emailed to the contributor.'); + } + CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success'); - $session = CRM_Core_Session::singleton(); - $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', - "reset=1&cid={$this->_contactId}&selectedChild=participant" - )); - } + $session = CRM_Core_Session::singleton(); + $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', + "reset=1&cid={$this->_contactId}&selectedChild={$childTab}" + )); } /** @@ -621,29 +633,6 @@ public function processCreditCard($submittedValues) { ); $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 f462c42ffd3c..bf2e25449798 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -217,13 +217,21 @@ public function preProcess() { 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 9975748dc87e..b4a519c58186 100644 --- a/CRM/Contribute/Page/PaymentInfo.php +++ b/CRM/Contribute/Page/PaymentInfo.php @@ -42,6 +42,9 @@ public function preProcess() { $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 539cf0d8dba6..d3238b00a293 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 @@ public function __construct( // 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 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) { $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 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) { '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 b0db26447b20..95a42afd1ac0 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -470,55 +470,47 @@ public static function getPartialPaymentWithType($entityId, $entityName = 'parti 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 49921a411e93..b66f5a0986b1 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -2029,11 +2029,7 @@ public static function changeFeeSelections($params, $participantId, $contributio // 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 cb41fb1e3509..db8b38ffd490 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -414,7 +414,7 @@ public static function buildQuickForm(&$form) { 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 06b04f8d6511..2e0ed75dd378 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -244,6 +244,8 @@ public function preProcess() { ); $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 d1a0a84e7e45..3c4478034ea9 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -106,14 +106,9 @@ public function preProcess() { $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 ee52b4b3c747..45ac7a1a6c97 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -74,6 +74,8 @@ public function preProcess() { $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 3dcb068a05a1..7a44dcc43e2d 100644 --- a/templates/CRM/Contribute/Form/AdditionalPayment.tpl +++ b/templates/CRM/Contribute/Form/AdditionalPayment.tpl @@ -84,14 +84,16 @@
{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 ee47ac877d39..e9af8f9b5484 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} | @@ -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} |