From 9844c5a6b9d056a5a486fcdf0e6f3c7b44aaf419 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() Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- Koha/Biblio.pm | 12 +++- .../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 2145a04a3c..48c959d08f 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 c3e6d2c78b..475d4c24a0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -537,8 +537,8 @@ [% RESERVE.biblio.title %] - [% FOREACH subtitl IN RESERVE.biblio.subtitle %] - [% subtitl.subfield %] + [% FOREACH s IN RESERVE.biblio.subtitles %] + [% s %] [% END %] [% RESERVE.item.enumchron %] @@ -622,9 +622,9 @@