From 5eb897e049748930273ab2e32c8f38d9d706ef69 Mon Sep 17 00:00:00 2001 From: tarrsalah Date: Mon, 12 Nov 2018 12:11:40 +0100 Subject: [PATCH 1/4] FIX sql query performance on list_qualified_avoir_supplier_invoices. --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index bbf5694fc2c..2d241ad6dcb 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1809,10 +1809,10 @@ class FactureFournisseur extends CommonInvoice $sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut, f.type, f.paye, pf.fk_paiementfourn"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid = pf.fk_facturefourn"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON (f.rowid = ff.fk_facture_source AND ff.type=".self::TYPE_REPLACEMENT.")"; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.fk_statut in (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")"; - $sql.= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement + $sql.= " AND NOT EXISTS (SELECT rowid from ".MAIN_DB_PREFIX."facture_fourn as ff WHERE f.rowid = ff.fk_facture_source"; + $sql.= " AND ff.type=".self::TYPE_REPLACEMENT.")"; $sql.= " AND f.type != ".self::TYPE_CREDIT_NOTE; // Type non 2 si facture non avoir if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid; $sql.= " ORDER BY f.ref"; From 66ea8bbe87ebe6763b7a660cfdcda8ef1dd22eea Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 12 Nov 2018 15:58:41 +0100 Subject: [PATCH 2/4] FIX : fourn payment modes musn't be available on customer docs --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index c9f534820fb..49d54dd63f8 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2045,7 +2045,7 @@ if ($action == 'create') print ''; print ''; if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); + $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT'); } else { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none'); } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 27fc1821a03..da7855b961b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2196,7 +2196,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); + $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT'); } else { $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none'); } From f404cae54609388431cb3925927b9756df2c604f Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 12 Nov 2018 16:04:42 +0100 Subject: [PATCH 3/4] FIX : Same on customer card --- htdocs/comm/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 2495d512c55..99fdc6dde76 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -326,7 +326,7 @@ if ($id > 0) print ''; if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id', 'CRDT'); } else { From 85dd0ec2ddd016283d54c7b8bf03b818647e9eaf Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 13 Nov 2018 15:24:53 +0100 Subject: [PATCH 4/4] FIX : filter on product category doesn't work --- htdocs/fourn/commande/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 8449181907c..732e408d66e 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -525,6 +525,7 @@ if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_request_author) $sql.=natural_search(array('u.lastname','u.firstname','u.login'), $search_request_author) ; if ($search_billed != '' && $search_billed >= 0) $sql .= " AND cf.billed = ".$db->escape($search_billed); +if ($search_product_category > 0) $sql.= " AND cp.fk_categorie = ".$search_product_category; //Required triple check because statut=0 means draft filter if (GETPOST('statut', 'intcomma') !== '')