Skip to content

Commit

Permalink
bugfixes phpcf and add search options
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaubert authored and tomolimo committed Feb 16, 2021
1 parent f326791 commit edc7e2d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
16 changes: 16 additions & 0 deletions inc/container.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 4 additions & 5 deletions inc/field.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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'];
Expand Down

0 comments on commit edc7e2d

Please sign in to comment.