From 6091466f51a3ac8c5be69d0aed0c014751c8f057 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 16 Jun 2026 00:16:01 +0000 Subject: [PATCH] Bug 31391: Implement UseRecalls choices on OPAC Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Pedro Amorim --- .../opac-tmpl/bootstrap/en/includes/item-status.inc | 4 ++-- .../bootstrap/en/includes/opac-detail-sidebar.inc | 2 +- .../opac-tmpl/bootstrap/en/includes/usermenu.inc | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-messaging.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-recalls.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-tags.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 4 ++-- opac/opac-recall.pl | 12 +++++++----- opac/opac-user.pl | 4 ++-- 11 files changed, 20 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc index 33c4130635..2b7e5af6e0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -63,7 +63,7 @@ Checked out [% END %] [% END %] - [% IF show_recall_link %] + [% IF show_recall_link != "off" %] [% IF logged_in_user.borrowernumber != issue.borrowernumber %] Recall [% END %] @@ -129,7 +129,7 @@ Pending hold [% END %] -[% IF Koha.Preference('UseRecalls') && item.has_pending_recall %] +[% IF Koha.Preference('UseRecalls') != "off" && item.has_pending_recall %] [% SET itemavailable = 0 %] Pending recall [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc index 1b360360a1..0a5d80ade9 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc @@ -13,7 +13,7 @@ [% END %] [% END %] - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls').match('opac') %]
  • Place recall
  • diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc index bdd2b6e83f..b23700b5b4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -44,7 +44,7 @@
  • Holds history
  • [% END %] - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %]
  • Recalls history
  • [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt index c85c529b9c..f9d0e608a0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -77,7 +77,7 @@ [% NEXT IF !Koha.Preference('MembershipExpiryDaysNotice') && messaging_preference.Patron_Expiry %] [% NEXT IF messaging_preference.Patron_Expiry && enforce_expiry_notice %] [% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %] - [% NEXT IF !Koha.Preference('UseRecalls') && messaging_preference.message_name.match('^Recall_') %] + [% NEXT IF Koha.Preference('UseRecalls') != "off" && messaging_preference.message_name.match('^Recall_') %] [% IF ( messaging_preference.Item_Due ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt index 13e205ca00..4b20c5eeef 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt @@ -34,7 +34,7 @@

    Recalls history

    - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% IF RECALLS.count %]
    diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index b6a401d8fc..8cb8a24028 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -13,7 +13,7 @@ [% SET CartEnabled = ( Koha.Preference('opacbookbag') == 1 ) %] [% SET ListsEnabled = ( Koha.Preference('virtualshelves') == 1 ) && LoginEnabled %] [% SET HoldsEnabled = ( Koha.Preference('OPACHoldRequests') == 1 ) && LoginEnabled %] -[% SET RecallsEnabled = ( Koha.Preference('UseRecalls') == 1 ) && LoginEnabled %] +[% SET RecallsEnabled = ( Koha.Preference('UseRecalls').match('opac') ) && LoginEnabled %] [% SET ArticleRequestsEnabled = ( Koha.Preference('ArticleRequests') == 1 ) && LoginEnabled %] [% SET MultiHolds = ( Koha.Preference('DisplayMultiPlaceHold') == 1 ) && HoldsEnabled %] [% SET CoverImagePlugins = KohaPlugins.get_plugins_opac_cover_images %] 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 51172432a5..8a0f10f416 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -16,7 +16,7 @@ [% SET CartEnabled = ( Koha.Preference('opacbookbag') == 1 ) %] [% SET ListsEnabled = ( Koha.Preference('virtualshelves') == 1 ) && LoginEnabled %] [% SET HoldsEnabled = ( Koha.Preference('OPACHoldRequests') == 1 ) && LoginEnabled %] -[% SET RecallsEnabled = ( Koha.Preference('UseRecalls') == 1 ) && LoginEnabled %] +[% SET RecallsEnabled = ( Koha.Preference('UseRecalls').match('opac') ) && LoginEnabled %] [% SET ArticleRequestsEnabled = ( Koha.Preference('ArticleRequests') == 1 ) && LoginEnabled %] [% SET MultiHolds = ( Koha.Preference('DisplayMultiPlaceHold') == 1 ) && HoldsEnabled %] [% SET CoverImagePlugins = KohaPlugins.get_plugins_opac_cover_images %] 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 fd9a7fc209..87319ebb95 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt @@ -14,7 +14,7 @@ [% SET CartEnabled = ( Koha.Preference('opacbookbag') == 1 ) %] [% SET ListsEnabled = ( Koha.Preference('virtualshelves') == 1 ) && LoginEnabled %] [% SET HoldsEnabled = ( Koha.Preference('OPACHoldRequests') == 1 ) && LoginEnabled %] -[% SET RecallsEnabled = ( Koha.Preference('UseRecalls') == 1 ) && LoginEnabled %] +[% SET RecallsEnabled = ( Koha.Preference('UseRecalls').match('opac') ) && LoginEnabled %] [% SET ArticleRequestsEnabled = ( Koha.Preference('ArticleRequests') == 1 ) && LoginEnabled %] [% SET MultiHolds = ( Koha.Preference('DisplayMultiPlaceHold') == 1 ) && HoldsEnabled %] [% INCLUDE 'doc-head-open.inc' %] 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 91ed175a27..4fa9967d7d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -305,7 +305,7 @@ Holds ([% reserves_count | html %]) [% END %] [% END %] - [% IF Koha.Preference('UseRecalls') && RECALLS.count %] + [% IF Koha.Preference('UseRecalls') != "off" && RECALLS.count %] [% WRAPPER tab_item tabname= "opac-user-recalls" %] Recalls ([% RECALLS.count | html %]) [% END %] @@ -840,7 +840,7 @@ [% END # /tab_panel#opac-user-holds %] [% END # / #RESERVES.count %] - [% IF Koha.Preference('UseRecalls') && RECALLS.count %] + [% IF Koha.Preference('UseRecalls') != "off" && RECALLS.count %] [% WRAPPER tab_panel tabname="opac-user-recalls" %]
    diff --git a/opac/opac-recall.pl b/opac/opac-recall.pl index aba53ae86e..7c7a8bcca5 100755 --- a/opac/opac-recall.pl +++ b/opac/opac-recall.pl @@ -36,7 +36,13 @@ my $op = $query->param('op') || ''; my $biblionumber = $query->param('biblionumber'); my $biblio = Koha::Biblios->find($biblionumber); -if ( C4::Context->preference('UseRecalls') ) { +if ( $op eq 'cud-cancel' ) { + my $recall_id = $query->param('recall_id'); + Koha::Recalls->find($recall_id)->set_cancelled; + print $query->redirect('/cgi-bin/koha/opac-user.pl'); +} + +if ( C4::Context->preference('UseRecalls') =~ m/opac/ ) { my $patron = Koha::Patrons->find($borrowernumber); my $error; @@ -123,10 +129,6 @@ if ( C4::Context->preference('UseRecalls') ) { $error = 'failed'; } } - } elsif ( $op eq 'cud-cancel' ) { - my $recall_id = $query->param('recall_id'); - Koha::Recalls->find($recall_id)->set_cancelled; - print $query->redirect('/cgi-bin/koha/opac-user.pl'); } my $branches = Koha::Libraries->search(); diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 4641ee278b..894903ea00 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -311,7 +311,7 @@ if ( $pending_checkouts->count ) { # Useless test $issue->{normalized_oclc} = $extractor->get_normalized_oclc; } - if ( C4::Context->preference('UseRecalls') ) { + if ( C4::Context->preference('UseRecalls') ne "off" ) { my $maybe_recalls = Koha::Recalls->search( { biblio_id => $issue->{biblionumber}, item_id => [ undef, $issue->{itemnumber} ], completed => 0 } ); while ( my $recall = $maybe_recalls->next ) { @@ -350,7 +350,7 @@ $template->param( showpriority => $show_priority, ); -if ( C4::Context->preference('UseRecalls') ) { +if ( C4::Context->preference('UseRecalls') ne "off" ) { my $recalls = Koha::Recalls->search( { patron_id => $borrowernumber, completed => 0 } ); $template->param( RECALLS => $recalls ); }
    Recalls ([% RECALLS.count | html %])