From 58801b522b1ec8442ba78b029b5b3083564ed189 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 877906f..f2b22ed 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -536,8 +536,8 @@ [% RESERVE.biblio.title %] - [% FOREACH subtitl IN RESERVE.biblio.subtitle %] - [% subtitl.subfield %] + [% FOREACH s IN RESERVE.biblio.subtitles %] + [% s %] [% END %] [% RESERVE.item.enumchron %] @@ -621,9 +621,9 @@