From 097de7b3cd934e67a00cb0a9c82bc02e6c47d838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 11 May 2020 18:34:54 +0200 Subject: [PATCH 1/2] Only add empty select if no multiselect --- htdocs/core/class/html.formactions.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 8aa51a66ab7..398e2b8a235 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -353,10 +353,13 @@ class FormActions require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $caction = new CActionComm($this->db); - // Suggest a list with manual events or all auto events - $arraylist = $caction->liste_array(1, 'code', $excludetype, $onlyautoornot); - array_unshift($arraylist, ' '); // Add empty line at start - //asort($arraylist); + // Suggest a list with manual events or all auto events + $arraylist = $caction->liste_array(1, 'code', $excludetype, $onlyautoornot); + if (empty($multiselect)) { + // Add empty line at start only if no multiselect + array_unshift($arraylist, ' '); + } + //asort($arraylist); if ($selected == 'manual') $selected = 'AC_OTH'; if ($selected == 'auto') $selected = 'AC_OTH_AUTO'; From 3a46d5a3dddaf7b581f11867cbbd4ee1cd74d9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 11 May 2020 18:46:54 +0200 Subject: [PATCH 2/2] Update agenda_other.php --- htdocs/admin/agenda_other.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 10bfa13d1ce..c5b196146d5 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -81,8 +81,10 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) } if ($action == 'set') { + $getDefaultFilter = GETPOST('AGENDA_DEFAULT_FILTER_TYPE'); + $defaultfilter = (is_array($getDefaultFilter)) ? implode(',', $getDefaultFilter) : $getDefaultFilter; dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); } @@ -377,7 +379,12 @@ print ''."\n"; print ''.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").''."\n"; print ' '."\n"; print ''."\n"; -$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1); +$multiselect = 0; +if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { + // We use an option here because it adds bugs when used on agenda page "peruser" and "list" + $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE)); +} +$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1, $multiselect); print ''."\n"; // AGENDA_DEFAULT_FILTER_STATUS