From 43d8edc542dbf2d06303a541aee4a26449d5adeb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 5 Jul 2023 11:07:35 +0200 Subject: [PATCH] Bug 33956: Use Koha::Biblio->opac_summary_html from opac-user.pl This code is currently duplicated in controllers opac-readingrecord.pl and opac-user.pl. After bug 33949 it will be removed from opac-readingrecord.pl, and bug 33956 aims to remove it from opac-user.pl. Final situation will be: we have the code in a module, covered by tests \o/ Test plan: Check an item out Setup OPACMySummaryHTML ("biblionumber: {BIBLIONUMBER}" for instance) Go to the "Your summary" at the OPAC and notice the "Links" column Everything should work identically before and after this patch Signed-off-by: Owen Leonard Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi Signed-off-by: Philip Orr https://bugs.koha-community.org/show_bug.cgi?id=34076 --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 6 +++--- opac/opac-user.pl | 11 ----------- 2 files changed, 3 insertions(+), 14 deletions(-) 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 a3729933c5..2a82506693 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -344,7 +344,7 @@ [% IF ( OPACFinesTab ) %] Fines [% END %] - [% IF ( OPACMySummaryHTML ) %] + [% IF Koha.Preference('OPACMySummaryHTML') %] Links [% END %] [% IF ( Koha.Preference('AllowCheckoutNotes') ) %] @@ -525,8 +525,8 @@ [% END %] [% END %] - [% IF ( OPACMySummaryHTML ) %] - [% ISSUE.MySummaryHTML | $raw %] + [% IF Koha.Preference('OPACMySummaryHTML') %] + [% ISSUE.biblio_object.opac_summary_html| $raw %] [% END %] [% IF ( Koha.Preference('AllowCheckoutNotes') ) %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index bc04c520a8..f5588c0aa3 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -178,7 +178,6 @@ $template->param( amountoutstanding => $amountoutstanding, borrowernumber => $borrowernumber, patron_flagged => $borr->{flagged}, - OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0, surname => $borr->{surname}, RENEW_ERROR => $renew_error, borrower => $borr, @@ -306,16 +305,6 @@ if ( $pending_checkouts->count ) { # Useless test $issue->{normalized_upc} = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') ); $issue->{normalized_oclc} = GetNormalizedOCLCNumber( $marcrecord, C4::Context->preference('marcflavour') ); } - # My Summary HTML - if (my $my_summary_html = C4::Context->preference('OPACMySummaryHTML')){ - $issue->{author} ? $my_summary_html =~ s/{AUTHOR}/$issue->{author}/g : $my_summary_html =~ s/{AUTHOR}//g; - $issue->{title} =~ s/\/+$//; # remove trailing slash - $issue->{title} =~ s/\s+$//; # remove trailing space - $issue->{title} ? $my_summary_html =~ s/{TITLE}/$issue->{title}/g : $my_summary_html =~ s/{TITLE}//g; - $issue->{isbn} ? $my_summary_html =~ s/{ISBN}/$isbn/g : $my_summary_html =~ s/{ISBN}//g; - $issue->{biblionumber} ? $my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g : $my_summary_html =~ s/{BIBLIONUMBER}//g; - $issue->{MySummaryHTML} = $my_summary_html; - } if ( C4::Context->preference('UseRecalls') ) { my $maybe_recalls = Koha::Recalls->search({ biblio_id => $issue->{biblionumber}, item_id => [ undef, $issue->{itemnumber} ], completed => 0 }); -- 2.30.2