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 <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-07-05 11:07:35 +02:00 committed by Tomas Cohen Arazi
parent b1dcab3077
commit 3f3503f103
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 3 additions and 14 deletions

View file

@ -344,7 +344,7 @@
[% IF ( OPACFinesTab ) %]
<th>Fines</th>
[% END %]
[% IF ( OPACMySummaryHTML ) %]
[% IF Koha.Preference('OPACMySummaryHTML') %]
<th class="nosort">Links</th>
[% END %]
[% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
@ -525,8 +525,8 @@
[% END %]
</td>
[% END %]
[% IF ( OPACMySummaryHTML ) %]
<td class="links">[% ISSUE.MySummaryHTML | $raw %]</td>
[% IF Koha.Preference('OPACMySummaryHTML') %]
<td class="links">[% ISSUE.biblio_object.opac_summary_html| $raw %]</td>
[% END %]
[% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
<td>

View file

@ -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 });