Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy references to partial_amount_to_pay #20358

Merged
merged 1 commit into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -3629,9 +3629,7 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues =
$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
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Form/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ public function submit($params) {
);
}

// CRM-13964 partial_payment_total
// CRM-13964 partial payment
if ($amountOwed > $params['total_amount']) {
// the owed amount
$contributionParams['total_amount'] = $amountOwed;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Price/BAO/LineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ public static function syncLineItems($entityId, $entityTable = 'civicrm_contribu
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') {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Price/BAO/PriceField.php
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ public static function priceSetValidation($priceSetId, $fields, &$error, $allowN
// 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]);
}
Expand Down
8 changes: 4 additions & 4 deletions CRM/Price/BAO/PriceSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ public static function getLine(&$params, &$lineItem, $priceSetID, $field, $id):
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') {
Expand Down Expand Up @@ -1691,7 +1691,7 @@ public static function getLine(&$params, &$lineItem, $priceSetID, $field, $id):
$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'])) {
Expand All @@ -1706,15 +1706,15 @@ public static function getLine(&$params, &$lineItem, $priceSetID, $field, $id):
$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);
}
break;

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);
Expand Down