From d0ab117488163894396aa0b9e95cebce50fa7a8b Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 28 Nov 2017 15:06:23 +0100 Subject: [PATCH 1/8] FIX : external user cannot be set as internal --- htdocs/user/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 846c9dffc9a..47ec64931d4 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -9,7 +9,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2016 Alexandre Spangaro - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015-2017 Jean-François Ferry * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2015 Charlie Benke * Copyright (C) 2016 Raphaël Doursenaud @@ -415,8 +415,8 @@ if (empty($reshook)) { } } - if (!$error && GETPOST('contactid', 'int')) { - $contactid = GETPOST('contactid', 'int'); + $contactid = GETPOST('contactid', 'int'); + if (!$error && $contactid >= 0) { if ($contactid > 0) { $contact = new Contact($db); From 883c9dbf99c28d099496c778d98eba69ad2e8c23 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 29 Nov 2017 09:28:03 +0100 Subject: [PATCH 2/8] Fix for multicompany last fix for multicompany compliance --- htdocs/core/modules/mailings/fraise.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index f0b834c53ba..be3c2702047 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -203,7 +203,7 @@ class mailing_fraise extends MailingTargets $sql.= " a.lastname, a.firstname,"; $sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; - $sql.= " WHERE a.email <> ''"; // Note that null != '' is false + $sql.= " WHERE a.email <> '' AND a.entity IN (".getEntity('member').")"; // Note that null != '' is false $sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1"; if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND a.datefin >= '".$this->db->idate($now)."'"; From c194538609eae4e167c3f5778e62aeb7dd9c886e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 29 Nov 2017 10:45:16 +0100 Subject: [PATCH 3/8] Update fraise.modules.php --- htdocs/core/modules/mailings/fraise.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index be3c2702047..3ff5901f1b2 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -203,7 +203,7 @@ class mailing_fraise extends MailingTargets $sql.= " a.lastname, a.firstname,"; $sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; - $sql.= " WHERE a.email <> '' AND a.entity IN (".getEntity('member').")"; // Note that null != '' is false + $sql.= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false $sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1"; if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND a.datefin >= '".$this->db->idate($now)."'"; From f04af6c1b3a4e4b5014cd69ed72a7358b3d1f521 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 29 Nov 2017 11:06:33 +0100 Subject: [PATCH 4/8] FIX : test for filter fk_status --- htdocs/compta/facture/stats/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 4d9fdebeb64..6670ed763e1 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -84,7 +84,7 @@ dol_mkdir($dir); $stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0)); if ($mode == 'customer') { - if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')'; + if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$object_status.')'; } if ($mode == 'supplier') { From dbde97f25f1f120ca042cb75fa337eca83328684 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Nov 2017 15:07:09 +0100 Subject: [PATCH 5/8] Update card.php --- htdocs/user/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 47ec64931d4..1885740b489 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -415,8 +415,8 @@ if (empty($reshook)) { } } - $contactid = GETPOST('contactid', 'int'); - if (!$error && $contactid >= 0) { + if (!$error && GETPOSTISSET('contactid')) { + $contactid = GETPOST('contactid', 'int'); if ($contactid > 0) { $contact = new Contact($db); From 9fa6bfd1a597835cfb1f2dcd9350bbd47e6bd0b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Nov 2017 15:30:41 +0100 Subject: [PATCH 6/8] Fix edit external user or not --- htdocs/core/lib/functions.lib.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b58d24ba028..4c6730500af 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -238,6 +238,17 @@ function dol_shutdown() } +/** + * Return true if we are in a context of submitting a parameter + * + * @param string $paramname Name or parameter to test + * @return boolean True if we have just submit a POST or GET request with the parameter provided (even if param is empty) + */ +function GETPOSTISSET($paramname) +{ + return (isset($_POST[$paramname]) || isset($_GET[$paramname])); +} + /** * Return value of a param into GET or POST supervariable. * Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder'] From b7f26ea788c49724069d0c244f9ec91224aed1d7 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 30 Nov 2017 11:10:01 +0100 Subject: [PATCH 7/8] FIX add line bad price and ref --- htdocs/fourn/commande/card.php | 2 +- htdocs/product/class/product.class.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 05bbc26e5fc..3af489e1ca5 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -390,7 +390,7 @@ if (empty($reshook)) $localtax1_tx, $localtax2_tx, $idprod, - $productsupplier->id, + $productsupplier->product_fourn_price_id , $productsupplier->fourn_ref, $remise_percent, 'HT', diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2e2f3007540..07aaf32cbb3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1384,6 +1384,7 @@ class Product extends CommonObject $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier $this->fourn_price_base_type = 'HT'; // Price base type $this->ref_fourn = $obj->ref_fourn; // deprecated + $this->product_fourn_price_id = $obj->rowid; // supplier price id $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $result=$obj->fk_product; @@ -1428,6 +1429,7 @@ class Product extends CommonObject $this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier $this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier + $this->product_fourn_price_id = $obj->rowid; // supplier price id $this->ref_fourn = $obj->ref_supplier; // deprecated $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier From b2effa7cc8c93b0495a6209a31bb9b967459fa49 Mon Sep 17 00:00:00 2001 From: Alexis ALGOUD Date: Thu, 30 Nov 2017 11:36:35 +0100 Subject: [PATCH 8/8] fix travis --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 3af489e1ca5..c241b2a2ffa 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -390,7 +390,7 @@ if (empty($reshook)) $localtax1_tx, $localtax2_tx, $idprod, - $productsupplier->product_fourn_price_id , + $productsupplier->product_fourn_price_id, $productsupplier->fourn_ref, $remise_percent, 'HT',