From 80ce987ac8cab6b94fa005437983dcd19608bc77 Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 13 Sep 2024 04:09:18 +0200 Subject: [PATCH] NEW fichinter list disable details option (#30884) * Added FICHINTER_DISABLE_DETAILS_ON_LIST option * Updated changelog * Refactored option --- ChangeLog | 2 +- htdocs/fichinter/card-rec.php | 4 ++-- htdocs/fichinter/card.php | 10 +++++----- htdocs/fichinter/list.php | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6d35c7bf59..909e882a152 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,7 @@ English Dolibarr ChangeLog For users: ---------- NEW Add option THEME_STICKY_TOPMENU = 'scrollleftmenu_after_mainpage' (or 'disabled') - +NEW value for FICHINTER_DISABLE_DETAILS. If FICHINTER_DISABLE_DETAILS is set to '2' details are disabled only on intervention list. For developers: --------------- diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 67b97170895..66bf2f5a94a 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -336,7 +336,7 @@ if ($action == 'create') { // Author print "".$langs->trans("Author")."".$user->getFullName($langs).""; - if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS')) { + if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') { // Duration print ''.$langs->trans("TotalDuration").''; print ''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).''; @@ -557,7 +557,7 @@ if ($action == 'create') { print "".$langs->trans("Author").''.$author->getFullName($langs).""; - if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS')) { + if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') { // Duration print ''.$langs->trans("TotalDuration").''; print ''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 6e019eef4f8..9d696401441 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1401,7 +1401,7 @@ if ($action == 'create') { print ''; - if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS')) { + if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') { // Duration in time print ''; print ''; @@ -1429,7 +1429,7 @@ if ($action == 'create') { } // Line of interventions - if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS')) { + if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') { print ''; print ''; print ''; @@ -1610,7 +1610,7 @@ if ($action == 'create') { $db->free($resql); // Add new line - if ($object->statut == 0 && $user->hasRight('ficheinter', 'creer') && $action != 'editline' && !getDolGlobalString('FICHINTER_DISABLE_DETAILS')) { + if ($object->statut == 0 && $user->hasRight('ficheinter', 'creer') && $action != 'editline' && (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2')) { if (!$num) { print '
'; print '
'.$langs->trans("TotalDuration").''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).' ('.convertDurationtoHour($object->duration, "s").' '.$langs->trans("h").')
'; @@ -1727,7 +1727,7 @@ if ($action == 'create') { if ($user->socid == 0) { if ($action != 'editdescription' && ($action != 'presend')) { // Validate - if ($object->statut == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || getDolGlobalString('FICHINTER_DISABLE_DETAILS'))) { + if ($object->statut == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '1')) { if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'validate'))) { print '
'.$langs->trans("Validate").'
'; } else { @@ -1738,7 +1738,7 @@ if ($action == 'create') { // Modify if ($object->statut == Fichinter::STATUS_VALIDATED && ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'unvalidate')))) { print '
'; - if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS')) { + if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') { print $langs->trans("Modify"); } else { print $langs->trans("SetToDraft"); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 2ec7aaac5b9..99affd704a3 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -143,8 +143,8 @@ $arrayfields = array( 'f.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 511, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))), 'f.fk_statut' => array('label' => 'Status', 'checked' => 1, 'position' => 1000), 'f.signed_status' =>array('label' => 'SignedStatus', 'checked' => 0, 'position' => 1001), - 'fd.description' => array('label' => "DescriptionOfLine", 'checked' => 1, 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? 1 : 0), - 'fd.date' => array('label' => 'DateOfLine', 'checked' => 1, 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? 1 : 0), + 'fd.description' => array('label' => "DescriptionOfLine", 'checked' => 1, 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? 1 : 0), + 'fd.date' => array('label' => 'DateOfLine', 'checked' => 1, 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? 1 : 0), 'fd.duree' => array('label' => 'DurationOfLine', 'type' => 'duration', 'checked' => 1, 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? 1 : 0), //type duration is here because in database, column 'duree' is double ); '@phan-var-force array{label:string,type?:string,checked:int,position?:int,enabled?:int,langfile?:string,help:string} $arrayfields';