From 15e1d3b45685e47705d52d2c58a63fea2b3537df Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Thu, 24 Jan 2019 09:40:58 +0100 Subject: [PATCH 1/6] Fix fetch test --- .../class/fournisseur.commande.class.php | 95 ++++++++++--------- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d07c3347146..ef22d5bd8f8 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3016,49 +3016,58 @@ class CommandeFournisseurLigne extends CommonOrderLine $result = $this->db->query($sql); if ($result) { - $objp = $this->db->fetch_object($result); - - $this->rowid = $objp->rowid; - $this->id = $objp->rowid; - $this->fk_commande = $objp->fk_commande; - $this->desc = $objp->description; - $this->qty = $objp->qty; - $this->ref_fourn = $objp->ref; - $this->ref_supplier = $objp->ref; - $this->subprice = $objp->subprice; - $this->tva_tx = $objp->tva_tx; - $this->localtax1_tx = $objp->localtax1_tx; - $this->localtax2_tx = $objp->localtax2_tx; - $this->localtax1_type = $objp->localtax1_type; - $this->localtax2_type = $objp->localtax2_type; - $this->remise = $objp->remise; - $this->remise_percent = $objp->remise_percent; - $this->fk_product = $objp->fk_product; - $this->info_bits = $objp->info_bits; - $this->total_ht = $objp->total_ht; - $this->total_tva = $objp->total_tva; - $this->total_localtax1 = $objp->total_localtax1; - $this->total_localtax2 = $objp->total_localtax2; - $this->total_ttc = $objp->total_ttc; - $this->product_type = $objp->product_type; - $this->special_code = $objp->special_code; - - $this->ref = $objp->product_ref; - $this->product_ref = $objp->product_ref; - $this->product_libelle = $objp->product_libelle; - $this->product_desc = $objp->product_desc; - - $this->date_start = $this->db->jdate($objp->date_start); - $this->date_end = $this->db->jdate($objp->date_end); - $this->fk_unit = $objp->fk_unit; - - $this->multicurrency_subprice = $objp->multicurrency_subprice; - $this->multicurrency_total_ht = $objp->multicurrency_total_ht; - $this->multicurrency_total_tva = $objp->multicurrency_total_tva; - $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - - $this->db->free($result); - return 1; + if ($this->db->num_rows($result)) + { + $objp = $this->db->fetch_object($result); + + $this->rowid = $objp->rowid; + $this->id = $objp->rowid; + $this->fk_commande = $objp->fk_commande; + $this->desc = $objp->description; + $this->qty = $objp->qty; + $this->ref_fourn = $objp->ref; + $this->ref_supplier = $objp->ref; + $this->subprice = $objp->subprice; + $this->tva_tx = $objp->tva_tx; + $this->localtax1_tx = $objp->localtax1_tx; + $this->localtax2_tx = $objp->localtax2_tx; + $this->localtax1_type = $objp->localtax1_type; + $this->localtax2_type = $objp->localtax2_type; + $this->remise = $objp->remise; + $this->remise_percent = $objp->remise_percent; + $this->fk_product = $objp->fk_product; + $this->info_bits = $objp->info_bits; + $this->total_ht = $objp->total_ht; + $this->total_tva = $objp->total_tva; + $this->total_localtax1 = $objp->total_localtax1; + $this->total_localtax2 = $objp->total_localtax2; + $this->total_ttc = $objp->total_ttc; + $this->product_type = $objp->product_type; + $this->special_code = $objp->special_code; + + $this->ref = $objp->product_ref; + $this->product_ref = $objp->product_ref; + $this->product_libelle = $objp->product_libelle; + $this->product_desc = $objp->product_desc; + + $this->date_start = $this->db->jdate($objp->date_start); + $this->date_end = $this->db->jdate($objp->date_end); + $this->fk_unit = $objp->fk_unit; + + $this->multicurrency_subprice = $objp->multicurrency_subprice; + $this->multicurrency_total_ht = $objp->multicurrency_total_ht; + $this->multicurrency_total_tva = $objp->multicurrency_total_tva; + $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + + $this->db->free($result); + return 1; + } + else + { + $this->error='Supplier order line with id='.$rowid.' not found'; + dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); + return 0; + } } else { From 9a666b265f922e28f8e23e8f895bdeca74b5a3d0 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Mon, 28 Jan 2019 11:53:19 +0100 Subject: [PATCH 2/6] Use an other test --- htdocs/fourn/class/fournisseur.commande.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ef22d5bd8f8..a4283ee5162 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3016,9 +3016,11 @@ class CommandeFournisseurLigne extends CommonOrderLine $result = $this->db->query($sql); if ($result) { - if ($this->db->num_rows($result)) + $objp = $this->db->fetch_object($result); + + if (!empty($objp)) { - $objp = $this->db->fetch_object($result); + $this->rowid = $objp->rowid; $this->id = $objp->rowid; From 09ba059c2198c0c59dcaa305283793fba3ae0de0 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 31 Jan 2019 11:03:06 +0100 Subject: [PATCH 3/6] FIX : need an order by in case we found other invoice with same number but not same date --- htdocs/core/modules/facture/mod_facture_mars.php | 1 + htdocs/core/modules/facture/mod_facture_terre.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 831dce5d3e4..08edc1b6b90 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -178,6 +178,7 @@ class mod_facture_mars extends ModeleNumRefFactures $sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'"; $sql.= " AND entity IN (".getEntity('invoicenumber').")"; + $sql.= " ORDER BY ref DESC"; dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); $resql=$db->query($sql); diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 174d8314784..61a2f04c891 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -194,6 +194,7 @@ class mod_facture_terre extends ModeleNumRefFactures $sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'"; $sql.= " AND entity IN (".getEntity('invoicenumber').")"; + $sql.= " ORDER BY ref DESC"; dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); $resql=$db->query($sql); From caa937660d4b26b7e6e04407e92610da34095c50 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 31 Jan 2019 12:43:39 +0100 Subject: [PATCH 4/6] FIX : wrong test enabled --- htdocs/supplier_proposal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 8c2bfb8090a..7a56d73afff 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1725,7 +1725,7 @@ if ($action == 'create') } // Create an order - if (! empty($conf->commande->enabled) && $object->statut == SupplierProposal::STATUS_SIGNED) { + if (! empty($conf->fournisseur->enabled) && $object->statut == SupplierProposal::STATUS_SIGNED) { if ($user->rights->fournisseur->commande->creer) { print ''; } From 2d6f5ca8abad4d5b67d68c86407bfa1e1f3824c0 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Thu, 31 Jan 2019 20:22:56 +0100 Subject: [PATCH 5/6] #Fix : Error in Total Products/Services Its correct an error in the total of stat Products/Services total. --- htdocs/product/index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index bfd6f6ad18f..04c001c8bc2 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2014-2016 Charlie BENKE * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Pierre Ardoin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -174,12 +175,12 @@ $total=0; if ($type == '0') { print $statProducts; - $total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]); + $total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2])+round($prodser[0][3]); } else if ($type == '1') { print $statServices; - $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2]); + $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[1][3]); } else { From f7bed44441dc1e9f61c085fa9b658b53f903b01e Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 31 Jan 2019 21:39:02 +0100 Subject: [PATCH 6/6] FIX : quick search for supplier orders --- htdocs/fourn/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index f018b9574d1..d26c950d4fe 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -55,7 +55,7 @@ $search_deliveryyear=GETPOST("search_deliveryyear","int"); $search_deliverymonth=GETPOST("search_deliverymonth","int"); $search_deliveryday=GETPOST("search_deliveryday","int"); -$sall=GETPOST('search_all', 'alphanohtml'); +$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $search_product_category=GETPOST('search_product_category','int'); $search_ref=GETPOST('search_ref'); $search_refsupp=GETPOST('search_refsupp');