From aab23a15317a62e44f551eb71d43058e8f96b24e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 16 Jul 2019 17:50:43 +0200 Subject: [PATCH 1/4] FIX : do not return formatted prices in json string --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a68f09e5ee1..64c5063e8a2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2594,7 +2594,7 @@ class Form } $opt.= "\n"; - $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); + $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 32bc8a5fafb51d4070014f29f84456b4690b1762 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 18 Jul 2019 11:05:51 +0200 Subject: [PATCH 2/4] FIX fournrprice log for insert --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index fc74890f150..49a7b1935cb 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -439,7 +439,7 @@ class ProductFournisseur extends Product $resql = $this->db->query($sql); if ($resql) { - $idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); + $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); } else { $error++; @@ -462,7 +462,7 @@ class ProductFournisseur extends Product if (empty($error)) { $this->db->commit(); - return $idinserted; + return $this->product_fourn_price_id; } else { $this->db->rollback(); return -1; From 5daf0316f95b351fadfb4fee11ae42f5d0387908 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 18 Jul 2019 11:18:25 +0200 Subject: [PATCH 3/4] also fix bad insert sql command --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 49a7b1935cb..fa597ab8f7e 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -430,8 +430,8 @@ class ProductFournisseur extends Product $sql .= " " . $newnpr . ","; $sql .= $conf->entity . ","; $sql .= $delivery_time_days . ","; - $sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'"); - $sql .= (empty($barcode) ? 'NULL' : "'" . $this->db->escape($barcode) . "'"); + $sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'") . ","; + $sql .= (empty($barcode) ? 'NULL' : "'" . $this->db->escape($barcode) . "'") . ","; $sql .= (empty($fk_barcode_type) ? 'NULL' : "'" . $this->db->escape($fk_barcode_type) . "'"); $sql .= ")"; From f53f314211a29624cd3f61b8d3d2994ce9b69dc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jul 2019 17:15:50 +0200 Subject: [PATCH 4/4] Update fournisseur.product.class.php --- htdocs/fourn/class/fournisseur.product.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index fa597ab8f7e..6847af5edf1 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -439,7 +439,7 @@ class ProductFournisseur extends Product $resql = $this->db->query($sql); if ($resql) { - $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); + $idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); } else { $error++; @@ -462,6 +462,7 @@ class ProductFournisseur extends Product if (empty($error)) { $this->db->commit(); + $this->product_fourn_price_id = $idinserted; return $this->product_fourn_price_id; } else { $this->db->rollback();