Skip to content

Commit

Permalink
When determining the active search location, match the rules for dete…
Browse files Browse the repository at this point in the history
…rmining scope. First check the subdomain against the active subdomain and then check the location code but only if the subdomain is blank.
  • Loading branch information
mdnoble73 committed Mar 29, 2024
1 parent cbfacce commit 44f2b41
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
3 changes: 3 additions & 0 deletions code/web/release_notes/24.04.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
### Marc holdings updates
- Update logic for determining the display name for an owning library for a marc holding. (Ticket 124256) (*MDN*)

### Search Updates
- When determining the active search location, match the rules for determining scope. First check the subdomain against the active subdomain and then check the location code but only if the subdomain is blank. (Ticket 128603) (*MDN*)

### Sierra Updates
- Update Sierra Export to handle MARC holdings that do not have a MARC tag associated with them. (Ticket 124256) (*MDN*)
- Fix loading location for additional copies. (Ticket 124256) (*MDN*)
Expand Down
59 changes: 30 additions & 29 deletions code/web/sys/ConfigArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,38 +327,39 @@ function updateConfigForScoping($configArray) {
if ($Location->getNumResults() == 1) {
$Location->fetch();
//We found a location for the subdomain, get the library.
if (($Location->subdomain == $subdomain) || (empty($Location->subdomain))) {
global $librarySingleton;
$library = $librarySingleton->getLibraryForLocation($Location->locationId);
$locationSingleton->setActiveLocation(clone $Location);
$timer->logTime("found the location and library based on subdomain");
break;
}
}

global $librarySingleton;
$library = $librarySingleton->getLibraryForLocation($Location->locationId);
$locationSingleton->setActiveLocation(clone $Location);
$timer->logTime("found the location and library based on subdomain");
//Check to see if there is only one library in the system
$Library = new Library();
$Library->find();
if ($Library->getNumResults() == 1) {
$Library->fetch();
$library = $Library;
$timer->logTime("there is only one library for this install");
break;
} else {
//Check to see if there is only one library in the system
$Library = new Library();
$Library->find();
if ($Library->getNumResults() == 1) {
$Library->fetch();
$library = $Library;
$timer->logTime("there is only one library for this install");
break;
} else {
//If we are on the last subdomain to test, grab the default.
if ($i == count($subdomainsToTest) - 1) {
//Get the default library
$Library = new Library();
$Library->isDefault = 1;
$Library->find();
if ($Library->getNumResults() == 1) {
$Library->fetch();
$library = $Library;
$timer->logTime("found the library based on the default");
} else {
//Just grab the first library sorted alphabetically by subdomain
$library = new Library();
$library->orderBy('subdomain');
$library->find(true);
}
//If we are on the last subdomain to test, grab the default.
if ($i == count($subdomainsToTest) - 1) {
//Get the default library
$Library = new Library();
$Library->isDefault = 1;
$Library->find();
if ($Library->getNumResults() == 1) {
$Library->fetch();
$library = $Library;
$timer->logTime("found the library based on the default");
} else {
//Just grab the first library sorted alphabetically by subdomain
$library = new Library();
$library->orderBy('subdomain');
$library->find(true);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions code/web/sys/LibraryLocation/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,9 @@ function getActiveLocation() {
Location::$activeLocation = null;
}
} else {
//Check to see if we can get the active location based off the sublocation
//Check to see if we can get the active location based off the subdomain
$activeLocation = new Location();
$activeLocation->code = $locationCode;
$activeLocation->subdomain = $locationCode;
if ($activeLocation->find(true)) {
//Only use the location if we are in the subdomain for the parent library
if ($library->libraryId == $activeLocation->libraryId) {
Expand All @@ -1504,10 +1504,10 @@ function getActiveLocation() {
Location::$activeLocation = null;
}
} else {
//Check to see if we can get the active location based off the sublocation
//Check to see if we can get the active location based off the location code
$activeLocation = new Location();
$activeLocation->subdomain = $locationCode;
if ($activeLocation->find(true)) {
$activeLocation->code = $locationCode;
if ($activeLocation->find(true) && empty($activeLocation->subdomain)) {
//Only use the location if we are in the subdomain for the parent library
if ($library->libraryId == $activeLocation->libraryId) {
Location::$activeLocation = clone $activeLocation;
Expand Down

0 comments on commit 44f2b41

Please sign in to comment.