From edc7e2db848b6082e458d15545603b889272f1e2 Mon Sep 17 00:00:00 2001 From: Gaubert Date: Tue, 3 Mar 2020 14:30:49 +0100 Subject: [PATCH] bugfixes phpcf and add search options --- inc/container.class.php | 16 ++++++++++++++++ inc/field.class.php | 9 ++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/inc/container.class.php b/inc/container.class.php index 5e60b871..2ccdbe0f 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -1548,11 +1548,27 @@ static function getAddSearchOptions($itemtype, $containers_id = false) { $opt[$i]['joinparams']['beforejoin']['joinparams']['jointype'] = "itemtype_item"; } + if ($data['type'] === "dropdownoperatingsystems") { + $opt[$i]['table'] = 'glpi_operatingsystems'; + $opt[$i]['field'] = 'name'; + $opt[$i]['linkfield'] = $data['name']; + $opt[$i]['right'] = 'all'; + + $opt[$i]['forcegroupby'] = true; + + $opt[$i]['joinparams']['jointype'] = ""; + $opt[$i]['joinparams']['beforejoin']['table'] = $tablename; + $opt[$i]['joinparams']['beforejoin']['joinparams']['jointype'] = "itemtype_item"; + } + switch ($data['type']) { case 'dropdown': case 'dropdownuser': $opt[$i]['datatype'] = "dropdown"; break; + case 'dropdownoperatingsystems': + $opt[$i]['datatype'] = "dropdown"; + break; case 'yesno': $opt[$i]['datatype'] = "bool"; break; diff --git a/inc/field.class.php b/inc/field.class.php index f50aae9e..9f3ce0df 100644 --- a/inc/field.class.php +++ b/inc/field.class.php @@ -549,14 +549,13 @@ static function showForTab($params) { || in_array('showFormHelpdesk', $functions) ? 'dom' : 'domtab'; - if($subtype == -1) { - $type = 'dom'; + if ($subtype == -1) { + $type = 'dom'; } - // if we are in 'dom' or 'tab' type, no need for subtype ('domtab' specific) + // if we are in 'dom' or 'tab' type, no need for subtype ('domtab' specific) if ($type != 'domtab') { $subtype = ""; } - //find container (if not exist, do nothing) if (isset($_REQUEST['c_id'])) { $c_id = $_REQUEST['c_id']; @@ -844,7 +843,7 @@ static function prepareHtmlFields($fields, $items_id, $itemtype, $canedit = true 'right' => 'all', 'display' => false//, /*'condition' => 'is_active=1 && is_deleted=0'*/]); - }else { + } else { $os = new OperatingSystem(); $os->getFromDB($value); $html.= $os->fields['name'];