From 8510362eb920e52ada0de9ad1a5e2d6d0948f2ce Mon Sep 17 00:00:00 2001 From: akstis-typer Date: Fri, 23 May 2025 11:53:07 +0300 Subject: [PATCH] Rebased and added only necessary things Rebased myself to upstream main branch Edited only two files: -container.php that fixes formatting of field -field.class.php that fixes issue with field not respecting hiding condition in simple view --- ajax/container.php | 7 +++++++ inc/field.class.php | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ajax/container.php b/ajax/container.php index 5bdea933..04c2f2db 100644 --- a/ajax/container.php +++ b/ajax/container.php @@ -56,12 +56,19 @@ $display_condition = new PluginFieldsContainerDisplayCondition(); if ($display_condition->computeDisplayContainer($item, $containers_id)) { + $field_options = [ + 'label_class' => 'col-lg-3', + 'input_class' => 'col-lg-9', + ]; + echo "
"; PluginFieldsField::showDomContainer( $containers_id, $item, $type, $subtype, + $field_options, ); + echo "
"; } else { echo ''; } diff --git a/inc/field.class.php b/inc/field.class.php index 02d43247..513f62f3 100644 --- a/inc/field.class.php +++ b/inc/field.class.php @@ -887,6 +887,12 @@ public static function showForTab($params) { $item = $params['item']; + if ($item->fields['type'] == "") { + $item->fields['type'] = $params['options']['type']; + } + if ($item->fields['itilcategories_id'] == "") { + $item->fields['itilcategories_id'] = $params['options']['itilcategories_id']; + } $functions = array_column(debug_backtrace(), 'function'); $subtype = isset($_SESSION['glpi_tabs'][strtolower($item::getType())]) ? $_SESSION['glpi_tabs'][strtolower($item::getType())] : ''; $type = substr($subtype, -strlen('$main')) === '$main' @@ -956,7 +962,7 @@ public static function showForTab($params) } $html_id = 'plugin_fields_container_' . mt_rand(); - if (strpos($current_url, 'helpdesk.public.php') !== false) { + if (strpos($current_url, 'helpdesk.public.php') !== false || strpos($current_url, 'tracking.injector.php') !== false) { echo "
"; echo "
"; $field_options = [ @@ -976,7 +982,7 @@ public static function showForTab($params) $field_options ?? [], ); } - if (strpos($current_url, 'helpdesk.public.php') !== false) { + if (strpos($current_url, 'helpdesk.public.php') !== false || strpos($current_url, 'tracking.injector.php') !== false) { echo '
'; } echo '
';