From 051dd6bf0b9a005bd0dc1679db7161fc85b3f50d 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. Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Signed-off-by: Fridolin Somers --- 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 | 8 +------ .../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(+), 179 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index b4edd2d932..67158a00d0 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -498,7 +498,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"), @@ -520,7 +519,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 f6943d9fb9..92f6561c9c 100755 --- a/basket/basket.pl +++ b/basket/basket.pl @@ -108,15 +108,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 8206e70a4e..35072c1993 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 21f284df7c..0437660680 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 14f0dc8983..85bcffeb2d 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 a714f4ca80..f3c79154e3 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 4f4f461e0e..a991f0ce50 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 | url %][% 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 cd2beae0ce..bd9bb5d41c 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 0251cbe792..4295c11ed4 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 @@ -440,7 +431,7 @@
    [% IF ( LocalCoverImages ) %][% SEARCH_RESULT.localimage | html %]
    - + 'p1'> Local cover image
    Local cover image
    @@ -449,7 +440,7 @@ [% IF ( AmazonCoverImages && SEARCH_RESULT.normalized_isbn ) %]
    - + 'p1'> Cover image from Amazon.com
    Amazon cover image
    @@ -460,7 +451,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 4d903160ef..0f9c02a233 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -934,23 +934,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 784034b5fd..26ce2d4f8e 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 ) %] + [% ELSIF Koha.Preference('IntranetBiblioDefaultView') == 'labeled_marc' %] - [% ELSIF ( BiblioDefaultViewisbd ) %] + [% ELSIF 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 96bb85d177..4a1f29c7e8 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,13 +71,7 @@ [% IF ( loopcel.reference ) %] -[% IF ( loopcel.BiblioDefaultViewmarc ) %] - -[% ELSIF ( loopcel.BiblioDefaultViewisbd ) %] - -[% ELSE %] - - [% END %] + [% END %] [% IF ( loopcel.value ) %][% loopcel.value | html %][% END %] [% IF ( loopcel.reference ) %][% 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 642dd2cc5e..20c24486a9 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 4cccfff7db..b374082364 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 7a964de596..d849154a37 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 | url %][% 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 5c3e6beaa9..4e6219c0bd 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 fc7b773b5f..33ba901cda 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