Skip to content

Commit b972cfb

Browse files
committed
Fix: remove unrelated items when a ticket target is set
1 parent 6069ee6 commit b972cfb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

inc/field/dropdownfield.class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ public function buildParams($rand = null) {
246246
$canViewAllHardware = Session::haveRight('helpdesk_hardware', pow(2, Ticket::HELPDESK_ALL_HARDWARE));
247247
$canViewMyHardware = Session::haveRight('helpdesk_hardware', pow(2, Ticket::HELPDESK_MY_HARDWARE));
248248
$canViewGroupHardware = Session::haveRight('show_group_hardware', '1');
249+
$target_ticket = (new \PluginFormcreatorTargetTicket())->getTargetsForForm($form->getID());
249250
$groups = [];
250251
if ($canViewGroupHardware) {
251252
$groups = $this->getMyGroups(Session::getLoginUserID());
@@ -266,7 +267,7 @@ public function buildParams($rand = null) {
266267
];
267268
}
268269
// Check if helpdesk availability is fine tunable on a per item basis
269-
if (Session::getCurrentInterface() == "helpdesk" && $DB->fieldExists($itemtype::getTable(), 'is_helpdesk_visible')) {
270+
if ($DB->fieldExists($itemtype::getTable(), 'is_helpdesk_visible') && count($target_ticket) > 0) {
270271
$dparams_cond_crit[] = [
271272
'is_helpdesk_visible' => '1',
272273
];

0 commit comments

Comments
 (0)