This patch fixes the numeric field formatter when handling negative values. Under certain circumstances, the following code can alter the value of a negative numeric value rather than simply adjust its display:

$value = number_format(floor($value), 0, '', $this->options['separator']);

If $value is -109.3, floor() will return -110, not -109 as desired.

This patch fixes this issue by adding a check for whether the value in question is positive or negative and using ceil() for negative values.

CommentFileSizeAuthor
views_numeric_negative_format.patch.txt1.02 KByhahn

Comments

merlinofchaos’s picture

Status: Needs review » Fixed

Silly PHP really should have a truncate function. :P Thanks. Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.