From 2602eee5eafe0d8ee32cd0f7b7570671112a3599 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 20 May 2021 15:22:57 +1200 Subject: [PATCH] Remove legacy references to partial_amount_to_pay This was an early concept of how to do partial payments that we eliminated a while back in favour of Payment.create It is not set anywhere in core - only checked so time to remove the checks --- CRM/Contribute/BAO/Contribution.php | 4 +--- CRM/Event/Form/Participant.php | 2 +- CRM/Price/BAO/LineItem.php | 2 +- CRM/Price/BAO/PriceField.php | 2 +- CRM/Price/BAO/PriceSet.php | 8 ++++---- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index b42475b09e..24198850db 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3629,9 +3629,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $trxnParams['card_type_id'] = $params['card_type_id'] ?? NULL; $return = $financialTxn = CRM_Core_BAO_FinancialTrxn::create($trxnParams); $params['entity_id'] = $financialTxn->id; - if (empty($params['partial_payment_total']) && empty($params['partial_amount_to_pay'])) { - self::$_trxnIDs[] = $financialTxn->id; - } + self::$_trxnIDs[] = $financialTxn->id; } } // record line items and financial items diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index cf8c3a3803..36d065acd1 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1312,7 +1312,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment ); } - // CRM-13964 partial_payment_total + // CRM-13964 partial payment if ($amountOwed > $params['total_amount']) { // the owed amount $contributionParams['total_amount'] = $amountOwed; diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 0f0b3815ca..0d6f12c6a8 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -490,7 +490,7 @@ WHERE li.contribution_id = %1"; public static function getLineItemArray(&$params, $entityId = NULL, $entityTable = 'contribution', $isRelatedID = FALSE) { if (!$entityId) { $priceSetDetails = CRM_Price_BAO_PriceSet::getDefaultPriceSet($entityTable); - $totalAmount = CRM_Utils_Array::value('partial_payment_total', $params, CRM_Utils_Array::value('total_amount', $params)); + $totalAmount = $params['total_amount'] ?? 0; $financialType = $params['financial_type_id'] ?? NULL; foreach ($priceSetDetails as $values) { if ($entityTable == 'membership') { diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 8d1113244b..db2687b1d3 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -804,7 +804,7 @@ WHERE id IN (" . implode(',', array_keys($priceFields)) . ')'; // now we have all selected amount in hand. $totalAmount = array_sum($selectedAmounts); // The form offers a field to enter the amount paid. This may differ from the amount that is due to complete the purchase - $totalPaymentAmountEnteredOnForm = CRM_Utils_Array::value('partial_payment_total', $fields, CRM_Utils_Array::value('total_amount', $fields)); + $totalPaymentAmountEnteredOnForm = CRM_Utils_Array::value('total_amount', $fields); if ($totalAmount < 0) { $error['_qf_default'] = ts('%1 amount can not be less than zero. Please select the options accordingly.', [1 => $componentName]); } diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php index ca851e8745..53687d2834 100644 --- a/CRM/Price/BAO/PriceSet.php +++ b/CRM/Price/BAO/PriceSet.php @@ -1657,7 +1657,7 @@ WHERE ct.id = cp.financial_type_id AND case 'Text': $firstOption = reset($field['options']); $params["price_{$id}"] = [$firstOption['id'] => $params["price_{$id}"]]; - CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params)); + CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem); $optionValueId = key($field['options']); if (CRM_Utils_Array::value('name', $field['options'][$optionValueId]) === 'contribution_amount') { @@ -1691,7 +1691,7 @@ WHERE ct.id = cp.financial_type_id AND $amount_override = NULL; if ($priceSetID && count(self::filterPriceFieldsFromParams($priceSetID, $params)) === 1) { - $amount_override = CRM_Utils_Array::value('partial_payment_total', $params, CRM_Utils_Array::value('total_amount', $params)); + $amount_override = CRM_Utils_Array::value('total_amount', $params); } CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, $amount_override); if (!empty($field['options'][$optionValueId]['tax_rate'])) { @@ -1706,7 +1706,7 @@ WHERE ct.id = cp.financial_type_id AND $params["price_{$id}"] = [$params["price_{$id}"] => 1]; $optionValueId = CRM_Utils_Array::key(1, $params["price_{$id}"]); - CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params)); + CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem); if (!empty($field['options'][$optionValueId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax); } @@ -1714,7 +1714,7 @@ WHERE ct.id = cp.financial_type_id AND case 'CheckBox': - CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params)); + CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem); foreach ($params["price_{$id}"] as $optionId => $option) { if (!empty($field['options'][$optionId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionId, $totalTax); -- 2.25.1