Function getTotalDiscount of commonobject.class.php should always return a float for precission
This commit is contained in:
parent
acd4e8f747
commit
593db37423
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user