From 5eb897e049748930273ab2e32c8f38d9d706ef69 Mon Sep 17 00:00:00 2001 From: tarrsalah Date: Mon, 12 Nov 2018 12:11:40 +0100 Subject: [PATCH 1/6] 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/6] 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/6] 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 c6cf748ba71136c31da3e8122155e988ec768348 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 13 Nov 2018 14:44:10 +0100 Subject: [PATCH 4/6] Fix envent message on upload category picture --- htdocs/categories/photos.php | 19 ++++++++++++++++++- htdocs/core/class/html.formfile.class.php | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 472a8eb9b95..1c5359b90e8 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -69,7 +69,24 @@ if ($id > 0) if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if ($object->id) { - $object->add_photo($upload_dir, $_FILES['userfile']); + + $file = $_FILES['userfile']; + if (is_array($file['name']) && count($file['name']) > 0) + { + foreach ($file['name'] as $i => $name) + { + if(empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]) ) + { + setEventMessage($file['name'][$i] .' : '. $langs->trans(empty($file['tmp_name'][$i])? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles' ) ); + unset($file['name'][$i],$file['type'][$i],$file['tmp_name'][$i],$file['error'][$i],$file['size'][$i]); + } + } + } + + if(!empty($file['tmp_name'])){ + $object->add_photo($upload_dir, $file); + } + } } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 4e77269db4c..42854203196 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1635,7 +1635,7 @@ class FormFile */ private function _formAjaxFileUpload($object) { - global $langs; + global $langs, $conf; // PHP post_max_size $post_max_size = ini_get('post_max_size'); From 85dd0ec2ddd016283d54c7b8bf03b818647e9eaf Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 13 Nov 2018 15:24:53 +0100 Subject: [PATCH 5/6] 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') !== '') From 3ca45e0e407aefeb709d7c1e3e70319d27a98c34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Nov 2018 10:59:55 +0100 Subject: [PATCH 6/6] Fix double dot in sql filename --- htdocs/core/class/utils.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index ec95063906c..ab71975690f 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -210,7 +210,7 @@ class Utils if ($file == 'auto') { $prefix='dump'; - $ext='.sql'; + $ext='sql'; if (in_array($type, array('mysql', 'mysqli'))) { $prefix='mysqldump'; $ext='sql'; } //if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; } if (in_array($type, array('pgsql'))) { $prefix='pg_dump'; $ext='sql'; }