From ee44dce28562941b8f831bb79a564c1384a8f832 Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Mon, 19 Nov 2018 10:37:08 +0200 Subject: [PATCH] Bug 11529: Clean up subtitle usage Unify and clean up subtitle usage so that it's always used as a simple array and not the old hash structure. Signed-off-by: Michal Denar Signed-off-by: Michal Denar Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- C4/Biblio.pm | 19 +++++++++++-------- C4/ShelfBrowser.pm | 2 +- acqui/neworderbiblio.pl | 2 +- circ/reserveratios.pl | 2 +- circ/transferstoreceive.pl | 2 +- .../prog/en/modules/acqui/neworderbiblio.tt | 2 +- .../prog/en/modules/authorities/merge.tt | 4 ++-- .../prog/en/modules/basket/basket.tt | 4 ++-- .../prog/en/modules/catalogue/detail.tt | 4 ++-- .../prog/en/modules/catalogue/imageviewer.tt | 4 ++-- .../prog/en/modules/catalogue/moredetail.tt | 6 +++--- .../en/modules/catalogue/stockrotation.tt | 2 +- .../prog/en/modules/cataloguing/addbooks.tt | 2 +- .../prog/en/modules/cataloguing/merge.tt | 2 +- .../circ/circulation_batch_checkouts.tt | 2 +- .../prog/en/modules/circ/reserveratios.tt | 2 +- .../en/modules/circ/transferstoreceive.tt | 2 +- .../prog/en/modules/reserve/request.tt | 2 +- .../prog/en/modules/tags/list.tt | 2 +- .../en/modules/tools/batch_delete_records.tt | 2 +- .../en/modules/virtualshelves/sendshelf.tt | 2 +- .../prog/en/modules/virtualshelves/shelves.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 8 ++++++-- koha-tmpl/intranet-tmpl/prog/js/holds.js | 4 +++- .../bootstrap/en/includes/shelfbrowser.inc | 2 +- .../bootstrap/en/modules/opac-basket.tt | 4 ++-- .../bootstrap/en/modules/opac-detail.tt | 6 +++--- .../bootstrap/en/modules/opac-opensearch.tt | 2 +- .../en/modules/opac-readingrecord.tt | 6 +++--- .../bootstrap/en/modules/opac-reserve.tt | 2 +- .../en/modules/opac-results-grouped.tt | 4 ++-- .../bootstrap/en/modules/opac-results.tt | 2 +- .../bootstrap/en/modules/opac-sendshelf.tt | 2 +- .../bootstrap/en/modules/opac-shelves.tt | 2 +- .../en/modules/opac-showreviews-rss.tt | 2 +- .../bootstrap/en/modules/opac-showreviews.tt | 2 +- .../bootstrap/en/modules/opac-tags.tt | 2 +- .../bootstrap/en/modules/opac-user.tt | 4 ++-- opac/opac-reserve.pl | 2 +- opac/opac-tags.pl | 2 +- opac/opac-user.pl | 2 +- reserve/request.pl | 3 +++ svc/checkouts | 4 ++-- svc/holds | 4 ++-- t/Biblio2.t | 14 +++++++------- tags/list.pl | 2 +- tools/batch_delete_records.pl | 2 +- 47 files changed, 87 insertions(+), 75 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index e039fe71b1..eae7cd5df3 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -67,7 +67,7 @@ BEGIN { TransformHtmlToMarc TransformHtmlToXml prepare_host_field - SplitSubtitle + SplitKohaField ); # Internal functions @@ -3453,20 +3453,23 @@ sub RemoveAllNsb { return $record; } -=head2 SplitSubtitle +=head2 SplitKohaField - $subtitles = SplitSubtitle($subtitle); + $subtitles = SplitKohaField($biblio->subtitle()); -Splits a subtitle field to an array of hashes like the one GetRecordValue returns +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 SplitSubtitle { - my $subtitle = shift; +sub SplitKohaField { + my $field = shift; - my @subtitles = map( { 'subfield' => $_ }, split(/ \| /, $subtitle // '' ) ); + my @parts = split(/ \| /, $field // '' ); - return \@subtitles; + return \@parts; } 1; diff --git a/C4/ShelfBrowser.pm b/C4/ShelfBrowser.pm index b5d19799b6..05669fb94e 100644 --- a/C4/ShelfBrowser.pm +++ b/C4/ShelfBrowser.pm @@ -223,7 +223,7 @@ sub GetShelfInfo { my $this_biblio = GetBibData($item->{biblionumber}); next unless defined $this_biblio; $item->{'title'} = $this_biblio->{'title'}; - $item->{'subtitle'} = C4::Biblio::SplitSubtitle($this_biblio->{'subtitle'}), + $item->{'subtitle'} = C4::Biblio::SplitKohaField($this_biblio->{'subtitle'}), $item->{'medium'} = $this_biblio->{'medium'}; $item->{'part_number'} = $this_biblio->{'part_number'}; $item->{'part_name'} = $this_biblio->{'part_name'}; diff --git a/acqui/neworderbiblio.pl b/acqui/neworderbiblio.pl index 8333b4723f..d1662c5454 100755 --- a/acqui/neworderbiblio.pl +++ b/acqui/neworderbiblio.pl @@ -130,7 +130,7 @@ foreach my $result ( @{$marcresults} ) { my $marcrecord = C4::Search::new_record_from_zebra( 'biblioserver', $result ); my $biblio = TransformMarcToKoha( $marcrecord, '' ); - $biblio->{subtitles} = C4::Biblio::SplitSubtitle($biblio->{'subtitle'}); + $biblio->{subtitles} = C4::Biblio::SplitKohaField($biblio->{'subtitle'}); $biblio->{booksellerid} = $booksellerid; push @results, $biblio; diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl index 15e68959fa..66eebd3ce1 100755 --- a/circ/reserveratios.pl +++ b/circ/reserveratios.pl @@ -164,7 +164,7 @@ while ( my $data = $sth->fetchrow_hashref ) { priority => $data->{priority}, name => $data->{borrower}, title => $data->{title}, - subtitle => C4::Biblio::SplitSubtitle($data->{'subtitle'}); + subtitle => C4::Biblio::SplitKohaField($data->{'subtitle'}), author => $data->{author}, itemnum => $data->{itemnumber}, biblionumber => $data->{biblionumber}, diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index f1c09ef013..3734b3c935 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -99,7 +99,7 @@ while ( my $library = $libraries->next ) { %getransf = ( %getransf, title => $biblio->title, - subtitle => C4::Biblio::SplitSubtitle($biblio->{'subtitle'}), + subtitle => C4::Biblio::SplitKohaField($biblio->{'subtitle'}), medium => $biblio->medium, part_number => $biblio->part_number, part_name => $biblio->part_name, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt index 482185b33e..8abc2a8fbe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt @@ -50,7 +50,7 @@

