diff --git a/code/web/services/MaterialsRequest/ManageRequests.php b/code/web/services/MaterialsRequest/ManageRequests.php index 642a8b4b76..77ba70ea0a 100644 --- a/code/web/services/MaterialsRequest/ManageRequests.php +++ b/code/web/services/MaterialsRequest/ManageRequests.php @@ -236,14 +236,14 @@ function launch() : void { while ($rolePermissions->fetch()) { // Get Available Assignees $materialsRequestManagers = new User(); - - if ($materialsRequestManagers->query("SELECT * from user WHERE id IN (SELECT userId FROM user_roles WHERE roleId = $rolePermissions->roleId) AND homeLocationId IN (" . implode(', ', $locationsForLibrary) . ")")) { - - while ($materialsRequestManagers->fetch()) { - if (empty($materialsRequestManagers->displayName)) { - $assignees[$materialsRequestManagers->id] = $materialsRequestManagers->firstname . ' ' . $materialsRequestManagers->lastname; - } else { - $assignees[$materialsRequestManagers->id] = $materialsRequestManagers->getDisplayName(); + if (count($locationsForLibrary) > 0) { + if ($materialsRequestManagers->query("SELECT * from user WHERE id IN (SELECT userId FROM user_roles WHERE roleId = $rolePermissions->roleId) AND homeLocationId IN (" . implode(', ', $locationsForLibrary) . ")")) { + while ($materialsRequestManagers->fetch()) { + if (empty($materialsRequestManagers->displayName)) { + $assignees[$materialsRequestManagers->id] = $materialsRequestManagers->firstname . ' ' . $materialsRequestManagers->lastname; + } else { + $assignees[$materialsRequestManagers->id] = $materialsRequestManagers->getDisplayName(); + } } } }