From b6e87ae519d5113f56667d7521245c319a89b8be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Sep 2024 11:25:34 +0200 Subject: [PATCH 1/3] Fix filter on membership type --- htdocs/adherents/subscription/list.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 7062d83d122..65561e386ec 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -46,7 +46,7 @@ $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hier $statut = (GETPOSTISSET("statut") ? GETPOST("statut", "alpha") : 1); $search_ref = GETPOST('search_ref', 'alpha'); -$search_type = GETPOST('search_type', 'alpha'); +$search_type = GETPOSTINT('search_type'); $search_lastname = GETPOST('search_lastname', 'alpha'); $search_firstname = GETPOST('search_firstname', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); @@ -168,6 +168,7 @@ if (empty($reshook)) { $form = new Form($db); $subscription = new Subscription($db); $adherent = new Adherent($db); +$adht = new AdherentType($db); $accountstatic = new Account($db); $now = dol_now(); @@ -209,7 +210,7 @@ if ($search_ref) { $sql .= " AND 1 = 2"; // Always wrong } } -if ($search_type) { +if ($search_type > 0) { $sql .= natural_search(array('c.fk_type'), $search_type); } if ($search_lastname) { @@ -446,7 +447,7 @@ if (!empty($arrayfields['d.ref']['checked'])) { // Type if (!empty($arrayfields['d.fk_type']['checked'])) { print ''; - print ''; + print $form->selectarray("search_type", $adht->liste_array(), $search_type, 1); print''; } From dd930e2d4bc1080b8e61688d2dac7852bf8777da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Sep 2024 14:38:09 +0200 Subject: [PATCH 2/3] Debug v20 --- htdocs/core/boxes/box_scheduled_jobs.php | 4 +++- htdocs/core/boxes/modules_boxes.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index 539781c0da9..dd2749c9451 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -63,7 +63,7 @@ class box_scheduled_jobs extends ModeleBoxes global $user, $langs, $conf, $form; $langs->load("cron"); - $this->info_box_head = array('text' => $langs->trans("BoxScheduledJobs", $max)); + $this->info_box_head = array('text' => $langs->trans("BoxScheduledJobs", $max), 'nbcol' => 4); if ($user->hasRight('cron', 'read')) { include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php'; @@ -158,6 +158,8 @@ class box_scheduled_jobs extends ModeleBoxes ); $line++; } + + // Line nb job in error $this->info_box_contents[$line][] = array( 'td' => 'class="tdoverflowmax300" colspan="3"', 'text' => $langs->trans("NumberScheduledJobError") diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index ea727fbf289..bec3761a329 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -45,7 +45,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo public $param; /** - * @var array box info heads + * @var array box info heads. Example: array('text' => $langs->trans("BoxScheduledJobs", $max), 'nbcol' => 4); */ public $info_box_head = array(); @@ -232,7 +232,7 @@ class ModeleBoxes // Can't be abstract as it is instantiated to build "empty" bo $out .= '
'."\n"; if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) { - $out .= ''."\n"; + $out .= '
'."\n"; } // Show box title From d2608dfb08c11e9a9d865bf41dff387b813d3ec8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Sep 2024 17:50:36 +0200 Subject: [PATCH 3/3] Fix type --- htdocs/adherents/subscription/list.php | 2 +- htdocs/core/class/html.form.class.php | 32 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 65561e386ec..9cffab343ff 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -312,7 +312,7 @@ if ($statut != '') { $param .= "&statut=".urlencode($statut); } if ($search_type) { - $param .= "&search_type=".urlencode($search_type); + $param .= "&search_type=".((int) $search_type); } if ($date_select) { $param .= "&date_select=".urlencode($date_select); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3280522592f..894a1ecef65 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8588,23 +8588,23 @@ class Form * Return a HTML select string, built from an array of key+value. * Note: Do not apply langs->trans function on returned content, content may be entity encoded twice. * - * @param string $htmlname Name of html select area. Try to start name with "multi" or "search_multi" if this is a multiselect + * @param string $htmlname Name of html select area. Try to start name with "multi" or "search_multi" if this is a multiselect * @param array{label:string,data-html:string,disable?:int<0,1>,css?:string} $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...)) - * @param string|string[] $id Preselected key or array of preselected keys for multiselect. Use 'ifone' to autoselect record if there is only one record. - * @param int<0,1>|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or ' ', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value. - * @param int<0,1> $key_in_label 1 to show key into label with format "[key] value" - * @param int<0,1> $value_as_key 1 to use value as key - * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container - * @param int<0,1> $translate 1=Translate and encode value - * @param int $maxlen Length maximum for labels - * @param int<0,1> $disabled Html select box is disabled - * @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order - * @param string $morecss Add more class to css styles - * @param int $addjscombo Add js combo - * @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set - * @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry - * @param int $nohtmlescape No html escaping (not recommended, use 'data-html' if you need to use label with HTML content). - * @return string HTML select string. + * @param string|string[]|int $id Preselected key or array of preselected keys for multiselect. Use 'ifone' to autoselect record if there is only one record. + * @param int<0,1>|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or ' ', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value. + * @param int<0,1> $key_in_label 1 to show key into label with format "[key] value" + * @param int<0,1> $value_as_key 1 to use value as key + * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container + * @param int<0,1> $translate 1=Translate and encode value + * @param int $maxlen Length maximum for labels + * @param int<0,1> $disabled Html select box is disabled + * @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order + * @param string $morecss Add more class to css styles + * @param int $addjscombo Add js combo + * @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set + * @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry + * @param int $nohtmlescape No html escaping (not recommended, use 'data-html' if you need to use label with HTML content). + * @return string HTML select string. * @see multiselectarray(), selectArrayAjax(), selectArrayFilter() */ public static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = 'minwidth75', $addjscombo = 1, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0)