@@ -2724,7 +2724,8 @@ private function getMarcHoldings() {
2724
2724
if ($ marcSubfieldB != false ) {
2725
2725
//handle sierra quirks of location codes where the library can be indicated with the first part of a location code
2726
2726
$ owningLibraryCode = trim (strtolower ($ marcSubfieldB ->getData ()));
2727
- for ($ i = strlen ($ owningLibraryCode ); $ i >= 2 ; $ i --) {
2727
+ $ owningLibrary = $ owningLibraryCode ;
2728
+ for ($ i = strlen ($ owningLibraryCode ); $ i >= 1 ; $ i --) {
2728
2729
$ tmpOwningLibraryCode = substr ($ owningLibraryCode , 0 , $ i );
2729
2730
if (array_key_exists ($ tmpOwningLibraryCode , $ libraryCodeToDisplayName )) {
2730
2731
$ owningLibrary = $ libraryCodeToDisplayName [$ tmpOwningLibraryCode ];
@@ -2733,8 +2734,6 @@ private function getMarcHoldings() {
2733
2734
} elseif (array_key_exists ($ tmpOwningLibraryCode . 'z ' , $ libraryCodeToDisplayName )) {
2734
2735
$ owningLibrary = $ libraryCodeToDisplayName [$ tmpOwningLibraryCode . 'z ' ];
2735
2736
break ;
2736
- } else if ($ i == strlen ($ owningLibraryCode )){
2737
- $ owningLibrary = $ tmpOwningLibraryCode ;
2738
2737
}
2739
2738
}
2740
2739
$ marcHolding ['library ' ] = $ owningLibrary ;
@@ -2744,8 +2743,17 @@ private function getMarcHoldings() {
2744
2743
$ marcSubfieldC = $ marc852Field ->getSubfield ('c ' );
2745
2744
if ($ marcSubfieldC != false ) {
2746
2745
$ 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
+ }
2749
2757
}
2750
2758
$ marcHolding ['shelfLocation ' ] = $ shelfLocation ;
2751
2759
} else {
0 commit comments