From de6c8e79c6e2c1ccb3f33e661e80fdbffc846748 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 1 Dec 2021 15:12:17 +0100 Subject: [PATCH] Bug 29609: Centralized code to build the link to a biblio detail page There are 2 prefs that control the default view of biblio detail pages: IntranetBiblioDefaultView for staff and BiblioDefaultView for OPAC. There are as well viewISBD, viewLabeledMARC and viewMARC to allow/don't allow access to those page for staff members. This code need to be in a single place to avoid discrepancy. Test plan: Play with BiblioDefaultView and IntranetBiblioDefaultView and confirm that the links of biblio point to the correct view. --- C4/Auth.pm | 2 -- basket/basket.pl | 9 -------- .../value_builder/marc21_linking_section.pl | 2 -- .../value_builder/unimarc_field_4XX.pl | 3 --- circ/pendingreserves.pl | 1 - .../prog/en/includes/biblio-title.inc | 12 ++-------- .../prog/en/includes/html_helpers.inc | 13 +++++++++++ .../modules/acqui/neworderempty_duplicate.tt | 5 +---- .../prog/en/modules/catalogue/results.tt | 15 +++---------- .../prog/en/modules/cataloguing/addbiblio.tt | 20 +++-------------- .../prog/en/modules/cataloguing/moveitem.tt | 6 ++--- .../prog/en/modules/reports/cat_issues_top.tt | 7 +----- .../prog/en/modules/serials/serials-edit.tt | 2 +- .../en/modules/serials/subscription-detail.tt | 2 +- .../bootstrap/en/includes/html_helpers.inc | 11 ++++++++++ .../bootstrap/en/modules/opac-basket.tt | 2 +- .../bootstrap/en/modules/opac-imageviewer.tt | 22 ++++--------------- .../bootstrap/en/modules/opac-opensearch.tt | 10 ++------- .../en/modules/opac-readingrecord.tt | 8 +------ .../bootstrap/en/modules/opac-shelves.tt | 10 +-------- .../bootstrap/en/modules/opac-showreviews.tt | 22 +++---------------- opac/opac-basket.pl | 9 -------- serials/checkexpiration.pl | 1 - serials/serials-edit.pl | 17 -------------- serials/subscription-detail.pl | 18 --------------- 25 files changed, 51 insertions(+), 178 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 1cfeed48cc4..5f9566eaa20 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -481,7 +481,6 @@ sub get_template_and_user { my $minPasswordLength = C4::Context->preference('minPasswordLength'); $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3; $template->param( - "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1, EnhancedMessagingPreferences => C4::Context->preference('EnhancedMessagingPreferences'), GoogleJackets => C4::Context->preference("GoogleJackets"), OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"), @@ -503,7 +502,6 @@ sub get_template_and_user { $template->param( AmazonCoverImages => C4::Context->preference("AmazonCoverImages"), AutoLocation => C4::Context->preference("AutoLocation"), - "BiblioDefaultView" . C4::Context->preference("IntranetBiblioDefaultView") => 1, PatronAutoComplete => C4::Context->preference("PatronAutoComplete"), FRBRizeEditions => C4::Context->preference("FRBRizeEditions"), IndependentBranches => C4::Context->preference("IndependentBranches"), diff --git a/basket/basket.pl b/basket/basket.pl index 30f73b8783e..dc3414aa7b0 100755 --- a/basket/basket.pl +++ b/basket/basket.pl @@ -111,15 +111,6 @@ foreach my $biblionumber ( @bibs ) { $dat->{MARCURLS} = $marcurlsarray; $dat->{HASAUTHORS} = $hasauthors; - if ( C4::Context->preference("IntranetBiblioDefaultView") eq "normal" ) { - $dat->{dest} = "/cgi-bin/koha/catalogue/detail.pl"; - } - elsif ( C4::Context->preference("IntranetBiblioDefaultView") eq "marc" ) { - $dat->{dest} = "/cgi-bin/koha/catalogue/MARCdetail.pl"; - } - else { - $dat->{dest} = "/cgi-bin/koha/catalogue/ISBDdetail.pl"; - } push( @results, $dat ); } diff --git a/cataloguing/value_builder/marc21_linking_section.pl b/cataloguing/value_builder/marc21_linking_section.pl index 5bff56495d5..ad25daecb93 100755 --- a/cataloguing/value_builder/marc21_linking_section.pl +++ b/cataloguing/value_builder/marc21_linking_section.pl @@ -255,7 +255,6 @@ my $launcher = sub { } else { $to = $from + $resultsperpage; } - my $defaultview = 'BiblioDefaultView' . C4::Context->preference('BiblioDefaultView'); # my $link="/cgi-bin/koha/cataloguing/value_builder/unimarc4XX.pl?op=do_search&q=$search_desc&resultsperpage=$resultsperpage&startfrom=$startfrom&search=$search"; # foreach my $sort (@sort_by){ @@ -285,7 +284,6 @@ my $launcher = sub { to => $to, numbers => \@numbers, search => $search, - $defaultview => 1, Search => 0 ); diff --git a/cataloguing/value_builder/unimarc_field_4XX.pl b/cataloguing/value_builder/unimarc_field_4XX.pl index 83dcaf3c8cc..da6e5242e71 100755 --- a/cataloguing/value_builder/unimarc_field_4XX.pl +++ b/cataloguing/value_builder/unimarc_field_4XX.pl @@ -439,8 +439,6 @@ sub plugin { }else{ $to = $from + $resultsperpage ; } - my $defaultview = - 'BiblioDefaultView' . C4::Context->preference('BiblioDefaultView'); # my $link="/cgi-bin/koha/cataloguing/value_builder/unimarc4XX.pl?op=do_search&q=$search_desc&resultsperpage=$resultsperpage&startfrom=$startfrom&search=$search"; # foreach my $sort (@sort_by){ # $link.="&sort_by=".$sort."&"; @@ -469,7 +467,6 @@ sub plugin { to => $to, numbers => \@numbers, search => $search, - $defaultview => 1, Search => 0 ); diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index 0b2fea21955..411b11a7f57 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -300,7 +300,6 @@ $template->param( from => $startdate, to => $enddate, holds_info => \@holds_info, - "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, HoldsToPullStartDate => C4::Context->preference('HoldsToPullStartDate') || PULL_INTERVAL, HoldsToPullEndDate => C4::Context->preference('ConfirmFutureHolds') || 0, messages => \@messages, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc index a714f4ca803..f3c79154e36 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-title.inc @@ -1,13 +1,5 @@ [% IF ( link ) %] - [% IF ( BiblioDefaultViewmarc ) %] - - [% ELSIF ( BiblioDefaultViewlabeled_marc ) %] - - [% ELSIF ( BiblioDefaultViewisbd ) %] - - [% ELSE %] - - [% END %] + [% END %] [% IF ( biblio.title ) %] @@ -36,4 +28,4 @@ [% IF ( link ) %] -[% END %] \ No newline at end of file +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index 8f148947b49..9a1b060d3ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -69,6 +69,19 @@ [% END %] [% END %] +[% BLOCK biblio_a_href -%] + [%- IF Koha.Preference('IntranetBiblioDefaultView') == 'marc' && Koha.Preference('viewMARC') -%] + [%- SET this_biblio_href = "/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=" -%] + [%- ELSIF Koha.Preference('IntranetBiblioDefaultView') == 'labeled_marc' && Koha.Preference('viewLabeledMARC') -%] + [%- SET this_biblio_href = "/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=" -%] + [%- ELSIF Koha.Preference('IntranetBiblioDefaultView') == 'isbd' && Koha.Preference('viewISBD') -%] + [%- SET this_biblio_href = "/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=" -%] + [%- ELSE -%] + [%- SET this_biblio_href = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=" -%] + [%- END -%] + [%- this_biblio_href %][% biblionumber | url -%] +[%- END %] + [% BLOCK subfields_for_item %]
    [% FOREACH subfield IN subfields %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tt index cd2beae0ce4..bd9bb5d41c4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tt @@ -34,10 +34,7 @@

    Duplicate warning

    -

    You selected a record from an external source that matches an existing record in your catalog: [% IF ( BiblioDefaultViewmarc ) %] -[% ELSIF ( BiblioDefaultViewlabeled_marc ) %] -[% ELSIF ( BiblioDefaultViewisbd ) %] -[% ELSE %][% END %] [% duplicatetitle | html %]

    +

    You selected a record from an external source that matches an existing record in your catalog: [% duplicatetitle | html %]

    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 4115ddacf7a..c910393ba57 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -7,15 +7,6 @@ [% PROCESS 'i18n.inc' %] [% SET footerjs = 1 %] [% USE AuthorisedValues %] -[% IF BiblioDefaultViewmarc %] - [% SET DetailPage="MARCdetail.pl" %] -[% ELSIF BiblioDefaultViewlabeled_marc %] - [% SET DetailPage="labeledMARCdetail.pl" %] -[% ELSIF BiblioDefaultViewisbd %] - [% SET DetailPage="ISBDdetail.pl" %] -[% ELSE %] - [% SET DetailPage="detail.pl" %] -[% END %] [% INCLUDE 'doc-head-open.inc' %] [% IF ( searchdesc ) %]Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %][% ELSE %]You did not specify any search criteria[% END %] › Catalog › Koha @@ -438,7 +429,7 @@
    [% IF ( LocalCoverImages ) %][% SEARCH_RESULT.localimage | html %]
    - + 'p1'> Local cover image
    Local cover image
    @@ -447,7 +438,7 @@ [% IF ( AmazonCoverImages && SEARCH_RESULT.normalized_isbn ) %]
    - + 'p1'> Cover image from Amazon.com
    Amazon cover image
    @@ -458,7 +449,7 @@ [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %] [% IF ( coce_id ) %]
    - + 'p1'>
    Coce cover image
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index fb1652e8594..c6ccc160698 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -928,23 +928,9 @@ function PopupMARCFieldDoc(field) {
    [% UNLESS (circborrowernumber) %][%# Hide in fast cataloging %] [% IF (biblionumber) %] - [% IF ( BiblioDefaultViewmarc ) %] -
    - Cancel -
    - [% ELSIF ( BiblioDefaultViewlabeled_marc ) %] -
    - Cancel -
    - [% ELSIF ( BiblioDefaultViewisbd ) %] -
    - Cancel -
    - [% ELSE %] -
    - Cancel -
    - [% END %] +
    + Cancel +
    [% ELSE %]
    Cancel diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt index 784034b5fd8..edca69b8210 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt @@ -31,11 +31,11 @@
    [% BLOCK actions %] - [% IF ( BiblioDefaultViewmarc ) %] + [% IF Koha.Preference('IntranetBiblioDefaultView') == 'marc' %]
    - [% ELSIF ( BiblioDefaultViewlabeled_marc ) %] + [% IF Koha.Preference('IntranetBiblioDefaultView') == 'labeled_marc' %] - [% ELSIF ( BiblioDefaultViewisbd ) %] + [% IF Koha.Preference('IntranetBiblioDefaultView') == 'isbd' %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt index 96bb85d177e..0b82834f333 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt @@ -71,12 +71,7 @@ [% IF ( loopcel.reference ) %] -[% IF ( loopcel.BiblioDefaultViewmarc ) %] - -[% ELSIF ( loopcel.BiblioDefaultViewisbd ) %] - -[% ELSE %] - + [% END %] [% END %] [% IF ( loopcel.value ) %][% loopcel.value | html %][% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt index 642dd2cc5e9..20c24486a93 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt @@ -471,7 +471,7 @@ $(document).ready(function() { [% END %] [% END %] [% END %] -
  1. Show biblio
  2. +
  3. Show biblio
  4. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt index 2ec7fefd529..184afcc1a87 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -111,7 +111,7 @@
  5. Subscription ID: [% subscriptionid | html %]
  6. Librarian identity: [% librarian | html %]
  7. Vendor: [% aqbooksellername | html %]
  8. -
  9. Biblio: [% bibliotitle | html %] ([% bibnum | html %])
  10. +
  11. Biblio: [% bibliotitle | html %] ([% bibnum | html %])
  12. [% IF ( OPACBaseURL ) %]
  13. OPAC view: diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc index 7a964de5966..f483abba755 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc @@ -22,3 +22,14 @@
  14. [% END %] [% END %] + +[% BLOCK biblio_a_href -%] + [%- IF Koha.Preference('BiblioDefaultView') == 'marc' -%] + [%- SET this_biblio_href = "/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=" -%] + [%- ELSIF Koha.Preference('BiblioDefaultView') == 'isbd' -%] + [%- SET this_biblio_href = "/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=" -%] + [%- ELSE -%] + [%- SET this_biblio_href = "/cgi-bin/koha/opac-detail.pl?biblionumber=" -%] + [%- END -%] + [%- this_biblio_href %][% biblionumber | url -%] +[%- 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 5c3e6beaa9c..4e6219c0bd6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -286,7 +286,7 @@ - [% INCLUDE 'biblio-title.inc' biblio=BIBLIO_RESULT %] + [% INCLUDE 'biblio-title.inc' biblio=BIBLIO_RESULT %] [% IF ( TagsInputEnabled && loggedinusername ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-imageviewer.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-imageviewer.tt index d968ce98e0b..36d4d51eb4e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-imageviewer.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-imageviewer.tt @@ -45,15 +45,8 @@ Home