Fix: Error on price page if no min price defined.
This commit is contained in:
parent
0d92a4f113
commit
def9892548
@ -814,7 +814,7 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
//multiprix
|
//multiprix
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
dolibarr_syslog("Product::update_price id=".$id." newprice=".$newprice." newpricebase=".$newpricebase);
|
dolibarr_syslog("Product::update_price id=".$id." newprice=".$newprice." newpricebase=".$newpricebase, LOG_DEBUG);
|
||||||
|
|
||||||
if ($newvat == '') $newvat=$this->tva_tx;
|
if ($newvat == '') $newvat=$this->tva_tx;
|
||||||
|
|
||||||
@ -826,11 +826,17 @@ class Product extends CommonObject
|
|||||||
$price = price2num($newprice) / (1 + ($newvat / 100));
|
$price = price2num($newprice) / (1 + ($newvat / 100));
|
||||||
$price = price2num($price,'MU');
|
$price = price2num($price,'MU');
|
||||||
|
|
||||||
if($newminprice!=''){
|
if($newminprice!='')
|
||||||
|
{
|
||||||
$price_min_ttc = price2num($newminprice,'MU');
|
$price_min_ttc = price2num($newminprice,'MU');
|
||||||
$price_min = price2num($newminprice) / (1 + ($newvat / 100));
|
$price_min = price2num($newminprice) / (1 + ($newvat / 100));
|
||||||
$price_min = price2num($price_min,'MU');
|
$price_min = price2num($price_min,'MU');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$price_min=0;
|
||||||
|
$price_min_ttc=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -838,15 +844,22 @@ class Product extends CommonObject
|
|||||||
$price_ttc = price2num($newprice) * (1 + ($newvat / 100));
|
$price_ttc = price2num($newprice) * (1 + ($newvat / 100));
|
||||||
$price_ttc = price2num($price_ttc,'MU');
|
$price_ttc = price2num($price_ttc,'MU');
|
||||||
|
|
||||||
if($newminprice!=''){
|
if ($newminprice!='')
|
||||||
|
{
|
||||||
$price_min = price2num($newminprice,'MU');
|
$price_min = price2num($newminprice,'MU');
|
||||||
$price_min_ttc = price2num($newminprice) * (1 + ($newvat / 100));
|
$price_min_ttc = price2num($newminprice) * (1 + ($newvat / 100));
|
||||||
$price_min_ttc = price2num($price_min_ttc,'MU');
|
$price_min_ttc = price2num($price_min_ttc,'MU');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$price_min=0;
|
||||||
|
$price_min_ttc=0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//print 'x'.$id.'-'.$newprice.'-'.$newpricebase.'-'.$price.'-'.$price_ttc.'-'.$price_min.'-'.$price_min_ttc;
|
||||||
|
|
||||||
// Ne pas mettre de quote sur le num<75>riques decimaux.
|
// Ne pas mettre de quote sur le numeriques decimaux.
|
||||||
// Ceci provoque des sotckage avec arrondis en base au lieu des valeurs exactes.
|
// Ceci provoque des stockage avec arrondis en base au lieu des valeurs exactes.
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product SET";
|
||||||
$sql.= " price_base_type='".$newpricebase."',";
|
$sql.= " price_base_type='".$newpricebase."',";
|
||||||
$sql.= " price=".$price.",";
|
$sql.= " price=".$price.",";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user