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

Significant digit fix #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions simpledonate.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ function simpledonate_civicrm_pageRun(&$page) {
}
else {
$priceFieldVal = civicrm_api3('PriceFieldValue', 'get', array('return' => "amount, title, name, is_default","price_field_id"=> $value['id'], 'is_active' => 1));
// Format the amount.
foreach ($priceFieldVal['values'] as $k => $dontCare) {
$amount = $priceFieldVal['values'][$k]['amount'];
$priceFieldVal['values'][$k]['amount'] = CRM_Utils_Money::format($amount, NULL, NULL, TRUE);
$n = $priceFieldVal['values'][$k]['amount'];
$priceFieldVal['values'][$k]['amount'] = (floor($n) == round($n, 2)) ? number_format($n) : number_format($n, 2);
}
$priceList = $priceFieldVal['values'];
$htmlPriceList[$value['html_type']] = $priceFieldVal['values'];
}
Expand Down