Skip to content

Commit

Permalink
fix(issue): possible SQL error
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Jul 3, 2020
1 parent 3f1c262 commit 0688d13
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,13 @@ function plugin_formcreator_addDefaultWhere($itemtype) {
switch ($itemtype) {
case PluginFormcreatorIssue::class:
$condition = Search::addDefaultWhere(Ticket::class);
$condition = str_replace('`glpi_tickets`', '`glpi_plugin_formcreator_issues`', $condition);
$condition = str_replace('`users_id_recipient`', '`requester_id`', $condition);
$condition = "($condition OR `glpi_plugin_formcreator_issues`.`users_id_validator` = '" . Session::getLoginUserID() . "')";
if ($condition == '') {
$condition = "(`glpi_plugin_formcreator_issues`.`users_id_validator` = '" . Session::getLoginUserID() . "')";
} else {
$condition = str_replace('`glpi_tickets`', '`glpi_plugin_formcreator_issues`', $condition);
$condition = str_replace('`users_id_recipient`', '`requester_id`', $condition);
$condition = "($condition OR `glpi_plugin_formcreator_issues`.`users_id_validator` = '" . Session::getLoginUserID() . "')";
}
break;

case PluginFormcreatorFormAnswer::class:
Expand Down

0 comments on commit 0688d13

Please sign in to comment.