Skip to content

Commit

Permalink
Merge pull request #152 from AlexanderBlanchardAC/25.01.00_custom_for…
Browse files Browse the repository at this point in the history
…m_permissions

feat: Add Forms From Additional Admin Locations
  • Loading branch information
AlexanderBlanchardAC authored Dec 18, 2024
2 parents 61eb522 + 4d8d9cf commit e04b19a
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions code/web/services/WebBuilder/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,29 @@ function getPortalCellValuesForSource() {
if (!UserAccount::userHasPermission('Administer All Custom Forms')) {
$libraryCustomForm = new LibraryCustomForm();
$userLibrary = Library::getPatronHomeLibrary();
$additionalAdminLocations = UserAccount::getActiveUserObj()->getAdditionalAdministrationLocations();

$validLibraryIds = [];

if ($userLibrary) {
$userLibraryId = $userLibrary->libraryId;
$libraryCustomForm->whereAdd('libraryId = ' . $userLibraryId);
$validLibraryIds[] = $userLibrary->libraryId;
}


if (!empty($additionalAdminLocations)) {
foreach ($additionalAdminLocations as $locationId => $locationName) {
$library = Library::getLibraryForLocation($locationId);
if ($library) {
$validLibraryIds[] = $library->libraryId;
}
}
}


if (count($validLibraryIds) > 0) {

$libraryCustomForm->whereAddIn('libraryId', $validLibraryIds, true);


$validCustomForms = [];
$libraryCustomForm->find();
Expand Down

0 comments on commit e04b19a

Please sign in to comment.