@@ -, +, @@ - Remove SplitKohaField - Avoid using Stash in templates - Improved display of part fields --- C4/Biblio.pm | 20 ------------------- catalogue/detail.pl | 1 + .../prog/en/includes/biblio-title-head.inc | 13 +++++++++++- .../prog/en/includes/biblio-title.inc | 16 ++++++++++----- .../prog/en/modules/catalogue/detail.tt | 5 ++--- .../en/includes/biblio-title-head.inc | 13 +++++++++++- .../bootstrap/en/includes/biblio-title.inc | 16 ++++++++++----- .../bootstrap/en/modules/opac-detail.tt | 7 +++---- svc/checkouts | 3 ++- svc/holds | 4 ++-- t/Biblio.t | 2 +- t/Biblio2.t | 16 --------------- 12 files changed, 57 insertions(+), 59 deletions(-) --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -66,7 +66,6 @@ BEGIN { TransformHtmlToMarc TransformHtmlToXml prepare_host_field - SplitKohaField ); # Internal functions @@ -3420,25 +3419,6 @@ sub RemoveAllNsb { return $record; } -=head2 SplitKohaField - - $subtitles = SplitKohaField($biblio->subtitle()); - -Splits a Koha field with multiple values to an array. Multiple matches for a -Koha field (according to the bibliographic framework) are concatenated with -' | ', but in many cases it's not optimal for display and an array is -preferred. - -=cut - -sub SplitKohaField { - my $field = shift; - - my @parts = split(/ \| /, $field // '' ); - - return \@parts; -} - 1; --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -78,6 +78,7 @@ my $biblionumber = $query->param('biblionumber'); $biblionumber = HTML::Entities::encode($biblionumber); my $record = GetMarcBiblio({ biblionumber => $biblionumber }); my $biblio = Koha::Biblios->find( $biblionumber ); +$template->param( 'biblio', $biblio ); if ( not defined $record ) { # biblionumber invalid -> report and exit --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title-head.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title-head.inc @@ -7,4 +7,15 @@ [% FOREACH subtitle IN biblio.subtitle.split(' \| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %] [% subtitle | html %] [% END %] -[% biblio.part_number | html %] [% biblio.part_name | html %] +[% part_numbers = biblio.part_number.split(' \\| ') %] +[% part_names = biblio.part_name.split(' \\| ') %] +[% i = 0 %] +[% WHILE ( part_numbers.$i.defined || part_names.$i.defined ) %] + [% IF ( part_numbers.$i.defined ) %] + [% part_numbers.$i | html %] + [% END %] + [% IF ( part_names.$i.defined ) %] + [% part_names.$i | html %] + [% END %] + [% i = i + 1 %] +[% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc @@ -9,9 +9,15 @@ [% FOREACH subtitle IN biblio.subtitle.split(' \\| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %] [% subtitle | html %] [% END %] -[% IF ( biblio.part_number ) %] - [% biblio.part_number | html %] -[% END %] -[% IF ( biblio.part_name ) %] - [% biblio.part_name | html %] +[% part_numbers = biblio.part_number.split(' \\| ') %] +[% part_names = biblio.part_name.split(' \\| ') %] +[% i = 0 %] +[% WHILE ( part_numbers.$i.defined || part_names.$i.defined ) %] + [% IF ( part_numbers.$i.defined ) %] + [% part_numbers.$i | html %] + [% END %] + [% IF ( part_names.$i.defined ) %] + [% part_names.$i | html %] + [% END %] + [% i = i + 1 %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -6,7 +6,6 @@ [% USE Branches %] [% USE Biblio %] [% USE ColumnsSettings %] -[% USE Stash %] [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %] [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %] @@ -35,7 +34,7 @@ [% IF ( unknownbiblionumber ) %] Unknown record [% ELSE %] - Details for [% INCLUDE 'biblio-title-head.inc' biblio=Stash.stash() %] + Details for [% INCLUDE 'biblio-title-head.inc' %] [% END %] [% INCLUDE 'doc-head-close.inc' %] @@ -50,7 +49,7 @@ [% IF ( unknownbiblionumber ) %] Unknown record [% ELSE %] - Details for [% INCLUDE 'biblio-title.inc' biblio=Stash.stash() %] + Details for [% INCLUDE 'biblio-title.inc' %] [% END %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/biblio-title-head.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/biblio-title-head.inc @@ -6,4 +6,15 @@ [% FOREACH subtitle IN biblio.subtitle.split(' \| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %] [% subtitle | html %] [% END %] -[% biblio.part_number | html %] [% biblio.part_name | html %] +[% part_numbers = biblio.part_number.split(' \\| ') %] +[% part_names = biblio.part_name.split(' \\| ') %] +[% i = 0 %] +[% WHILE ( part_numbers.$i.defined || part_names.$i.defined ) %] + [% IF ( part_numbers.$i.defined ) %] + [% part_numbers.$i | html %] + [% END %] + [% IF ( part_names.$i.defined ) %] + [% part_names.$i | html %] + [% END %] + [% i = i + 1 %] +[% END %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/biblio-title.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/biblio-title.inc @@ -6,9 +6,15 @@ [% FOREACH subtitle IN biblio.subtitle.split(' \| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %] [% subtitle | html %] [% END %] -[% IF ( biblio.part_number ) %] - [% biblio.part_number | html %] -[% END %] -[% IF ( biblio.part_name ) %] - [% biblio.part_name | html %] +[% part_numbers = biblio.part_number.split(' \\| ') %] +[% part_names = biblio.part_name.split(' \\| ') %] +[% i = 0 %] +[% WHILE ( part_numbers.$i.defined || part_names.$i.defined ) %] + [% IF ( part_numbers.$i.defined ) %] + [% part_numbers.$i | html %] + [% END %] + [% IF ( part_names.$i.defined ) %] + [% part_names.$i | html %] + [% END %] + [% i = i + 1 %] [% END %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -6,7 +6,6 @@ [% USE Branches %] [% USE ColumnsSettings %] [% USE AuthorisedValues %] -[% USE Stash %] [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %] [% IF Koha.Preference('AmazonAssocTag') %] @@ -31,7 +30,7 @@ [% END %] [% INCLUDE 'doc-head-open.inc' %] -