diff --git a/infolog/inc/class.infolog_widget.inc.php b/infolog/inc/class.infolog_widget.inc.php index 4d94329a47..cd5193665a 100644 --- a/infolog/inc/class.infolog_widget.inc.php +++ b/infolog/inc/class.infolog_widget.inc.php @@ -106,13 +106,21 @@ class infolog_widget switch($type) { - case '': // Sum of the alternatives + case '': // Sum of the alternatives, field-name can be prefixed with a minus to substract it's value $cell['type'] = 'float'; $cell['size'] = ',,,%0.2lf'; $value = 0.0; foreach(explode(':',$alternatives) as $name) { - $value += str_replace(array(' ',','),array('','.'),$this->data[$name]); + if ($name[0] === '-') + { + $val = '-'.$this->data[substr($name, 1)]; + } + else + { + $val = $this->data[$name]; + } + $value += str_replace(array(' ',','), array('','.'), $val); } $alternatives = ''; break;