From f1663ada489cebc95344e165ce2d0f681acdeb5a Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sat, 26 Mar 2011 10:43:06 -0400 Subject: [PATCH] Bug 4421: Add alternate holdings display and prefs This patch adds the ability to specify a field with alternate holdings information for display when a biblio has no items associated with it. Two sysprefs are added: * AlternateHoldingsField specifies what field/subfields contain the alternate holdings information. When blank, the alternate holdings information is not displayed. The default is blank, as this is a new feature. * AlternateHoldingsSeparator specifies the string to be used to separate multiple subfields in the alternate holdings display. The default is ' '. Example use case: A library which does not have a 1-1 relationship between uncontrolled 852 fields from a legacy system and actual physical items on the shelf wishes to display holdings information from the 852, but does not want to create item records which are almost certain to be inaccurate. By enabling the alternate holdings feature (AlternateHoldingsField = '852abcdhi' and AlternateHoldingsSeparator = ' -- '), the library is able to gradually add item records as they locate the physical items, without losing the holdings information presently stored in the uncontrolled 852 fields. To test: 1) Set AlternateHoldingsField to '852abcdhi' 2) Set AlternateHoldingsSeparator to ' -- ' 3) Change the hidden value of subfields 'a', 'b', 'c', 'd', 'h', and/or 'i' of field 852 to 0 so that they display 4) Create a record which has data in the 852, but no item record 5) Look at holdings tab, where the data you entered should be displayed Proof-of-concept initially developed for the American Numismatic Society. Signed-off-by: Jared Camins-Esakov Signed-off-by: Nicole C. Engard Signed-off-by: Chris Cormack --- C4/Search.pm | 29 +++++++++++++++++++ C4/XSLT.pm | 4 ++- catalogue/detail.pl | 27 +++++++++++++++++ .../data/mysql/de-DE/mandatory/sysprefs.sql | 3 ++ .../data/mysql/en/mandatory/sysprefs.sql | 3 ++ .../unimarc_standard_systemprefs.sql | 2 ++ .../data/mysql/it-IT/necessari/sysprefs.sql | 3 ++ .../data/mysql/pl-PL/mandatory/sysprefs.sql | 3 ++ ...ferences_full_optimal_for_install_only.sql | 2 ++ ...ferences_full_optimal_for_install_only.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 7 +++++ .../admin/preferences/cataloguing.pref | 6 ++++ .../prog/en/modules/catalogue/detail.tmpl | 8 ++++- .../prog/en/modules/catalogue/results.tmpl | 9 ++++++ .../prog/en/modules/opac-detail.tmpl | 8 ++++- .../prog/en/modules/opac-results.tmpl | 8 ++++- .../prog/en/xslt/MARC21slim2OPACResults.xsl | 20 +++++++++++-- opac/opac-detail.pl | 29 +++++++++++++++++++ 18 files changed, 167 insertions(+), 6 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 35f016665a..b8939b65cb 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1748,6 +1748,35 @@ sub searchResults { $oldbiblio->{orderedcount} = $ordered_count; $oldbiblio->{isbn} =~ s/-//g; # deleting - in isbn to enable amazon content + + if (C4::Context->preference("AlternateHoldingsField") && $items_count == 0) { + my $fieldspec = C4::Context->preference("AlternateHoldingsField"); + my $subfields = substr $fieldspec, 3; + my $holdingsep = C4::Context->preference("AlternateHoldingsSeparator") || ' '; + my @alternateholdingsinfo = (); + my @holdingsfields = $marcrecord->field(substr $fieldspec, 0, 3); + my $alternateholdingscount = 0; + + for my $field (@holdingsfields) { + my %holding = ( holding => '' ); + my $havesubfield = 0; + for my $subfield ($field->subfields()) { + if ((index $subfields, $$subfield[0]) >= 0) { + $holding{'holding'} .= $holdingsep if (length $holding{'holding'} > 0); + $holding{'holding'} .= $$subfield[1]; + $havesubfield++; + } + } + if ($havesubfield) { + push(@alternateholdingsinfo, \%holding); + $alternateholdingscount++; + } + } + + $oldbiblio->{'ALTERNATEHOLDINGS'} = \@alternateholdingsinfo; + $oldbiblio->{'alternateholdings_count'} = $alternateholdingscount; + } + push( @newresults, $oldbiblio ) if(not $hidelostitems or (($items_count > $itemlost_count ) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 4345f27aa8..75eeb16c45 100755 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -1,6 +1,7 @@ package C4::XSLT; # Copyright (C) 2006 LibLime # +# Parts Copyright ByWater Solutions 2011 # # This file is part of Koha. # @@ -132,7 +133,8 @@ sub XSLTParse4Display { DisplayOPACiconsXSLT URLLinkText viewISBD OPACBaseURL TraceCompleteSubfields UseAuthoritiesForTracings TraceSubjectSubdivisions - Display856uAsImage OPACDisplay856uAsImage / ) + Display856uAsImage OPACDisplay856uAsImage + AlternateHoldingsField AlternateHoldingsSeparator / ) { my $sp = C4::Context->preference( $syspref ); next unless defined($sp); diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 5542163b17..21fcb1f138 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -246,6 +246,33 @@ $template->param( C4::Search::enabled_staff_search_views, ); +if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) { + my $fieldspec = C4::Context->preference("AlternateHoldingsField"); + my $subfields = substr $fieldspec, 3; + my $holdingsep = C4::Context->preference("AlternateHoldingsSeparator") || ' '; + my @alternateholdingsinfo = (); + my @holdingsfields = $record->field(substr $fieldspec, 0, 3); + + for my $field (@holdingsfields) { + my %holding = ( holding => '' ); + my $havesubfield = 0; + for my $subfield ($field->subfields()) { + if ((index $subfields, $$subfield[0]) >= 0) { + $holding{'holding'} .= $holdingsep if (length $holding{'holding'} > 0); + $holding{'holding'} .= $$subfield[1]; + $havesubfield++; + } + } + if ($havesubfield) { + push(@alternateholdingsinfo, \%holding); + } + } + + $template->param( + ALTERNATEHOLDINGS => \@alternateholdingsinfo, + ); +} + my @results = ( $dat, ); foreach ( keys %{$dat} ) { $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' ); diff --git a/installer/data/mysql/de-DE/mandatory/sysprefs.sql b/installer/data/mysql/de-DE/mandatory/sysprefs.sql index e96a1f6af1..13d2a3d64d 100755 --- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql +++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql @@ -304,3 +304,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('StaffAuthorisedValueImages','1','',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACDisplay856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','OFF|Details|Results|Both','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Display856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','OFF|Details|Results|Both','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free'); + diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index fa9c27f344..7b7cb75c89 100755 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -304,3 +304,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('StaffAuthorisedValueImages','1','',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACDisplay856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','OFF|Details|Results|Both','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Display856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','OFF|Details|Results|Both','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free'); + diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql index f489da8723..4e1b1aa713 100755 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -306,3 +306,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('StaffAuthorisedValueImages','1','',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACDisplay856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','OFF|Details|Results|Both','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Display856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','OFF|Details|Results|Both','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free'); diff --git a/installer/data/mysql/it-IT/necessari/sysprefs.sql b/installer/data/mysql/it-IT/necessari/sysprefs.sql index 8022eeda53..c884d59b91 100755 --- a/installer/data/mysql/it-IT/necessari/sysprefs.sql +++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql @@ -291,3 +291,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('StaffAuthorisedValueImages','1','',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACDisplay856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','OFF|Details|Results|Both','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Display856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','OFF|Details|Results|Both','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free'); + diff --git a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql index 9a62f0dd53..f0edd4e8f2 100755 --- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql +++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql @@ -303,3 +303,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('StaffAuthorisedValueImages','1','',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACDisplay856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','OFF|Details|Results|Both','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Display856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','OFF|Details|Results|Both','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free'); + diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql index 8e874943be..a90e664b0f 100755 --- a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql +++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql @@ -358,3 +358,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('StaffAuthorisedValueImages','1','',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACDisplay856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','OFF|Details|Results|Both','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Display856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','OFF|Details|Results|Both','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free'); diff --git a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql index 1523ee31b5..22f53e4bfd 100755 --- a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql +++ b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql @@ -383,3 +383,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('StaffAuthorisedValueImages','1','',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACDisplay856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','OFF|Details|Results|Both','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Display856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','OFF|Details|Results|Both','Choice'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index c9f0d1319d..6e6fb5cf8c 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4187,6 +4187,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo')"); $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea')"); print "Upgrade to $DBversion done ( Add Self-checkout by Login system preferences )\n"; +} + +$DBversion = "3.03.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free')"); + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free')"); + print "Upgrade to $DBversion done (Add sysprefs to control alternate holdings information display)\n"; SetVersion ($DBversion); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index d809022a53..9a971187b0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -51,6 +51,12 @@ Cataloging: - Map the MARC subfield - pref: itemcallnumber - "to an item's callnumber. (This can contain multiple subfields to look in; for instance 082ab would look in 082 subfields a and b.)
Examples: Dewey: 082ab or 092ab; LOC: 050ab or 090ab; from the item record: 852hi" + - + - Display MARC subfield + - pref: AlternateHoldingsField + - "as holdings information for records that do not have items (This can contain multiple subfields to look in; for instance 852abhi would look in 852 subfields a, b, h, and i.), with the subfields separated by" + - pref: AlternateHoldingsSeparator + - "." - - Fill in the MARC organization code - pref: MARCOrgCode diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl index a939b42580..506eb1d974 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl @@ -378,7 +378,13 @@ function verify_images() { -

No physical items for this record

+ + +
Holdings:
+ + +
No physical items for this record
+ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl index 651c902681..c7e111ab37 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl @@ -554,7 +554,16 @@ YAHOO.util.Event.onContentReady("searchheader", function () { + + Other holdings: +
    + +
  • + + + No items + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl index 95a8fed1e3..86b73dc4c1 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -418,7 +418,13 @@ YAHOO.util.Event.onContentReady("furtherm", function () { -

    No physical items for this record

    + + +
    Holdings:
    + + +
    No physical items for this record
    + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl index 7b77b8bef2..05df994d66 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl @@ -455,7 +455,13 @@ $(document).ready(function(){ - No items available: + + +  , + + + No items available: + Checked out (), diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl index 75e60ac6b1..97d83e2e17 100755 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -24,6 +24,9 @@ + + + @@ -961,10 +964,23 @@ - + Availability: - No copies available + + + + + + + + + + + () + + No copies available + diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 50bece592c..f2308347a2 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -42,6 +42,8 @@ use C4::VirtualShelves; use C4::XSLT; use C4::ShelfBrowser; use C4::Charset; +use MARC::Record; +use MARC::Field; BEGIN { if (C4::Context->preference('BakerTaylorEnabled')) { @@ -227,6 +229,33 @@ my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($bib subtitle => $subtitle, ); +if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) { + my $fieldspec = C4::Context->preference("AlternateHoldingsField"); + my $subfields = substr $fieldspec, 3; + my $holdingsep = C4::Context->preference("AlternateHoldingsSeparator") || ' '; + my @alternateholdingsinfo = (); + my @holdingsfields = $record->field(substr $fieldspec, 0, 3); + + for my $field (@holdingsfields) { + my %holding = ( holding => '' ); + my $havesubfield = 0; + for my $subfield ($field->subfields()) { + if ((index $subfields, $$subfield[0]) >= 0) { + $holding{'holding'} .= $holdingsep if (length $holding{'holding'} > 0); + $holding{'holding'} .= $$subfield[1]; + $havesubfield++; + } + } + if ($havesubfield) { + push(@alternateholdingsinfo, \%holding); + } + } + + $template->param( + ALTERNATEHOLDINGS => \@alternateholdingsinfo, + ); +} + foreach ( keys %{$dat} ) { $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' ); } -- 2.39.2