Révision 8be7bf84
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/views/handlers/views_handler_field_numeric.inc | ||
---|---|---|
118 | 118 |
public function render($values) { |
119 | 119 |
$value = $this->get_value($values); |
120 | 120 |
|
121 |
// Output nothing if the value is null. |
|
122 |
if (is_null($value)) { |
|
123 |
return ''; |
|
124 |
} |
|
125 |
|
|
121 | 126 |
// Hiding should happen before rounding or adding prefix/suffix. |
122 | 127 |
if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) { |
123 | 128 |
return ''; |
... | ... | |
127 | 132 |
$value = number_format($value, $this->options['precision'], $this->options['decimal'], $this->options['separator']); |
128 | 133 |
} |
129 | 134 |
else { |
130 |
$remainder = abs($value) - intval(abs($value)); |
|
135 |
$point_position = strpos($value, '.'); |
|
136 |
$remainder = ($point_position === FALSE) ? '' : substr($value, $point_position + 1); |
|
131 | 137 |
$value = $value > 0 ? floor($value) : ceil($value); |
132 | 138 |
$value = number_format($value, 0, '', $this->options['separator']); |
133 | 139 |
if ($remainder) { |
134 | 140 |
// The substr may not be locale safe. |
135 |
$value .= $this->options['decimal'] . substr($remainder, 2);
|
|
141 |
$value .= $this->options['decimal'] . $remainder;
|
|
136 | 142 |
} |
137 | 143 |
} |
138 | 144 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules