Skip to content

Commit 80ccbb6

Browse files
committed
Update logic for determining the display name for an owning library for a marc holding
1 parent a82772d commit 80ccbb6

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

code/web/Drivers/Millennium.php

+1
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ public function getIssueSummaries($id) {
837837
//Get each line within the summary
838838
$issueSummary = [];
839839
$issueSummary['type'] = 'issueSummary';
840+
$issueSummary['location'] = '';
840841
$summaryLines = [];
841842
preg_match_all('/<tr\\s*>(.*?)<\/tr>/s', $summaryData, $summaryLines, PREG_SET_ORDER);
842843
for ($matchi = 0; $matchi < count($summaryLines); $matchi++) {

code/web/RecordDrivers/MarcRecordDriver.php

+13-5
Original file line numberDiff line numberDiff line change
@@ -2724,7 +2724,8 @@ private function getMarcHoldings() {
27242724
if ($marcSubfieldB != false) {
27252725
//handle sierra quirks of location codes where the library can be indicated with the first part of a location code
27262726
$owningLibraryCode = trim(strtolower($marcSubfieldB->getData()));
2727-
for ($i = strlen($owningLibraryCode); $i >= 2; $i--) {
2727+
$owningLibrary = $owningLibraryCode;
2728+
for ($i = strlen($owningLibraryCode); $i >= 1; $i--) {
27282729
$tmpOwningLibraryCode = substr($owningLibraryCode, 0, $i);
27292730
if (array_key_exists($tmpOwningLibraryCode, $libraryCodeToDisplayName)) {
27302731
$owningLibrary = $libraryCodeToDisplayName[$tmpOwningLibraryCode];
@@ -2733,8 +2734,6 @@ private function getMarcHoldings() {
27332734
} elseif (array_key_exists($tmpOwningLibraryCode . 'z', $libraryCodeToDisplayName)) {
27342735
$owningLibrary = $libraryCodeToDisplayName[$tmpOwningLibraryCode . 'z'];
27352736
break;
2736-
} else if ($i == strlen($owningLibraryCode)){
2737-
$owningLibrary = $tmpOwningLibraryCode;
27382737
}
27392738
}
27402739
$marcHolding['library'] = $owningLibrary;
@@ -2744,8 +2743,17 @@ private function getMarcHoldings() {
27442743
$marcSubfieldC = $marc852Field->getSubfield('c');
27452744
if ($marcSubfieldC != false) {
27462745
$shelfLocation = trim(strtolower($marcSubfieldC->getData()));
2747-
if (array_key_exists($shelfLocation, $shelfLocationTranslationMapValues)) {
2748-
$shelfLocation = $shelfLocationTranslationMapValues[$shelfLocation];
2746+
if ($shelfLocationTranslationMap->usesRegularExpressions) {
2747+
foreach ($shelfLocationTranslationMapValues as $value => $translation) {
2748+
if (preg_match($value, $shelfLocation)) {
2749+
$shelfLocation = $translation;
2750+
break;
2751+
}
2752+
}
2753+
}else {
2754+
if (array_key_exists($shelfLocation, $shelfLocationTranslationMapValues)) {
2755+
$shelfLocation = $shelfLocationTranslationMapValues[$shelfLocation];
2756+
}
27492757
}
27502758
$marcHolding['shelfLocation'] = $shelfLocation;
27512759
} else {

code/web/release_notes/24.04.00.MD

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
### Koha Updates
1313
- When displaying libraries for self registration, sort by main library first and then alphabetically by name. (*MDN*)
1414

15+
### Marc holdings updates
16+
- Update logic for determining the display name for an owning library for a marc holding. (Ticket 124256) (*MDN*)
17+
1518
### Theme Updates
1619
- Replace Arial font with Arimo font. (Ticket 129721) (*MDN*)
1720

0 commit comments

Comments
 (0)