diff --git a/site/views/helpers/format.php b/site/views/helpers/format.php index 226d9bc..4c84ce3 100644 --- a/site/views/helpers/format.php +++ b/site/views/helpers/format.php @@ -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 ('$' .