Skip to content

Commit 44f2b41

Browse files
committed
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.
1 parent cbfacce commit 44f2b41

File tree

3 files changed

+38
-34
lines changed

3 files changed

+38
-34
lines changed

code/web/release_notes/24.04.00.MD

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
### Marc holdings updates
1616
- Update logic for determining the display name for an owning library for a marc holding. (Ticket 124256) (*MDN*)
1717

18+
### Search Updates
19+
- 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*)
20+
1821
### Sierra Updates
1922
- Update Sierra Export to handle MARC holdings that do not have a MARC tag associated with them. (Ticket 124256) (*MDN*)
2023
- Fix loading location for additional copies. (Ticket 124256) (*MDN*)

code/web/sys/ConfigArray.php

+30-29
Original file line numberDiff line numberDiff line change
@@ -327,38 +327,39 @@ function updateConfigForScoping($configArray) {
327327
if ($Location->getNumResults() == 1) {
328328
$Location->fetch();
329329
//We found a location for the subdomain, get the library.
330+
if (($Location->subdomain == $subdomain) || (empty($Location->subdomain))) {
331+
global $librarySingleton;
332+
$library = $librarySingleton->getLibraryForLocation($Location->locationId);
333+
$locationSingleton->setActiveLocation(clone $Location);
334+
$timer->logTime("found the location and library based on subdomain");
335+
break;
336+
}
337+
}
330338

331-
global $librarySingleton;
332-
$library = $librarySingleton->getLibraryForLocation($Location->locationId);
333-
$locationSingleton->setActiveLocation(clone $Location);
334-
$timer->logTime("found the location and library based on subdomain");
339+
//Check to see if there is only one library in the system
340+
$Library = new Library();
341+
$Library->find();
342+
if ($Library->getNumResults() == 1) {
343+
$Library->fetch();
344+
$library = $Library;
345+
$timer->logTime("there is only one library for this install");
335346
break;
336347
} else {
337-
//Check to see if there is only one library in the system
338-
$Library = new Library();
339-
$Library->find();
340-
if ($Library->getNumResults() == 1) {
341-
$Library->fetch();
342-
$library = $Library;
343-
$timer->logTime("there is only one library for this install");
344-
break;
345-
} else {
346-
//If we are on the last subdomain to test, grab the default.
347-
if ($i == count($subdomainsToTest) - 1) {
348-
//Get the default library
349-
$Library = new Library();
350-
$Library->isDefault = 1;
351-
$Library->find();
352-
if ($Library->getNumResults() == 1) {
353-
$Library->fetch();
354-
$library = $Library;
355-
$timer->logTime("found the library based on the default");
356-
} else {
357-
//Just grab the first library sorted alphabetically by subdomain
358-
$library = new Library();
359-
$library->orderBy('subdomain');
360-
$library->find(true);
361-
}
348+
//If we are on the last subdomain to test, grab the default.
349+
if ($i == count($subdomainsToTest) - 1) {
350+
//Get the default library
351+
$Library = new Library();
352+
$Library->isDefault = 1;
353+
$Library->find();
354+
if ($Library->getNumResults() == 1) {
355+
$Library->fetch();
356+
$library = $Library;
357+
$timer->logTime("found the library based on the default");
358+
} else {
359+
//Just grab the first library sorted alphabetically by subdomain
360+
$library = new Library();
361+
$library->orderBy('subdomain');
362+
$library->find(true);
362363
}
363364
}
364365
}

code/web/sys/LibraryLocation/Location.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -1492,9 +1492,9 @@ function getActiveLocation() {
14921492
Location::$activeLocation = null;
14931493
}
14941494
} else {
1495-
//Check to see if we can get the active location based off the sublocation
1495+
//Check to see if we can get the active location based off the subdomain
14961496
$activeLocation = new Location();
1497-
$activeLocation->code = $locationCode;
1497+
$activeLocation->subdomain = $locationCode;
14981498
if ($activeLocation->find(true)) {
14991499
//Only use the location if we are in the subdomain for the parent library
15001500
if ($library->libraryId == $activeLocation->libraryId) {
@@ -1504,10 +1504,10 @@ function getActiveLocation() {
15041504
Location::$activeLocation = null;
15051505
}
15061506
} else {
1507-
//Check to see if we can get the active location based off the sublocation
1507+
//Check to see if we can get the active location based off the location code
15081508
$activeLocation = new Location();
1509-
$activeLocation->subdomain = $locationCode;
1510-
if ($activeLocation->find(true)) {
1509+
$activeLocation->code = $locationCode;
1510+
if ($activeLocation->find(true) && empty($activeLocation->subdomain)) {
15111511
//Only use the location if we are in the subdomain for the parent library
15121512
if ($library->libraryId == $activeLocation->libraryId) {
15131513
Location::$activeLocation = clone $activeLocation;

0 commit comments

Comments
 (0)