diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 07d7509c80bc4285569d223ce272203ebfa0fd9d..5a31c2cf26c0a6f2f4a8bd718e140e1abd49bb67 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1161,7 +1161,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 diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 32696ecf593e58518e1093f95f5accca3b919e49..6ff7356847f8abcba7aafc84d05d112b79266c0c 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -306,6 +306,18 @@ DELETE FROM llx_c_shipment_mode where code IN (select code from tmp_c_shipment_m drop table tmp_c_shipment_mode; +-- 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 + + -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_expensereport set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; @@ -324,3 +336,4 @@ drop table tmp_c_shipment_mode; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_expensereport_det as ed set date = (select date_debut from llx_expensereport as e where ed.fk_expensereport = e.rowid) where DATE(STR_TO_DATE(date, '%Y-%m-%d')) < '1000-00-00'; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; + diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index cc6f1b5116dfb0c2fd88cae7e69dfc848fedd66f..53a64b024721190d3eac47640173fcf6ef2897ba 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++; } } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 85bba0ad6e63507c84076bcab6d9ff7e1fd70773..572735384e4cbd90f016b9d4cff5648211478eca 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2838,7 +2838,7 @@ class SupplierProposalLine extends CommonObjectLine $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).",";