From 0b28e17469567de56508a5d5a845d71b4fe57465 Mon Sep 17 00:00:00 2001 From: Andrew Nugged Date: Mon, 6 Dec 2021 12:05:11 +0200 Subject: [PATCH] Bug 20447: (QA follow-up) bugfix: itemcallnumber pref wasn't taken into account --- Koha/Holding.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Koha/Holding.pm b/Koha/Holding.pm index 7d60400d5f..373a3c919f 100644 --- a/Koha/Holding.pm +++ b/Koha/Holding.pm @@ -338,6 +338,20 @@ sub marc_to_koha_fields { my ($table, $column) = split /[.]/, $kohafield, 2; next unless $table eq 'holdings' && $mss->{$kohafield}; + if ( $column eq 'callnumber' && C4::Context->preference('itemcallnumber') ) { + + my @CN_prefs_mapping; + foreach my $itemcn_pref (split(/,/,C4::Context->preference('itemcallnumber'))){ + my $CNtag = substr( $itemcn_pref, 0, 3 ); + my @CNsubfields = split('',substr( $itemcn_pref, 3 )); + @CNsubfields = ('') unless @CNsubfields; + foreach my $CNsubfield (@CNsubfields) { + push @CN_prefs_mapping, { tagfield => $CNtag, tagsubfield => $CNsubfield }; + } + } + @{$mss->{$kohafield}} = @CN_prefs_mapping if @CN_prefs_mapping; + } + my @values; foreach my $field (@{$mss->{$kohafield}}) { my $tag = $field->{tagfield}; -- 2.35.1