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/site@557 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -24,9 +24,18 @@ class FormatHelper extends AppHelper {
|
||||
return '-';
|
||||
//return null;
|
||||
|
||||
$currency = self::$number->currency($amount,
|
||||
isset($dollar_sign) ? $dollar_sign : 'USD',
|
||||
$spans ? array('before'=>'', 'after'=>'') : array());
|
||||
// Use of the $number->currency() function results in the clever,
|
||||
// but problematic, use of cents for amounts less than $1. For
|
||||
// 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)
|
||||
return ('<SPAN CLASS="dollar-sign">$</SPAN>' .
|
||||
|
||||
Reference in New Issue
Block a user