NEW fichinter list disable details option (#30884)

* Added FICHINTER_DISABLE_DETAILS_ON_LIST option

* Updated changelog

* Refactored option
This commit is contained in:
William Mead 2024-09-13 04:09:18 +02:00 committed by GitHub
parent ef0a3329a1
commit 80ce987ac8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 10 deletions

View file

@ -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:
---------------

View file

@ -336,7 +336,7 @@ if ($action == 'create') {
// Author
print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>";
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS')) {
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') {
// Duration
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
print '<td colspan="3">'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
@ -557,7 +557,7 @@ if ($action == 'create') {
print "<tr><td>".$langs->trans("Author").'</td><td colspan="3">'.$author->getFullName($langs)."</td></tr>";
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS')) {
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') {
// Duration
print '<tr><td class="titlefield">'.$langs->trans("TotalDuration").'</td>';
print '<td colspan="3">';

View file

@ -1401,7 +1401,7 @@ if ($action == 'create') {
print '<table class="border tableforfield centpercent">';
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS')) {
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') {
// Duration in time
print '<tr><td class="titlefield">'.$langs->trans("TotalDuration").'</td>';
print '<td>'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).' ('.convertDurationtoHour($object->duration, "s").' '.$langs->trans("h").')</td>';
@ -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 '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" name="addinter" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
@ -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 '<br>';
print '<table class="noborder centpercent">';
@ -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 '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=validate&token='.newToken().'">'.$langs->trans("Validate").'</a></div>';
} 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 '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=modify&token='.newToken().'">';
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS')) {
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') {
print $langs->trans("Modify");
} else {
print $langs->trans("SetToDraft");

View file

@ -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';