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 1 commit
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
7 changes: 3 additions & 4 deletions CRM/Contribute/BAO/Contribution.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3932,8 +3932,7 @@ 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);
$paidStatus = CRM_Core_PseudoConstant::getKey('CRM_Financial_DAO_FinancialItem', 'status_id', 'Paid');

$baseTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contributionId);
$sqlFinancialItemUpdate = "
Expand Down Expand Up @@ -3961,7 +3960,7 @@ 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');
$paidStatus = CRM_Core_PseudoConstant::getKey('CRM_Financial_DAO_FinancialItem', 'status_id', 'Paid');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelsov can you initialise this $paidStatus outside the IF-ELSEIF loop, that could avoid the repeated assignment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monishdeb sure, it's done

$lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contributionDAO->id);
if (!empty($lineItems)) {
foreach ($lineItems as $lineItemId => $lineItemValue) {
Expand All @@ -3975,7 +3974,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