Skip to content

Commit 5c5244a

Browse files
committed
fix(dropdownfield): empty SQL IN statement when restricted tickets rights
1 parent 7edbc57 commit 5c5244a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

inc/field/dropdownfield.class.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,17 @@ public function buildParams($rand = null) {
240240
];
241241
}
242242
if (Session::haveRight(Ticket::$rightname, Ticket::READGROUP)) {
243-
$requestersObserversGroupsQuery = new QuerySubQuery([
243+
$sub_query = [
244244
'SELECT' => 'tickets_id',
245245
'FROM' => Group_Ticket::getTable(),
246246
'WHERE' => [
247-
'groups_id' => $_SESSION['glpigroups'],
248247
'type' => [CommonITILActor::REQUESTER, CommonITILActor::OBSERVER]
249248
],
250-
]);
249+
];
250+
if (count($_SESSION['glpigroups']) > '0') {
251+
$sub_query['WHERE']['groups_id'] = $_SESSION['glpigroups'];
252+
}
253+
$requestersObserversGroupsQuery = new QuerySubQuery($sub_query);
251254
if (!isset($dparams_cond_crit['OR']['id'])) {
252255
$dparams_cond_crit['OR'] = [
253256
'id' => $requestersObserversGroupsQuery,

0 commit comments

Comments
 (0)