From 30d58f77db555c807251c4dfe1e0eb7ba1a7d486 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 11 Apr 2017 11:33:05 +0200 Subject: [PATCH 1/6] FIX : forgotten parameter for right multicompany use --- htdocs/contact/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 81f9b2a29be..2d8fe5b1d2e 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -39,7 +39,7 @@ $confirm = GETPOST('confirm', 'alpha'); // Security check if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'contact', $id, '',''); +$result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); // Get parameters $sortfield = GETPOST("sortfield",'alpha'); From 8a373b25ba04c33300ccd38fc5b02ad5c0ce1bd2 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 11 Apr 2017 12:41:19 +0200 Subject: [PATCH 2/6] FIX : global $dateSelector isn't the good one, then date selector on objectline_create tpl was hidden --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index c43380a9e7a..c6f6a638c6c 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -37,7 +37,7 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob $usemargins=1; } -global $dateSelector, $forceall, $senderissupplier, $inputalsopricewithtax; +global $forceall, $senderissupplier, $inputalsopricewithtax; if (empty($dateSelector)) $dateSelector=0; if (empty($forceall)) $forceall=0; if (empty($senderissupplier)) $senderissupplier=0; From 396ea5489419f61b936510c49b010e6abb95974e Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 12 Apr 2017 11:09:49 +0200 Subject: [PATCH 3/6] Subprice was null in supplier proposal and line was not transfered to supplier order --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index d14591b6b9f..8cbc3882fc4 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2781,7 +2781,7 @@ class SupplierProposalLine extends CommonObject $sql.= " ".price2num($this->localtax2_tx).","; $sql.= " '".$this->localtax1_type."',"; $sql.= " '".$this->localtax2_type."',"; - $sql.= " ".($this->subprice?price2num($this->subprice):"null").","; + $sql.= " ".price2num($this->subprice).","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".(isset($this->info_bits)?"'".$this->info_bits."'":"null").","; $sql.= " ".price2num($this->total_ht).","; From e23a44bcdf49d8e15062ec04d233ae3968604db1 Mon Sep 17 00:00:00 2001 From: Christian Seiler Date: Sun, 16 Apr 2017 11:09:18 +0200 Subject: [PATCH 4/6] Added missing Slashes fixed line where two slashes were missing, that caused an error when creating barcodes. --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 82449ac63cb..6d72a668269 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1074,7 +1074,7 @@ function check_value($mask,$value) // If an offset is asked if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]); - if (! empty($reg[3]) && preg_match('^\+',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]); + if (! empty($reg[3]) && preg_match('/^\+/',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]); // Define $sqlwhere From cd099bf3b1f02681176ec6e384825bb312e6ab32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Apr 2017 12:42:54 +0200 Subject: [PATCH 5/6] Fix bad update of prices --- htdocs/product/admin/product_tools.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 0d3ea7584f1..7e66181fdbc 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -42,8 +42,6 @@ $oldvatrate=GETPOST('oldvatrate'); $newvatrate=GETPOST('newvatrate'); //$price_base_type=GETPOST('price_base_type'); -$objectstatic = new Product($db); -$objectstatic2 = new ProductFournisseur($db); /* @@ -87,6 +85,7 @@ if ($action == 'convert') { $obj = $db->fetch_object($resql); + $objectstatic = new Product($db); // Object init must be into loop to avoid to get value of previous step $ret=$objectstatic->fetch($obj->rowid); if ($ret > 0) { @@ -150,7 +149,8 @@ if ($action == 'convert') if ($ret < 0 || $retm < 0) $error++; else $nbrecordsmodified++; } - + unset($objectstatic); + $i++; } } @@ -176,6 +176,7 @@ if ($action == 'convert') { $obj = $db->fetch_object($resql); + $objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step $ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid); if ($ret > 0) { @@ -207,6 +208,8 @@ if ($action == 'convert') if ($ret < 0 || $retm < 0) $error++; else $nbrecordsmodified++; } + unset($objectstatic2); + $i++; } } From a2287fd1830083b998c5274212563c78bf5c1b44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Apr 2017 13:46:41 +0200 Subject: [PATCH 6/6] Add example of sql request to fix llx_product_price --- htdocs/install/mysql/migration/repair.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 6b9ea2a16f7..b5ed611ea51 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -257,3 +257,14 @@ delete from llx_commande_fournisseur_dispatch where fk_commandefourndet = 0 or f delete from llx_menu where menu_handler = 'smartphone'; +-- Clean product prices +--delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05'; +-- Set product prices into llx_product with last price into llx_product_prices +--update llx_product as p set +-- p.price = (select pp.price from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), +-- p.price_ttc = (select pp.price_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), +-- p.price_min = (select pp.price_min from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), +-- p.price_min_ttc = (select pp.price_min_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1), +-- p.tva_tx = 0 +-- where price = 17.5 +