From a4b9883eac9a6dbdaf5a967be042cbbf2bd53fd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 13:14:51 +0200 Subject: [PATCH] Use checkbox instead of combo to save clicks when adding a resource --- htdocs/core/tpl/resource_add.tpl.php | 25 ++++++++++++++++++------- htdocs/resource/element_resource.php | 17 ++++++++++++----- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 64d545ba583..5e605337c0c 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -13,9 +13,11 @@ require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; $form = new Form($db); $formresources = new FormResource($db); -$out = '
'; +$out = ''; -$out .= '
'; +$out .= '
'; + +$out .= ''; $out .= ''; $out .= ''; $out .= ''; @@ -23,21 +25,30 @@ $out .= ''; $out .= ''; $out .= ''; +$out .= '
'; // Place -$out .= '
'.$langs->trans("SelectResource").'
'; -$out .= '
'; +$out .= '
'.$langs->trans("SelectResource").'
'; +$out .= '
'; $events = array(); $out .= $formresources->select_resource_list('', 'fk_resource', '', 1, 1, 0, $events, '', 2, null); $out .= '
'; -$out .= '
'.$form->selectyesno('busy', (GETPOSTISSET('busy') ? GETPOST('busy') : 1), 1).'
'; -$out .= '
'.$form->selectyesno('mandatory', (GETPOSTISSET('mandatory') ? GETPOST('mandatory') : 0), 1).'
'; +$out .= '
'; +//$out .= $form->selectyesno('busy', (GETPOSTISSET('busy') ? GETPOST('busy') : 1), 1); +$out .= ''; +$out .= '
'; +$out .= '
'; +//$out .= $form->selectyesno('mandatory', (GETPOSTISSET('mandatory') ? GETPOST('mandatory') : 0), 1); +$out .= ''; +$out .= '
'; -$out .= '
'; +$out .= '
'; $out .= ''; $out .= '
'; +$out .= '
'; + $out .= ''; $out .= '
'; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 068dba8c50a..f4c6f3d3856 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -46,10 +46,6 @@ $sortfield = GETPOST('sortfield','alpha'); $page = GETPOST('page','int'); */ -if (!$user->rights->resource->read) { - accessforbidden(); -} - $object = new Dolresource($db); $hookmanager->initHooks(array('element_resource')); @@ -71,11 +67,22 @@ $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int'); +if (empty($mandatory)) { + $mandatory = 0; +} +if (empty($busy)) { + $busy = 0; +} + if ($socid > 0) { // Special for thirdparty $element_id = $socid; $element = 'societe'; } +if (!$user->rights->resource->read) { + accessforbidden(); +} + // Permission is not permission on resources. We just make link here on objects. if ($element == 'action') { $result = restrictedArea($user, 'agenda', $element_id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); @@ -365,7 +372,7 @@ if (!$ret) { print '
'; - print ''; + print '
'; // Type if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {