From 6bbd6db84bc1ec551632a6e2334bc61080a37a17 Mon Sep 17 00:00:00 2001 From: Givriz Date: Mon, 17 May 2021 18:39:08 +0200 Subject: [PATCH 1/8] Compatibility phpv8 --- htdocs/admin/system/modules.php | 2 +- htdocs/admin/tools/listevents.php | 2 +- htdocs/main.inc.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index f3892e105bb..4a77d2452c4 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -277,7 +277,7 @@ if ($arrayfields['module_position']['checked']) { } // Fields from hook -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields'=>$arrayfields, 'param'=>empty($param) ? '' : $param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index fbc2412a9df..b894920d34e 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -245,7 +245,7 @@ if ($result) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } - if ($optioncss != '') { + if (!empty($optioncss)) { $param .= '&optioncss='.urlencode($optioncss); } if ($search_code) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index c9a7dd21ccc..1929dcbdb37 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -928,7 +928,7 @@ if (!defined('NOLOGIN')) { $_SESSION["dol_dst_second"] = isset($dol_dst_second) ? $dol_dst_second : ''; $_SESSION["dol_screenwidth"] = isset($dol_screenwidth) ? $dol_screenwidth : ''; $_SESSION["dol_screenheight"] = isset($dol_screenheight) ? $dol_screenheight : ''; - $_SESSION["dol_company"] = $conf->global->MAIN_INFO_SOCIETE_NOM; + $_SESSION["dol_company"] = getDolGlobalString("MAIN_INFO_SOCIETE_NOM"); $_SESSION["dol_entity"] = $conf->entity; // Store value into session (values stored only if defined) if (!empty($dol_hide_topmenu)) { From e7ac39fe35e84585564d57170c869a62d0525b03 Mon Sep 17 00:00:00 2001 From: Damien BENOIT <48482664+Givriz@users.noreply.github.com> Date: Tue, 18 May 2021 15:23:29 +0200 Subject: [PATCH 2/8] Update modules.php Added $param --- htdocs/admin/system/modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 4a77d2452c4..150ca10a359 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -65,6 +65,7 @@ $arrayfields = array( ); $arrayfields = dol_sort_array($arrayfields, 'position'); +$param = ''; /* @@ -277,7 +278,7 @@ if ($arrayfields['module_position']['checked']) { } // Fields from hook -$parameters = array('arrayfields'=>$arrayfields, 'param'=>empty($param) ? '' : $param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 38a5dfb26343258ae2a4fed72e69377483417783 Mon Sep 17 00:00:00 2001 From: Damien BENOIT <48482664+Givriz@users.noreply.github.com> Date: Tue, 18 May 2021 15:26:55 +0200 Subject: [PATCH 3/8] Update listevents.php Added $optioncss --- htdocs/admin/tools/listevents.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index b894920d34e..31287cbbb8a 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -68,6 +68,7 @@ $search_user = GETPOST("search_user", "alpha"); $search_desc = GETPOST("search_desc", "alpha"); $search_ua = GETPOST("search_ua", "restricthtml"); $search_prefix_session = GETPOST("search_prefix_session", "restricthtml"); +$optioncss = GETPOST("optioncss", "aZ"); // Option for the css output (always '' except when 'print') $now = dol_now(); $nowarray = dol_getdate($now); @@ -245,7 +246,7 @@ if ($result) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } - if (!empty($optioncss)) { + if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } if ($search_code) { From 8dd2af42df87ff1fc8d0968c4303682695177a43 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Wed, 26 May 2021 16:44:35 +0200 Subject: [PATCH 4/8] fix(param) select_produits_fournisseur_list --- htdocs/core/class/html.form.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a088f276463..04cfe53ef5d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3025,6 +3025,10 @@ class Form global $langs, $conf; global $price_level, $status, $finished; + if(empty($status)){ + $status = 1; + } + $selected_input_value = ''; if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { if ($selected > 0) { @@ -3040,7 +3044,7 @@ class Form print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').''; } else { - print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', -1, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); + print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder); } } @@ -3054,7 +3058,7 @@ class Form * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) * @param string $filtre Pour filtre sql * @param string $filterkey Filtre des produits - * @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell (not used here, a filter on tobuy is already hard coded in request) + * @param int $statut -1=Return all products, 0=Products not on buy, 1=Products on buy * @param int $outputmode 0=HTML select string, 1=Array * @param int $limit Limit of line number * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices @@ -3107,7 +3111,9 @@ class Form $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units u ON u.rowid = p.fk_unit"; } $sql .= " WHERE p.entity IN (".getEntity('product').")"; - $sql .= " AND p.tobuy = 1"; + if($statut != -1){ + $sql .= " AND p.tobuy = ".$statut; + } if (strval($filtertype) != '') { $sql .= " AND p.fk_product_type=".$this->db->escape($filtertype); } From d11d1a2018fd17b5538550f2e7c2fe40905ffa86 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Wed, 26 May 2021 17:10:12 +0200 Subject: [PATCH 5/8] lint(stickler) --- htdocs/core/class/html.form.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 04cfe53ef5d..b362b177ac0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3025,7 +3025,7 @@ class Form global $langs, $conf; global $price_level, $status, $finished; - if(empty($status)){ + if (empty($status)) { $status = 1; } @@ -3058,7 +3058,7 @@ class Form * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) * @param string $filtre Pour filtre sql * @param string $filterkey Filtre des produits - * @param int $statut -1=Return all products, 0=Products not on buy, 1=Products on buy + * @param int $statut -1=Return all products, 0=Products not on buy, 1=Products on buy * @param int $outputmode 0=HTML select string, 1=Array * @param int $limit Limit of line number * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices @@ -3111,7 +3111,7 @@ class Form $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units u ON u.rowid = p.fk_unit"; } $sql .= " WHERE p.entity IN (".getEntity('product').")"; - if($statut != -1){ + if ($statut != -1) { $sql .= " AND p.tobuy = ".$statut; } if (strval($filtertype) != '') { From c3c0ad1c8d8d980fc36bb25350971e92a3d9dcb7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 May 2021 17:20:09 +0200 Subject: [PATCH 6/8] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b362b177ac0..bb551300e67 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3112,7 +3112,7 @@ class Form } $sql .= " WHERE p.entity IN (".getEntity('product').")"; if ($statut != -1) { - $sql .= " AND p.tobuy = ".$statut; + $sql .= " AND p.tobuy = ".((int) $statut); } if (strval($filtertype) != '') { $sql .= " AND p.fk_product_type=".$this->db->escape($filtertype); From 8b1b2019f870a2e06ad8430ac8d724028680ad8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 May 2021 17:24:27 +0200 Subject: [PATCH 7/8] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bb551300e67..1f90b5f4fdc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3025,7 +3025,7 @@ class Form global $langs, $conf; global $price_level, $status, $finished; - if (empty($status)) { + if (!isset($status)) { $status = 1; } From 371f2e4f378d102395037580bef9b197486e8e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 26 May 2021 18:24:06 +0200 Subject: [PATCH 8/8] fix warnings --- htdocs/adherents/list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index dde013e60c4..986abc83b7b 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -5,6 +5,7 @@ * Copyright (C) 2013-2015 Raphaël Doursenaud * Copyright (C) 2014-2016 Juanjo Menent * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2021 Frédéric France * * 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 @@ -325,7 +326,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; } if (!empty($search_categ) || !empty($catid)) { @@ -1097,7 +1098,7 @@ while ($i < min($num, $limit)) { print ''; print dol_print_date($datefin, 'day'); if ($memberstatic->hasDelay()) { - $textlate .= ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')'; + $textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')'; print " ".img_warning($langs->trans("SubscriptionLate").$textlate); } print '';