summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Miles2009-04-07 22:59:14 (GMT)
committer Earl Miles2009-04-07 22:59:14 (GMT)
commit6b367723205922b1a5b67b69e51a8b02150a5acf (patch)
tree5f0037d73e13b7ebe9322aac6c706ebd87a4bfc6
parent37cef70d433f43f502cb4a4379e9d5bc2640119d (diff)
#415672 by yhahn: Views inadvertently rounds negative numbers down instead of up when truncating.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--handlers/views_handler_field_numeric.inc3
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 57032db..9acef50 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -28,6 +28,7 @@ Views 2.4
o #342215: Occasional "holes" could appear in taxonomy term field causing query errors when relationship is used but not present.
o #414074 by dereine: Prevent fields becoming not editable by having just spaces in them in the Views UI.
o #378724: Displaying uploaded files as a link accidentally made the entire field a link rather than each one.
+ o #415672 by yhahn: Views inadvertently rounds negative numbers down instead of up when truncating.
Other changes:
o #375182 by vaish: Allow a reset parameter to views_get_all_views().
diff --git a/handlers/views_handler_field_numeric.inc b/handlers/views_handler_field_numeric.inc
index 2afb425..b996852 100644
--- a/handlers/views_handler_field_numeric.inc
+++ b/handlers/views_handler_field_numeric.inc
@@ -78,7 +78,8 @@ class views_handler_field_numeric extends views_handler_field {
}
else {
$remainder = abs($value) - intval(abs($value));
- $value = number_format(floor($value), 0, '', $this->options['separator']);
+ $value = $value > 0 ? floor($value) : ceil($value);
+ $value = number_format($value, 0, '', $this->options['separator']);
if ($remainder) {
// The substr may not be locale safe.
$value .= $this->options['decimal'] . substr($remainder, 2);