From 37fcbc34b8590c6cec21fb5e204c593f510ec87c Mon Sep 17 00:00:00 2001 From: Yannis Hoareau <93135242+YannisHoareau@users.noreply.github.com> Date: Wed, 1 May 2024 17:37:12 +0200 Subject: [PATCH] FIX: search and add extrafields to tasks when conf disabled (#29542) * FIX: task could be searched even if disabled * FIX: could add extra fields to task even if disabled --- htdocs/core/ajax/selectsearchbox.php | 2 +- htdocs/core/lib/project.lib.php | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index d2379f46966..f126589909e 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -92,7 +92,7 @@ if (isModEnabled('mrp') && $user->hasRight('mrp', 'read') && empty($conf->global if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->hasRight('projet', 'lire')) { $arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_project', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_project', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->hasRight('projet', 'lire')) { +if (isModEnabled('project') && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->hasRight('projet', 'lire')) { $arrayresult['searchintotasks'] = array('position'=>45, 'img'=>'object_projecttask', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('', 'object_projecttask', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index b04adbecdc7..d244c94cce9 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -529,14 +529,16 @@ function project_admin_prepare_head() $head[$h][2] = 'attributes'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/projet/admin/project_task_extrafields.php'; - $head[$h][1] = $langs->trans("ExtraFieldsProjectTask"); - $nbExtrafields = $extrafields->attributes['projet_task']['count']; - if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + if (empty($conf->global->PROJECT_HIDE_TASKS)) { + $head[$h][0] = DOL_URL_ROOT . '/projet/admin/project_task_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsProjectTask"); + $nbExtrafields = $extrafields->attributes['projet_task']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= '' . $nbExtrafields . ''; + } + $head[$h][2] = 'attributes_task'; + $h++; } - $head[$h][2] = 'attributes_task'; - $h++; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $langs->load("members");