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-20145 line_item $0 entity_financial_trxn fix #9866

Merged
merged 5 commits into from
Feb 27, 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
3 changes: 2 additions & 1 deletion CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -5418,7 +5418,8 @@ public static function getSalesTaxFinancialAccounts() {
public static function createProportionalEntry($entityParams, $eftParams) {
$paid = $entityParams['line_item_amount'] * ($entityParams['trxn_total_amount'] / $entityParams['contribution_total_amount']);
// Record Entity Financial Trxn
$eftParams['amount'] = round($paid, 2);
// CRM-20145
$eftParams['amount'] = number_format((float)round($paid, 2), 2, '.', '');
Copy link
Contributor

Choose a reason for hiding this comment

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

@lcdservices could we make this into a tiny utility function that can be used wherever we are about to store a money value in db? Currently we should always be storing 2 digits after the decimal in core, but cryptocurrencies will need more. @pradpnayak could you ensure we create/use the same utility function throughout work on sales taxes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the PR accordingly.

civicrm_api3('EntityFinancialTrxn', 'create', $eftParams);
}

Expand Down