From de1386fda32e66013166c69e5d75da11bdd77f20 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 24 Aug 2015 11:10:58 -0400 Subject: [PATCH] Bug 13918 [QA Followup] - Improve $biblio->subtitles() --- Koha/Biblio.pm | 12 +++- .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 8 ++-- t/db_dependent/BiblioObject.t | 58 ++++++++++++++++++++ 3 files changed, 71 insertions(+), 7 deletions(-) create mode 100755 t/db_dependent/BiblioObject.t diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 2145a04..48c959d 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -37,14 +37,20 @@ Koha::Biblio - Koha Biblio Object class =cut -=head3 subtitle +=head3 subtitles + +my @subtitles = $biblio->subtitles(); + +Returns list of subtitles for a record. + +Keyword to MARC mapping for subtitle must be set for this method to return any possible values. =cut -sub subtitle { +sub subtitles { my ( $self ) = @_; - return GetRecordValue( 'subtitle', GetMarcBiblio( $self->id() ), GetFrameworkCode( $self->id() ) ); + return map { $_->{subfield} } @{ GetRecordValue( 'subtitle', GetMarcBiblio( $self->id ), $self->frameworkcode ) }; } diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 3a2cc76..d571f83 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -527,8 +527,8 @@ [% RESERVE.biblio.title %] - [% FOREACH subtitl IN RESERVE.biblio.subtitle %] - [% subtitl.subfield %] + [% FOREACH s IN RESERVE.biblio.subtitles %] + [% s %] [% END %] [% RESERVE.item.enumchron %] @@ -612,9 +612,9 @@