From: Jared Camins-Esakov To: dev@bywatersolutions.com Cc: Jared Camins-Esakov Subject: [PATCH] Bug 4421: Add alternate holdings display and prefs Date: Mon, 28 Mar 2011 08:13:44 -0400 Message-Id: <1301314424-3142-1-git-send-email-jcamins@bywatersolutions.com> X-Mailer: git-send-email 1.7.2.3 X-Original-Sender: jcamins@bywatersolutions.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of jcamins@bywatersolutions.com) smtp.mail=jcamins@bywatersolutions.com Precedence: list Mailing-list: list dev@bywatersolutions.com; contact dev+owners@bywatersolutions.com List-ID: X-Google-Group-Id: 274270250429 List-Help: , Content-Type: text/plain; charset="utf-8" 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 --- C4/Search.pm | 29 ++++++++++++++++++++ C4/XSLT.pm | 3 +- catalogue/detail.pl | 27 ++++++++++++++++++ installer/data/mysql/de-DE/mandatory/sysprefs.sql | 2 + installer/data/mysql/en/mandatory/sysprefs.sql | 2 + .../1-Obligatoire/unimarc_standard_systemprefs.sql | 3 +- installer/data/mysql/it-IT/necessari/sysprefs.sql | 4 ++- installer/data/mysql/pl-PL/mandatory/sysprefs.sql | 2 + ...m_preferences_full_optimal_for_install_only.sql | 4 ++- ...m_preferences_full_optimal_for_install_only.sql | 2 + installer/data/mysql/updatedatabase.pl | 8 +++++ .../en/modules/admin/preferences/cataloguing.pref | 6 ++++ .../prog/en/modules/catalogue/detail.tmpl | 8 +++++- .../prog/en/modules/catalogue/results.tmpl | 9 ++++++ .../opac-tmpl/prog/en/modules/opac-detail.tmpl | 8 +++++- .../opac-tmpl/prog/en/modules/opac-results.tmpl | 8 +++++- .../prog/en/xslt/MARC21slim2OPACResults.xsl | 20 ++++++++++++- opac/opac-detail.pl | 29 ++++++++++++++++++++ 18 files changed, 165 insertions(+), 9 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index cd970b7..5112e00 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1746,6 +1746,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 f349376..c06ba44 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -131,7 +131,8 @@ sub XSLTParse4Display { foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow DisplayOPACiconsXSLT URLLinkText viewISBD OPACBaseURL TraceCompleteSubfields - UseAuthoritiesForTracings TraceSubjectSubdivisions / ) + UseAuthoritiesForTracings TraceSubjectSubdivisions + AlternateHoldingsField AlternateHoldingsSeparator / ) { my $sp = C4::Context->preference( $syspref ); next unless defined($sp); diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 3d42326..9fce94c 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -236,6 +236,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 7b62465..5cdc656 100644 --- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql +++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql @@ -299,3 +299,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); +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 cb06622..1f36f19 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -299,3 +299,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); +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 68d78a0..8267865 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -301,4 +301,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); - +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 35116c1..8dde500 100644 --- a/installer/data/mysql/it-IT/necessari/sysprefs.sql +++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql @@ -285,4 +285,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AllowPurchaseSuggestionBranchChoice', 0, 'Allow user to choose branch when making a purchase suggestion','1','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); \ No newline at end of file +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); +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 231e541..4e3f386 100644 --- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql +++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql @@ -298,3 +298,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); +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 af69408..9a296bf 100644 --- 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 @@ -352,4 +352,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AllowPurchaseSuggestionBranchChoice', 0, 'Allow user to choose branch when making a purchase suggestion','1','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free'); -INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); \ No newline at end of file +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); +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 a72e79a..bbcf590 100644 --- 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 @@ -378,3 +378,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all subdivisions for subject tracings.','1','YesNo'); +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 23b5d67..92df3ba 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4134,6 +4134,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$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); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) 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 d809022..9a97118 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 @@ -52,6 +52,12 @@ Cataloging: - 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 - by default in new MARC records (leave blank to disable). 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 e3b0a8f..7fa6132 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl @@ -373,7 +373,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 e98cfd3..2675b9b 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 468e90f..afcef8b 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 d7aff2e..f88ef11 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl @@ -446,7 +446,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 0b53e22..e970fe7 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -23,6 +23,9 @@ + + + @@ -953,10 +956,23 @@ - + Availability: - No copies available + + + + + + + + + + + () + + No copies available + diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 1015e54..9994192 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -41,6 +41,8 @@ use C4::Members; use C4::VirtualShelves; use C4::XSLT; use C4::ShelfBrowser; +use MARC::Record; +use MARC::Field; BEGIN { if (C4::Context->preference('BakerTaylorEnabled')) { @@ -223,6 +225,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->{$_} : '' ); } -- 1.7.2.3