Skip to content

Commit

Permalink
CR fix
Browse files Browse the repository at this point in the history
GIt required mi to commit this changes
  • Loading branch information
marcosgdf committed Jun 14, 2013
1 parent bc5fa59 commit 829b3bf
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
80 changes: 40 additions & 40 deletions htdocs/product/admin/product_tools.php
Expand Up @@ -89,22 +89,22 @@
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
if (empty($price_base_type)) continue; // Discard not defined price levels

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)
$newminprice=$objectstatic->multiprices_min_ttc[$level];
}
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)
$newminprice=$objectstatic->multiprices_min[$level];
}
if ($newminprice > $newprice) $newminprice=$newprice;
$newvat=str_replace('*','',$newvatrate);
$newnpr=$objectstatic->multiprices_recuperableonly[$level];
$newlevel=$level;
if (empty($price_base_type)) continue; // Discard not defined price levels

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)
$newminprice=$objectstatic->multiprices_min_ttc[$level];
}
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)
$newminprice=$objectstatic->multiprices_min[$level];
}
if ($newminprice > $newprice) $newminprice=$newprice;
$newvat=str_replace('*','',$newvatrate);
$newnpr=$objectstatic->multiprices_recuperableonly[$level];
$newlevel=$level;

//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);
Expand All @@ -117,30 +117,30 @@
if ($newlevel == 1) $updatelevel1=true;
}

// Update single price
$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')
{
$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;
}
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)
$newminprice=$objectstatic->price_min;
}
if ($newminprice > $newprice) $newminprice=$newprice;
$newvat=str_replace('*','',$newvatrate);
$newnpr=$objectstatic->recuperableonly;
$newlevel=0;
if (! empty($price_base_type) && ! $updatelevel1)
{
//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);
}

if ($ret < 0 || $retm < 0) $error++;
else $nbrecordsmodified++;
// Update single price
$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')
{
$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;
}
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)
$newminprice=$objectstatic->price_min;
}
if ($newminprice > $newprice) $newminprice=$newprice;
$newvat=str_replace('*','',$newvatrate);
$newnpr=$objectstatic->recuperableonly;
$newlevel=0;
if (! empty($price_base_type) && ! $updatelevel1)
{
//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);
}

if ($ret < 0 || $retm < 0) $error++;
else $nbrecordsmodified++;
}

$i++;
Expand Down
10 changes: 5 additions & 5 deletions htdocs/product/class/product.class.php
Expand Up @@ -1061,9 +1061,9 @@ function updatePrice($newprice, $newpricebase, $user, $newvat='',$newminprice=''
// Price by quantity
$this->price_by_qty = $newpsq;

$this->_log_price($user,$level); // Save price for level into table product_price

$this->level = $level; // Store level of price edited for trigger
$this->_log_price($user,$level); // Save price for level into table product_price

$this->level = $level; // Store level of price edited for trigger

// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
Expand Down Expand Up @@ -1213,8 +1213,8 @@ function fetch($id='',$ref='',$ref_ext='')
$this->multiprices_min[$i]=$result["price_min"];
$this->multiprices_min_ttc[$i]=$result["price_min_ttc"];
$this->multiprices_base_type[$i]=$result["price_base_type"];
$this->multiprices_tva_tx[$i]=$result["tva_tx"];
$this->multiprices_recuperableonly[$i]=$result["recuperableonly"];
$this->multiprices_tva_tx[$i]=$result["tva_tx"];
$this->multiprices_recuperableonly[$i]=$result["recuperableonly"];

// Price by quantity
$this->prices_by_qty[$i]=$result["price_by_qty"];
Expand Down

0 comments on commit 829b3bf

Please sign in to comment.