Skip to content

Commit

Permalink
fix(issue): possible SQL error whe naccessing issues from helpdesk
Browse files Browse the repository at this point in the history
not allowed by the UI, but may be useful someday

Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Jun 13, 2021
1 parent 33775dd commit 535aa82
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,14 @@ function plugin_formcreator_addDefaultWhere($itemtype) {
$currentUser = Session::getLoginUserID();
// Use default where for Tickets
$condition = Search::addDefaultWhere(Ticket::class);
// Replace references to ticket tables with issues table
$condition = str_replace('`glpi_tickets`', '`glpi_plugin_formcreator_issues`', $condition);
$condition = str_replace('`users_id_recipient`', '`requester_id`', $condition);
if ($condition != '') {
// Replace references to ticket tables with issues table
$condition = str_replace('`glpi_tickets`', '`glpi_plugin_formcreator_issues`', $condition);
$condition = str_replace('`users_id_recipient`', '`requester_id`', $condition);
$condition .= ' OR ';
}
// condition where current user is 1st validator of the issue
$condition .= " OR `glpi_plugin_formcreator_issues`.`users_id_validator` = '$currentUser'";
$condition .= " `glpi_plugin_formcreator_issues`.`users_id_validator` = '$currentUser'";
// condition where current user is a member of 1st validator group of the issue
$groupList = [];
foreach (Group_User::getUserGroups($currentUser) as $group) {
Expand Down

0 comments on commit 535aa82

Please sign in to comment.