2
0
forked from Wavyzz/dolibarr

Fix: Minor fix

This commit is contained in:
Laurent Destailleur
2010-03-28 23:26:14 +00:00
parent a266e92bd0
commit f076c00dcd
2 changed files with 28 additions and 23 deletions

View File

@@ -2529,8 +2529,9 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
* \brief Return localtaxe rate for a particular tva
* \param tva Vat taxe
* \param local Local taxe to search and return
* \return int <0 if KO, localtax if found
*/
function get_localtax($tva, $local=0)
function get_localtax($tva, $local)
{
global $db, $conf, $mysoc;
@@ -2550,6 +2551,8 @@ function get_localtax($tva, $local=0)
if ($local==1) return $obj->localtax1;
elseif ($local==2) return $obj->localtax2;
}
return -1;
}
/**

View File

@@ -888,6 +888,8 @@ class Product extends CommonObject
//Local taxes
$localtax1=get_localtax($newvat,1);
$localtax2=get_localtax($newvat,2);
if (empty($localtax1)) $localtax1=0; // If = '' then = 0
if (empty($localtax2)) $localtax2=0; // If = '' then = 0
// Ne pas mettre de quote sur le numeriques decimaux.
// Ceci provoque des stockage avec arrondis en base au lieu des valeurs exactes.
@@ -897,8 +899,8 @@ class Product extends CommonObject
$sql.= " price_ttc=".$price_ttc.",";
$sql.= " price_min=".$price_min.",";
$sql.= " price_min_ttc=".$price_min_ttc.",";
$sql.= " localtax1_tx=".$localtax1.",";
$sql.= " localtax2_tx=".$localtax2.",";
$sql.= " localtax1_tx=".($localtax1>=0?$localtax1:'NULL').",";
$sql.= " localtax2_tx=".($localtax2>=0?$localtax2:'NULL').",";
$sql.= " tva_tx='".price2num($newvat)."'";
$sql.= " WHERE rowid = " . $id;