Skip to content

Commit

Permalink
fix entity restrict for reservable item dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 committed Jan 12, 2024
1 parent c04505d commit dc93852
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ReservationItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,7 @@ public static function countAvailableItems(string $itemtype): int
private static function getAvailableItemsCriteria(string $itemtype): array
{
$reservation_table = ReservationItem::getTable();
/** @var CommonDBTM $item */
$item = new $itemtype();
$item_table = $itemtype::getTable();

Expand All @@ -1110,6 +1111,10 @@ private static function getAvailableItemsCriteria(string $itemtype): array
]
];

if ($item->isEntityAssign()) {
$criteria['WHERE'] += getEntitiesRestrictCriteria($item_table, '', '', true);
}

if ($item->maybeTemplate()) {
$criteria['WHERE']["$item_table.is_template"] = 0;
}
Expand Down

0 comments on commit dc93852

Please sign in to comment.