From 5c1a7e75414e27438bf55f50ecde8efafd2272d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Nov 2023 23:50:35 +0100 Subject: [PATCH] Debug v19 --- htdocs/commande/class/commande.class.php | 8 ++------ .../supplier_order/mod_commande_fournisseur_muguet.php | 8 +++----- htdocs/fourn/class/fournisseur.commande.class.php | 8 +++----- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index eef8dc9e7da..08eb4e42989 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4473,8 +4473,6 @@ class OrderLine extends CommonOrderLine */ public function insert($user = null, $notrigger = 0) { - global $langs, $conf; - $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. @@ -4549,8 +4547,8 @@ class OrderLine extends CommonOrderLine $sql .= ' fk_product, product_type, remise_percent, subprice, price, fk_remise_except,'; $sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,'; $sql .= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,'; - $sql .= ' fk_unit'; - $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; + $sql .= ' fk_unit,'; + $sql .= ' fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; $sql .= ')'; $sql .= " VALUES (".$this->fk_commande.","; $sql .= " ".($this->fk_parent_line > 0 ? "'".$this->db->escape($this->fk_parent_line)."'" : "null").","; @@ -4640,8 +4638,6 @@ class OrderLine extends CommonOrderLine */ public function update(User $user, $notrigger = 0) { - global $conf, $langs; - $error = 0; $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index f0e6c879e02..2f6604e6d10 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -54,7 +54,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders */ public $name = 'Muguet'; - public $prefix = 'CF'; + public $prefix = 'PO'; // PO for "Purchase Order" /** @@ -62,10 +62,8 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders */ public function __construct() { - global $conf; - - if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 5.0) { - $this->prefix = 'PO'; // We use correct standard code "PO = Purchase Order" + if (getDolGlobalInt('MAIN_VERSION_LAST_INSTALL') < 5) { + $this->prefix = 'CF'; // We use old prefix } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1fac63c6806..4ff8bfa6fdd 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3924,9 +3924,8 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql .= " fk_product, product_type, special_code, rang,"; $sql .= " qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,"; $sql .= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,"; - $sql .= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc"; - $sql .= " ,fk_parent_line)"; - $sql .= " )"; + $sql .= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc,"; + $sql .= " fk_parent_line)"; $sql .= " VALUES (".$this->fk_commande.", '".$this->db->escape($this->label)."','".$this->db->escape($this->desc)."',"; $sql .= " ".($this->date_start ? "'".$this->db->idate($this->date_start)."'" : "null").","; $sql .= " ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null").","; @@ -4008,13 +4007,12 @@ class CommandeFournisseurLigne extends CommonOrderLine */ public function update($notrigger = 0) { - global $conf, $user; + global $user; $error = 0; $this->db->begin(); - // Mise a jour ligne en base $sql = "UPDATE ".$this->db->prefix().$this->table_element." SET"; $sql .= " description='".$this->db->escape($this->desc)."'"; $sql .= ", ref='".$this->db->escape($this->ref_supplier)."'";