From 593db37423fbbb9dd1af1df4bd37e5868e826aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Thu, 10 Jan 2013 13:53:46 +0100 Subject: [PATCH] Function getTotalDiscount of commonobject.class.php should always return a float for precission --- htdocs/core/class/commonobject.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e0646e4f2c8..95ff4b66c12 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1525,20 +1525,20 @@ abstract class CommonObject if ($this->total_localtax1 == 0) { // Search to know if there is a localtax of type 7 - // TODO : store local taxes types into object lines and remove this. We should use here $obj->localtax1_type but it is not yet filled into database, so we search into table of vat rate + // TODO : store local taxes types into object lines and remove this. We should use here $obj->localtax1_type but it is not yet filled into database, so we search into table of vat rate global $mysoc; - $localtax1_array=getLocalTaxesFromRate($vatrate,1,$mysoc); + $localtax1_array=getLocalTaxesFromRate($vatrate,1,$mysoc); if (empty($obj->localtax1_type)) { $obj->localtax1_type = $localtax1_array[0]; $obj->localtax1_tx = $localtax1_array[1]; - } + } //end TODO if ($obj->localtax1_type == '7') { - $this->total_localtax1 += $obj->localtax1_tx; - $this->total_ttc += $obj->localtax1_tx; + $this->total_localtax1 += $obj->localtax1_tx; + $this->total_ttc += $obj->localtax1_tx; } } if ($this->total_localtax2 == 0) @@ -2255,11 +2255,11 @@ abstract class CommonObject /** * Function that returns the total amount HT of discounts applied for all lines. * - * @return in 0 if no discount + * @return float */ function getTotalDiscount() { - $total_discount=0; + $total_discount=0.00; $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."det"; @@ -2289,7 +2289,7 @@ abstract class CommonObject else dol_syslog(get_class($this).'::getTotalDiscount '.$this->db->lasterror(), LOG_ERR); //print $total_discount; exit; - return price2num($total_discount); + return price2num($total_discount); } /**