Fixed the currency function to always return in dollar amounts, and never in just cents, as the core currency function does.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@557 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -24,9 +24,18 @@ class FormatHelper extends AppHelper {
|
|||||||
return '-';
|
return '-';
|
||||||
//return null;
|
//return null;
|
||||||
|
|
||||||
$currency = self::$number->currency($amount,
|
// Use of the $number->currency() function results in the clever,
|
||||||
isset($dollar_sign) ? $dollar_sign : 'USD',
|
// but problematic, use of cents for amounts less than $1. For
|
||||||
$spans ? array('before'=>'', 'after'=>'') : array());
|
// example, 50 cents is shown as '50c', not '$0.50'. We want to
|
||||||
|
// keep everything in terms of dollars, especially for the cases
|
||||||
|
// where this result is placed into a form for input. 50 cents
|
||||||
|
// will end up as 50 dollars upon submission :-(
|
||||||
|
$currency = self::$number->format
|
||||||
|
($amount,
|
||||||
|
array('places' => 2,
|
||||||
|
'before' => $spans ? '' : (isset($dollar_sign) ? $dollar_sign : '$'),
|
||||||
|
'after' => $spans ? '' : null,
|
||||||
|
));
|
||||||
|
|
||||||
if ($spans)
|
if ($spans)
|
||||||
return ('<SPAN CLASS="dollar-sign">$</SPAN>' .
|
return ('<SPAN CLASS="dollar-sign">$</SPAN>' .
|
||||||
|
|||||||
Reference in New Issue
Block a user