From 829b3bfc1d3d7a5112d736d33bdb1b58feeb66a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= <marcosgdf@gmail.com> Date: Fri, 14 Jun 2013 12:48:27 +0200 Subject: [PATCH] CR fix GIt required mi to commit this changes --- htdocs/product/admin/product_tools.php | 80 +++++++++++++------------- htdocs/product/class/product.class.php | 10 ++-- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 6e7e0513576..aafe01bbb01 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -89,22 +89,22 @@ if ($action == 'convert') 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); @@ -117,30 +117,30 @@ if ($action == 'convert') 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++; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index abd5f4da7d0..26e30b75431 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1061,9 +1061,9 @@ class Product extends CommonObject // 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"); @@ -1213,8 +1213,8 @@ class Product extends CommonObject $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"]; -- GitLab