CR fix
GIt required mi to commit this changes
This commit is contained in:
parent
bc5fa5972a
commit
829b3bfc1d
@ -89,22 +89,22 @@ if ($action == 'convert')
|
|||||||
foreach ($listofmulti as $level => $multiprices)
|
foreach ($listofmulti as $level => $multiprices)
|
||||||
{
|
{
|
||||||
$price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update
|
$price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update
|
||||||
if (empty($price_base_type)) continue; // Discard not defined price levels
|
if (empty($price_base_type)) continue; // Discard not defined price levels
|
||||||
|
|
||||||
if ($price_base_type == 'TTC')
|
if ($price_base_type == 'TTC')
|
||||||
{
|
{
|
||||||
$newprice=price2num($objectstatic->multiprices_ttc[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals)
|
$newprice=price2num($objectstatic->multiprices_ttc[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals)
|
||||||
$newminprice=$objectstatic->multiprices_min_ttc[$level];
|
$newminprice=$objectstatic->multiprices_min_ttc[$level];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$newprice=price2num($objectstatic->multiprices[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals)
|
$newprice=price2num($objectstatic->multiprices[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals)
|
||||||
$newminprice=$objectstatic->multiprices_min[$level];
|
$newminprice=$objectstatic->multiprices_min[$level];
|
||||||
}
|
}
|
||||||
if ($newminprice > $newprice) $newminprice=$newprice;
|
if ($newminprice > $newprice) $newminprice=$newprice;
|
||||||
$newvat=str_replace('*','',$newvatrate);
|
$newvat=str_replace('*','',$newvatrate);
|
||||||
$newnpr=$objectstatic->multiprices_recuperableonly[$level];
|
$newnpr=$objectstatic->multiprices_recuperableonly[$level];
|
||||||
$newlevel=$level;
|
$newlevel=$level;
|
||||||
|
|
||||||
//print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n";
|
//print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n";
|
||||||
$retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr);
|
$retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr);
|
||||||
@ -117,30 +117,30 @@ if ($action == 'convert')
|
|||||||
if ($newlevel == 1) $updatelevel1=true;
|
if ($newlevel == 1) $updatelevel1=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update single price
|
// Update single price
|
||||||
$price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update
|
$price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update
|
||||||
if ($price_base_type == 'TTC')
|
if ($price_base_type == 'TTC')
|
||||||
{
|
{
|
||||||
$newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals)
|
$newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals)
|
||||||
$newminprice=$objectstatic->price_min_ttc;
|
$newminprice=$objectstatic->price_min_ttc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals)
|
$newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals)
|
||||||
$newminprice=$objectstatic->price_min;
|
$newminprice=$objectstatic->price_min;
|
||||||
}
|
}
|
||||||
if ($newminprice > $newprice) $newminprice=$newprice;
|
if ($newminprice > $newprice) $newminprice=$newprice;
|
||||||
$newvat=str_replace('*','',$newvatrate);
|
$newvat=str_replace('*','',$newvatrate);
|
||||||
$newnpr=$objectstatic->recuperableonly;
|
$newnpr=$objectstatic->recuperableonly;
|
||||||
$newlevel=0;
|
$newlevel=0;
|
||||||
if (! empty($price_base_type) && ! $updatelevel1)
|
if (! empty($price_base_type) && ! $updatelevel1)
|
||||||
{
|
{
|
||||||
//print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n";
|
//print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n";
|
||||||
$ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr);
|
$ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ret < 0 || $retm < 0) $error++;
|
if ($ret < 0 || $retm < 0) $error++;
|
||||||
else $nbrecordsmodified++;
|
else $nbrecordsmodified++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -1061,9 +1061,9 @@ class Product extends CommonObject
|
|||||||
// Price by quantity
|
// Price by quantity
|
||||||
$this->price_by_qty = $newpsq;
|
$this->price_by_qty = $newpsq;
|
||||||
|
|
||||||
$this->_log_price($user,$level); // Save price for level into table product_price
|
$this->_log_price($user,$level); // Save price for level into table product_price
|
||||||
|
|
||||||
$this->level = $level; // Store level of price edited for trigger
|
$this->level = $level; // Store level of price edited for trigger
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||||
@ -1213,8 +1213,8 @@ class Product extends CommonObject
|
|||||||
$this->multiprices_min[$i]=$result["price_min"];
|
$this->multiprices_min[$i]=$result["price_min"];
|
||||||
$this->multiprices_min_ttc[$i]=$result["price_min_ttc"];
|
$this->multiprices_min_ttc[$i]=$result["price_min_ttc"];
|
||||||
$this->multiprices_base_type[$i]=$result["price_base_type"];
|
$this->multiprices_base_type[$i]=$result["price_base_type"];
|
||||||
$this->multiprices_tva_tx[$i]=$result["tva_tx"];
|
$this->multiprices_tva_tx[$i]=$result["tva_tx"];
|
||||||
$this->multiprices_recuperableonly[$i]=$result["recuperableonly"];
|
$this->multiprices_recuperableonly[$i]=$result["recuperableonly"];
|
||||||
|
|
||||||
// Price by quantity
|
// Price by quantity
|
||||||
$this->prices_by_qty[$i]=$result["price_by_qty"];
|
$this->prices_by_qty[$i]=$result["price_by_qty"];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user