From 6be536083e265bf0b5dbee6bf09ca1e129886d53 Mon Sep 17 00:00:00 2001 From: evarisk-micka Date: Wed, 3 Apr 2024 10:52:20 +0200 Subject: [PATCH] #1749 [Control] add: csslist in list fields --- class/control.class.php | 2 +- core/tpl/digiquali_control_list.tpl.php | 8 ++++---- view/control/control_list.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/class/control.class.php b/class/control.class.php index 11795f88..67aca85b 100644 --- a/class/control.class.php +++ b/class/control.class.php @@ -124,7 +124,7 @@ class Control extends SaturneObject 'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 5, 'showinpwa' => 0, 'index' => 1, 'default' => 0, 'arrayofkeyval' => [0 => 'StatusDraft', 1 => 'Validated', 2 => 'Locked', 3 => 'Archived']], 'note_public' => ['type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => 0, 'showinpwa' => 0], 'note_private' => ['type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 0, 'showinpwa' => 0], - 'verdict' => ['type' => 'smallint', 'label' => 'Verdict', 'enabled' => 1, 'position' => 110, 'notnull' => 0, 'visible' => 5, 'showinpwa' => 1, 'index' => 1, 'positioncard' => 20, 'arrayofkeyval' => [0 => '', 1 => 'OK', 2 => 'KO', 3 => 'N/A']], + 'verdict' => ['type' => 'smallint', 'label' => 'Verdict', 'enabled' => 1, 'position' => 110, 'notnull' => 0, 'visible' => 5, 'showinpwa' => 1, 'index' => 1, 'positioncard' => 20, 'csslist' => 'maxwidth100', 'arrayofkeyval' => [0 => '', 1 => 'OK', 2 => 'KO', 3 => 'N/A']], 'photo' => ['type' => 'text', 'label' => 'Photo', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 0, 'showinpwa' => 0], 'track_id' => ['type' => 'text', 'label' => 'TrackID', 'enabled' => 1, 'position' => 125, 'notnull' => 0, 'visible' => 2, 'showinpwa' => 0], 'fk_user_creat' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => 1, 'position' => 130, 'notnull' => 1, 'visible' => 0, 'showinpwa' => 0, 'foreignkey' => 'user.rowid'], diff --git a/core/tpl/digiquali_control_list.tpl.php b/core/tpl/digiquali_control_list.tpl.php index a7004726..60fb5725 100644 --- a/core/tpl/digiquali_control_list.tpl.php +++ b/core/tpl/digiquali_control_list.tpl.php @@ -298,8 +298,8 @@ foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['css']) ? '' : $val['css']); - if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; @@ -417,8 +417,8 @@ print ''; foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['css']) ? '' : $val['css']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif (in_array($key, ['days_remaining_before_next_control', 'status', 'verdict'])) $cssforfield .= ($cssforfield ? ' ' : '').'center'; if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; diff --git a/view/control/control_list.php b/view/control/control_list.php index 2b18abf4..2afc5d04 100644 --- a/view/control/control_list.php +++ b/view/control/control_list.php @@ -208,7 +208,7 @@ 'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=> $val['position'], 'help' => $val['help'], - 'css' => $val['css'] + 'css' => (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']) ]; } }