Skip to content

Commit

Permalink
feat(core): add search option to get assign group / tech to ticket
Browse files Browse the repository at this point in the history
stonebuzz authored and btry committed Nov 5, 2018

Verified

This commit was signed with the committer’s verified signature.
neo1973 Markus Härer
1 parent a211e57 commit 5f1eb35
Showing 2 changed files with 58 additions and 0 deletions.
18 changes: 18 additions & 0 deletions hook.php
Original file line number Diff line number Diff line change
@@ -151,6 +151,24 @@ function plugin_formcreator_addLeftJoin($itemtype, $ref_table, $new_table, $link
}
$join = " LEFT JOIN `$new_table` AS `$AS` ON (`$ref_table`.`tickets_id` = `$AS`.`tickets_id`) ";
}

if ($new_table == 'glpi_groups') {
foreach ($already_link_tables as $table) {
if (strpos($table, $new_table) === 0) {
$AS = $table;
}
}
$join = " LEFT JOIN `$new_table` AS `$AS` ON (`glpi_groups_tickets_original_id`.`groups_id` = `$AS`.`id`) ";
}

if ($new_table == 'glpi_users' && $linkfield == 'users_id') {
foreach ($already_link_tables as $table) {
if (strpos($table, $new_table) === 0) {
$AS = $table;
}
}
$join = " LEFT JOIN `$new_table` AS `$AS` ON (`glpi_tickets_users_original_id`.`users_id` = `$AS`.`id`) ";
}
break;
}

40 changes: 40 additions & 0 deletions inc/issue.class.php
Original file line number Diff line number Diff line change
@@ -428,6 +428,46 @@ public function rawSearchOptions() {
]
];

$tab[] = [
'id' => '14',
'table' => User::getTable(),
'field' => 'name',
'linkfield' => 'users_id',
'name' => __('Technician'),
'datatype' => 'dropdown',
'forcegroupby' => false,
'massiveaction' => false,
'joinparams' => [
'beforejoin' => [
'table' => Ticket_User::getTable(),
'linkfield' => 'original_id',
'joinparams' => [
'jointype' => 'empty',
]
]
]
];

$tab[] = [
'id' => '15',
'table' => Group::getTable(),
'field' => 'name',
'linkfield' => 'groups_id',
'name' => __('Technician group'),
'datatype' => 'dropdown',
'forcegroupby' => false,
'massiveaction' => false,
'joinparams' => [
'beforejoin' => [
'table' => Group_Ticket::getTable(),
'linkfield' => 'original_id',
'joinparams' => [
'jointype' => 'empty',
]
]
]
];

return $tab;
}

0 comments on commit 5f1eb35

Please sign in to comment.