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

CRM-20954 Fixing localized financial status problems #10747

Merged
merged 2 commits into from
Jul 25, 2017
Merged
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
10 changes: 5 additions & 5 deletions CRM/Contribute/BAO/Contribution.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3861,6 +3861,10 @@ public static function recordAdditionalPayment($contributionId, $trxnsData, $pay
$params['skipLineItem'] = TRUE;
$trxnsData['trxn_date'] = !empty($trxnsData['trxn_date']) ? $trxnsData['trxn_date'] : date('YmdHis');
$arAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contributionDAO->financial_type_id, 'Accounts Receivable Account is');

// get the paid status id
$paidStatus = CRM_Core_PseudoConstant::getKey('CRM_Financial_DAO_FinancialItem', 'status_id', 'Paid');

if ($paymentType == 'owed') {
$params['partial_payment_total'] = $contributionDAO->total_amount;
$params['partial_amount_to_pay'] = $trxnsData['total_amount'];
Expand Down Expand Up @@ -3932,9 +3936,6 @@ public static function recordAdditionalPayment($contributionId, $trxnsData, $pay
}

// update financial item statuses
$financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$paidStatus = array_search('Paid', $financialItemStatus);

$baseTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contributionId);
$sqlFinancialItemUpdate = "
UPDATE civicrm_financial_item fi
Expand All @@ -3961,7 +3962,6 @@ public static function recordAdditionalPayment($contributionId, $trxnsData, $pay
$contributionDetails = CRM_Core_DAO::setFieldValue('CRM_Contribute_BAO_Contribution', $contributionId, 'contribution_status_id', $statusId);
}
// add financial item entry
$financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
$lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contributionDAO->id);
if (!empty($lineItems)) {
foreach ($lineItems as $lineItemId => $lineItemValue) {
Expand All @@ -3975,7 +3975,7 @@ public static function recordAdditionalPayment($contributionId, $trxnsData, $pay
'contact_id' => $contributionDAO->contact_id,
'amount' => round($paid, 2),
'currency' => $contributionDAO->currency,
'status_id' => array_search('Paid', $financialItemStatus),
'status_id' => $paidStatus,
'entity_id' => $lineItemId,
'entity_table' => 'civicrm_line_item',
);
Expand Down