|
Revision 3495, 1.0 kB
(checked in by fabien, 6 years ago)
|
fixed null is replaced by 00.00 in Helpers (Date, Number, Currency) (closes #1434 - patch from skr68)
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id Rev Date
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
function format_number($number, $culture = null) |
|---|
| 21 |
{ |
|---|
| 22 |
if (is_null($number)) |
|---|
| 23 |
{ |
|---|
| 24 |
return null; |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
$numberFormat = new sfNumberFormat(_current_language($culture)); |
|---|
| 28 |
|
|---|
| 29 |
return $numberFormat->format($number); |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
function format_currency($amount, $currency = null, $culture = null) |
|---|
| 33 |
{ |
|---|
| 34 |
if (is_null($amount)) |
|---|
| 35 |
{ |
|---|
| 36 |
return null; |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
$numberFormat = new sfNumberFormat(_current_language($culture)); |
|---|
| 40 |
|
|---|
| 41 |
return $numberFormat->format($amount, 'c', $currency); |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
function _current_language($culture) |
|---|
| 45 |
{ |
|---|
| 46 |
return $culture ? $culture : sfContext::getInstance()->getUser()->getCulture(); |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|