[% biblio.title | html %] - [% FOREACH subtitle IN biblio.subtitles %] [% subtitle.subfield | html %][% END %] + [% FOREACH subtitle IN biblio.subtitles %] [% subtitle | html %][% END %] [% IF ( biblio.author ) %] by [% biblio.author | html %],[% END %]

[% IF ( biblio.isbn ) %] [% biblio.isbn | html %][% END %] [% IF ( biblio.pages ) %] - [% biblio.pages | html %][% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt index 9b926b4e1c..7274b0c651 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt @@ -56,8 +56,8 @@ div#result { margin-top: 1em; }

Merge reference
    -
  1. -
  2. +
  3. +
  4. [% IF frameworkselect %]
  5. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt index d984665675..de1788c783 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt @@ -71,7 +71,7 @@

    [% BIBLIO_RESULT.title |html %] - [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield | html %][% END %] + [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl | html %][% END %] [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author | html %][% END %]

    @@ -266,7 +266,7 @@ [% BIBLIO_RESULT.title |html %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] - [% subtitl.subfield | html %] + [% subtitl | html %] [% END %] [% BIBLIO_RESULT.author | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index a963b84804..fead33d121 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -34,7 +34,7 @@ [% IF ( unknownbiblionumber ) %] Unknown record [% ELSE %] - Details for [% title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield | html %][% END %] + Details for [% title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl | html %][% END %] [% END %] [% INCLUDE 'doc-head-close.inc' %] @@ -49,7 +49,7 @@ [% IF ( unknownbiblionumber ) %] Unknown record [% ELSE %] - Details for [% title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield | html %][% END %] + Details for [% title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl | html %][% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt index b5d95e7e10..cd4d35ee8a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt @@ -2,7 +2,7 @@ [% USE Asset %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] -Koha › Catalog › [% biblio.title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield | html %][% END %] › Images +Koha › Catalog › [% biblio.title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl | html %][% END %] › Images [% INCLUDE 'doc-head-close.inc' %] @@ -15,7 +15,7 @@ [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] - +
    @@ -27,7 +27,7 @@

    [% title | html %]

    - [% IF ( subtitle ) %]

    [% FOREACH subtitl IN subtitle %] [% subtitl.subfield | html %][% END %]

    [% END %] + [% IF ( subtitle ) %]

    [% FOREACH subtitl IN subtitle %] [% subtitl | html %][% END %]

    [% END %] [% IF ( author ) %]

    by [% author | html %]

    [% END %]
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt index b96de1ae7d..8ac04390be 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt @@ -12,7 +12,7 @@ [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] - +
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt index 46157389b8..16a447cdfb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -76,7 +76,7 @@

      [% resultsloo.title | html %] - [% FOREACH subtitl IN resultsloo.subtitle %][% subtitl.subfield | html %] [% END %]

      + [% FOREACH subtitl IN resultsloo.subtitle %][% subtitl | html %][% END %]

      [% IF ( resultsloo.summary ) %]

      [% resultsloo.summary | html %]

      [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt index c21baca652..cfb813a542 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt @@ -101,7 +101,7 @@ div#result { margin-top: 1em; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt index 7539633d13..9d2e9f26d7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -117,7 +117,7 @@ [% END %] [% checkout_info.barcode | html %] - [% checkout_info.biblio.title | html %][% FOREACH subtitle IN checkout_info.biblio.subtitles %] [% subtitle.subfield | html %][% END %][% IF checkout_info.biblio.author %], by [% checkout_info.biblio.author | html %][% END %][% IF ( checkout_info.item.itemnotes ) %]- [% checkout_info.item.itemnotes | $raw %][% END %] [% checkout_info.item.barcode | html %] + [% checkout_info.biblio.title | html %][% FOREACH subtitle IN checkout_info.biblio.subtitles %] [% subtitle | html %][% END %][% IF checkout_info.biblio.author %], by [% checkout_info.biblio.author | html %][% END %][% IF ( checkout_info.item.itemnotes ) %]- [% checkout_info.item.itemnotes | $raw %][% END %] [% checkout_info.item.barcode | html %] [% IF checkout_info.NEEDSCONFIRMATION %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt index 588801600b..eac912a4a2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt @@ -57,7 +57,7 @@

      [% reserveloo.reservecount | html %]

      [% reserveloo.itemcount | html %]

      [% reserveloo.thisratio | html %] - [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %][% reserveloo.title | html %] [% IF ( reserveloo.subtitle ) %][% FOREACH subtitl IN reserveloo.subtitle %][% subtitl.subfield | html %][% END %][% END %][% IF ( reserveloo.author ) %] by [% reserveloo.author | html %][% END %] + [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %][% reserveloo.title | html %] [% IF ( reserveloo.subtitle ) %][% FOREACH subtitl IN reserveloo.subtitle %][% subtitl | html %][% END %][% END %][% IF ( reserveloo.author ) %] by [% reserveloo.author | html %][% END %]
        diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt index 8563488eb2..9705432f94 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt @@ -52,7 +52,7 @@ [% END %]

        [% reser.datetransfer | $KohaDates %]

        [% IF ( reser.messcompa ) %]Transfer is [% reser.diff | html %] days late[% END %] - [% INCLUDE 'biblio-default-view.inc' biblionumber = reser.biblionumber %][% reser.title | html %] [% IF ( reser.subtitle ) %] [% FOREACH subtitl IN reser.subtitle %][% subtitl.subfield | html %][% END %][% END %] [% IF ( reser.author ) %]by [% reser.author | html %][% END %] + [% INCLUDE 'biblio-default-view.inc' biblionumber = reser.biblionumber %][% reser.title | html %] [% IF ( reser.subtitle ) %] [% FOREACH subtitl IN reser.subtitle %][% subtitl | html %][% END %][% END %] [% IF ( reser.author ) %]by [% reser.author | html %][% END %] [% IF ( reser.itemtype ) %] ([% reser.itemtype | html %])[% END %]
        Barcode: [% reser.barcode | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 5a96a1f3b5..d63cc3281d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -58,7 +58,7 @@ [% END %] [% UNLESS ( multi_hold ) %] -

        Place a hold on [% INCLUDE 'biblio-default-view.inc' %][% title | html %]

        +

        Place a hold on [% INCLUDE 'biblio-default-view.inc' %][% title | html %] [% subtitle | html %] [% part_number | html %] [% part_name | html %]

        [% ELSE %]

        Confirm holds

        [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt index 6405c85755..1d0e55b921 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt @@ -31,7 +31,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : [% FOREACH title IN titles %] - [% INCLUDE 'biblio-default-view.inc' biblionumber = title.biblionumber %][% title.title | html %][% FOREACH subtitl IN title.subtitle %] [% subtitl.subfield | html %][% END %] + [% INCLUDE 'biblio-default-view.inc' biblionumber = title.biblionumber %][% title.title | html %][% FOREACH subtitl IN title.subtitle %] [% subtitl | html %][% END %] [% title.author | html %]

        [% IF ( title.publishercode ) %]- [% title.publishercode | html %] [% IF ( title.place ) %] [% title.place | html %][% END %][% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt index 50040559ce..d2d23723ba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt @@ -152,7 +152,7 @@ - [% INCLUDE 'biblio-default-view.inc' biblionumber=biblio.biblionumber %][% biblio.title | html %][% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle %] [% subtitle.subfield | html %][% END %][% END %] + [% INCLUDE 'biblio-default-view.inc' biblionumber=biblio.biblionumber %][% biblio.title | html %][% IF ( biblio.subtitle ) %][% FOREACH subtitle IN biblio.subtitle %] [% subtitle | html %][% END %][% END %] [% biblio.itemnumbers.size | html %] [% biblio.holds_count | html %] [% biblio.issues_count | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt index 39ae699d77..fa56105e78 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt @@ -33,7 +33,7 @@ Your list: [% shelfname | $raw %] [% BIBLIO_RESULT.title | $raw %] [% IF ( BIBLIO_RESULT.subtitle.size ) %] [% FOREACH subtitle IN BIBLIO_RESULT.subtitle %] - [% subtitle.subfield | $raw %] + [% subtitle | $raw %] [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 023922a873..9d553cc8e8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -212,7 +212,7 @@ [% itemsloo.XSLTBloc | $raw %] [% ELSE %] [% INCLUDE 'biblio-default-view.inc' biblionumber = itemsloo.biblionumber %] - [% itemsloo.title | html %][% FOREACH subtitl IN itemsloo.subtitle %] [% subtitl.subfield | html %][% END %] + [% itemsloo.title | html %][% FOREACH subtitl IN itemsloo.subtitle %] [% subtitl | html %][% END %] [% END %]

        [% IF ( itemsloo.notforloan ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 66c5f8b939..da69276e4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -290,9 +290,11 @@ $(document).ready(function() { + oObj.title.escapeHtml(); $.each(oObj.subtitle, function( index, value ) { - title += " " + value.subfield.escapeHtml(); + title += " " + value.escapeHtml(); }); + title += " " + oObj.part_number + " " + oObj.part_name; + if ( oObj.enumchron ) { title += " (" + oObj.enumchron.escapeHtml() + ")"; } @@ -652,9 +654,11 @@ $(document).ready(function() { + oObj.title.escapeHtml(); $.each(oObj.subtitle, function( index, value ) { - title += " " + value.subfield.escapeHtml(); + title += " " + value.escapeHtml(); }); + title += " " + oObj.part_number + " " + oObj.part_name; + if ( oObj.enumchron ) { title += " (" + oObj.enumchron.escapeHtml() + ")"; } diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js index 97002573cd..3c0d77dc48 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js @@ -25,9 +25,11 @@ $(document).ready(function() { + oObj.title.escapeHtml(); $.each(oObj.subtitle, function( index, value ) { - title += " " + value.subfield.escapeHtml(); + title += " " + value.escapeHtml(); }); + title += " " + oObj.part_number + " " + oObj.part_name; + title += ""; if ( oObj.author ) { diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc index 276c0d2d5c..2808e255fb 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc @@ -81,7 +81,7 @@ [% item.title | html %] [% FOREACH subtitl IN item.subtitle %] [% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %] - [% subtitl.subfield | html %] + [% subtitl | html %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt index 64628894c2..292282ef33 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -68,7 +68,7 @@

        [% BIBLIO_RESULT.title | html %] - [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield | html %] [% END %][% END %] + [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl | html %] [% END %][% END %] [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author | html %][% END %]

        @@ -257,7 +257,7 @@ - [% BIBLIO_RESULT.title | html %][% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %][% subtitl.subfield | html %][% END %][% END %] + [% BIBLIO_RESULT.title | html %][% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %][% subtitl | html %][% END %][% END %] [% IF ( TagsInputEnabled && loggedinusername ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index e6bccdfd71..d148b2beea 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -30,7 +30,7 @@ [% END %] [% INCLUDE 'doc-head-open.inc' %] -[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Details for: [% title | html %][% FOREACH subtitl IN subtitle %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %] [% subtitl.subfield | html %][% END %] +[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Details for: [% title | html %][% FOREACH subtitl IN subtitle %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %] [% subtitl | html %][% END %] [% INCLUDE 'doc-head-close.inc' %] [% Asset.css("lib/emoji-picker/css/emoji.css") | $raw %] @@ -41,7 +41,7 @@
        @@ -112,7 +112,7 @@ [% IF ( OPACXSLTDetailsDisplay ) %] [% XSLTBloc | $raw %] [% ELSE %] -

        [% title | html %][% IF ( subtitle ) %] [% FOREACH subtitl IN subtitle %][% subtitl.subfield | html %] [% END %][% END %]

        +

        [% title | html %][% IF ( subtitle ) %] [% FOREACH subtitl IN subtitle %][% subtitl | html %] [% END %][% END %]

        [% IF ( author ) %]
        by [% author | html %]
        [% END %] [% UNLESS ( item_level_itypes ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt index b91b6b7a99..eac730a770 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt @@ -37,7 +37,7 @@ diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt index 54f507f199..cc054468f6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -382,7 +382,7 @@ [% END %] [% FOREACH subtitl IN itemsloo.subtitle %] - [% subtitl.subfield | html %] + [% subtitl | html %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews-rss.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews-rss.tt index 5d199c4514..12e32537c1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews-rss.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews-rss.tt @@ -10,7 +10,7 @@ [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %] [% FOREACH review IN reviews %] - New comment on [% review.title | html %] [% FOREACH subtitl IN review.subtitle %], [% subtitl.subfield | html %][% END %] + New comment on [% review.title | html %] [% FOREACH subtitl IN review.subtitle %], [% subtitl | html %][% END %] [% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% review.biblionumber | html %]#comments [% IF ( review.author ) %] by [% review.author | html %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt index 08b5528ba0..49b48621c3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt @@ -152,7 +152,7 @@ [% MY_TAG.title | html %] [% IF ( MY_TAG.subtitle ) %] [% FOREACH subtitle IN MY_TAG.subtitle %] - [% subtitle.subfield | html %] + [% subtitle | html %] [% END %] [% END %] 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 03847ace50..fe27fb6057 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -248,7 +248,7 @@ [% END # / IF JacketImages %] - [% ISSUE.title | html %] [% FOREACH subtitl IN ISSUE.subtitle %] [% subtitl.subfield | html %][% END %] + [% ISSUE.title | html %] [% FOREACH subtitl IN ISSUE.subtitle %] [% subtitl | html %][% END %] [% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron | html %][% END %] @@ -520,7 +520,7 @@ [% END # /IF jacketcell %] - [% OVERDUE.title | html %] [% FOREACH subtitl IN OVERDUE.subtitle %] [% subtitl.subfield | html %][% END %] + [% OVERDUE.title | html %] [% FOREACH subtitl IN OVERDUE.subtitle %] [% subtitl | html %][% END %] [% OVERDUE.author | html %] diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index a7631d328b..47962d8abb 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -419,7 +419,7 @@ foreach my $biblioNum (@biblionumbers) { my $frameworkcode = GetFrameworkCode( $biblioData->{biblionumber} ); $biblioLoopIter{biblionumber} = $biblioData->{biblionumber}; $biblioLoopIter{title} = $biblioData->{title}; - $biblioLoopIter{subtitle} = C4::Biblio::SplitSubtitle($biblioData->{'subtitle'}); + $biblioLoopIter{subtitle} = C4::Biblio::SplitKohaField($biblioData->{'subtitle'}); $biblioLoopIter{medium} = $biblioData->{medium}; $biblioLoopIter{part_number} = $biblioData->{part_number}; $biblioLoopIter{part_name} = $biblioData->{part_name}; diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl index 2d7dfae5ec..6174840441 100755 --- a/opac/opac-tags.pl +++ b/opac/opac-tags.pl @@ -257,7 +257,7 @@ if ($loggedinuser) { } next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers ); $tag->{title} = $biblio->title; - $tag->{subtitle} = C4::Biblio::SplitSubtitle($biblio->subtitle); + $tag->{subtitle} = C4::Biblio::SplitKohaField($biblio->subtitle); $tag->{medium} = $biblio->medium; $tag->{part_number} = $biblio->part_number; $tag->{part_name} = $biblio->part_name; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 56ae5ad22c..3d8208f71b 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -201,7 +201,7 @@ if ( $pending_checkouts->count ) { # Useless test ); $issue->{rentalfines} = $rental_fines->total_outstanding; - $issue->{'subtitle'} = C4::Biblio::SplitSubtitle($issue->{'subtitle'}); + $issue->{'subtitle'} = C4::Biblio::SplitKohaField($issue->{'subtitle'}); # check if item is renewable my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} ); diff --git a/reserve/request.pl b/reserve/request.pl index 89368086cc..fea0a496ae 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -631,6 +631,9 @@ foreach my $biblionumber (@biblionumbers) { biblionumber => $biblionumber, findborrower => $findborrower, title => $biblio->title, + subtitle => $biblio->subtitle, + part_number => $biblio->part_number, + part_name => $biblio->part_name, author => $biblio->author, holdsview => 1, C4::Search::enabled_staff_search_views, diff --git a/svc/checkouts b/svc/checkouts index 8aecac1cb0..7eb2f87ba7 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -23,7 +23,7 @@ use CGI; use JSON qw(to_json); use C4::Auth qw(check_cookie_auth haspermission get_session); -use C4::Biblio qw(SplitSubtitle); +use C4::Biblio qw(SplitKohaField); use C4::Circulation qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate); use C4::Overdues qw(GetFine); use C4::Context; @@ -178,7 +178,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { my $checkout = { DT_RowId => $c->{itemnumber} . '-' . $c->{borrowernumber}, title => $c->{title}, - subtitle => C4::Biblio::SplitSubtitle($c->{'subtitle'}), + subtitle => C4::Biblio::SplitKohaField($c->{'subtitle'}), medium => $c->{medium} // '', part_number => $c->{part_number} // '', part_name => $c->{part_name} // '', diff --git a/svc/holds b/svc/holds index 8b9a27b310..2368a51e1a 100755 --- a/svc/holds +++ b/svc/holds @@ -23,7 +23,7 @@ use CGI; use JSON qw(to_json); use C4::Auth qw(check_cookie_auth); -use C4::Biblio qw(SplitSubtitle); +use C4::Biblio qw(SplitKohaField); use C4::Charset; use C4::Circulation qw(GetTransfers); use C4::Context; @@ -90,7 +90,7 @@ while ( my $h = $holds_rs->next() ) { DT_RowId => $h->reserve_id(), biblionumber => $biblionumber, title => $biblio->title(), - subtitle => $biblio->subtitle() // '', + subtitle => C4::Biblio::SplitKohaField($biblio->subtitle()), medium => $biblio->medium() // '', part_number => $biblio->part_number() // '', part_name => $biblio->part_name() // '', diff --git a/t/Biblio2.t b/t/Biblio2.t index 21354eb578..bf78de9732 100644 --- a/t/Biblio2.t +++ b/t/Biblio2.t @@ -52,20 +52,20 @@ sub _koha_marc_update_bib_ids_control { is($r->field('004')->data(), 20, 'Biblioitemnumber to control field'); } -subtest 'SplitSubtitle' => sub { +subtest 'SplitKohaField' => sub { plan tests => 4; - my $res = C4::Biblio::SplitSubtitle(undef); + my $res = C4::Biblio::SplitKohaField(undef); is_deeply($res, [], 'undef returned as an array'); - $res = C4::Biblio::SplitSubtitle(''); + $res = C4::Biblio::SplitKohaField(''); is_deeply($res, [], 'Empty string returned as an array'); - $res = C4::Biblio::SplitSubtitle('Single'); - is_deeply($res, [{'subfield' => 'Single'}], 'Single subtitle returns an array'); + $res = C4::Biblio::SplitKohaField('Single'); + is_deeply($res, ['Single'], 'Single subtitle returned as an array'); - $res = C4::Biblio::SplitSubtitle('First | Second'); - is_deeply($res, [{'subfield' => 'First'}, {'subfield' => 'Second'}], 'Two subtitles returns an array'); + $res = C4::Biblio::SplitKohaField('First | Second'); + is_deeply($res, ['First', 'Second'], 'Two subtitles returned as an array'); }; done_testing(); diff --git a/tags/list.pl b/tags/list.pl index 6f39da509e..9a7369c7df 100755 --- a/tags/list.pl +++ b/tags/list.pl @@ -61,7 +61,7 @@ else { my $taglist = get_tag_rows( { term => $tag } ); for ( @{$taglist} ) { my $dat = &GetBiblioData( $_->{biblionumber} ); - $dat->{'subtitle'} = C4::Biblio::SplitSubtitles($dat->{'subtitle'}), + $dat->{'subtitle'} = C4::Biblio::SplitKohaFields($dat->{'subtitle'}), my @items = GetItemsInfo( $_->{biblionumber} ); $dat->{biblionumber} = $_->{biblionumber}; $dat->{tag_id} = $_->{tag_id}; diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl index 9eba7354a4..bcb70fbecb 100755 --- a/tools/batch_delete_records.pl +++ b/tools/batch_delete_records.pl @@ -94,7 +94,7 @@ if ( $op eq 'form' ) { my $holds_count = $biblio->holds->count; $biblio = $biblio->unblessed; my $record = &GetMarcBiblio({ biblionumber => $record_id }); - $biblio->{subtitle} = C4::Biblio::SplitSubtitle( $biblio->{subtitle} ); + $biblio->{subtitle} = C4::Biblio::SplitKohaField( $biblio->{subtitle} ); $biblio->{itemnumbers} = [Koha::Items->search({ biblionumber => $record_id })->get_column('itemnumber')]; $biblio->{holds_count} = $holds_count; $biblio->{issues_count} = C4::Biblio::CountItemsIssued( $record_id ); -- 2.39.5