From 1dfec2169433f663d3e58d0e734cba898cafa31c Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 26 Mar 2024 17:11:32 +0000 Subject: [PATCH] Bug 36453: Update old occurrences of effective_BlockExpiredPatronOpacActions Check for 'renew' when appropriate Check for 'hold' when appropriate The following command must return nothing before this is pushed to master: git grep "\beffective_BlockExpiredPatronOpacActions\b" Signed-off-by: Arthur Suzuki Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 2 +- C4/ILSDI/Services.pm | 6 ++++-- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 8 ++++---- opac/opac-renew.pl | 2 +- opac/opac-reserve.pl | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index bff0b1e2f5..d8b75fe858 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -4668,7 +4668,7 @@ sub _CanBookBeAutoRenewed { } ); - if ( $patron->is_expired && $patron->category->effective_BlockExpiredPatronOpacActions ) { + if ( $patron->is_expired && $patron->category->effective_BlockExpiredPatronOpacActions_contains('renew') ) { return 'auto_account_expired'; } diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index ee776423a9..7d40c6b4d1 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -751,7 +751,8 @@ sub HoldTitle { return { code => 'PatronRestricted' } if $patron->is_debarred; # Check for patron expired, category and syspref settings - return { code => 'PatronExpired' } if ($patron->category->effective_BlockExpiredPatronOpacActions && $patron->is_expired); + return { code => 'PatronExpired' } + if ( $patron->category->effective_BlockExpiredPatronOpacActions_contains('hold') && $patron->is_expired ); # Get the biblio record, or return an error code my $biblionumber = $cgi->param('bib_id'); @@ -855,7 +856,8 @@ sub HoldItem { return { code => 'PatronRestricted' } if $patron->is_debarred; # Check for patron expired, category and syspref settings - return { code => 'PatronExpired' } if ($patron->category->effective_BlockExpiredPatronOpacActions && $patron->is_expired); + return { code => 'PatronExpired' } + if ( $patron->category->effective_BlockExpiredPatronOpacActions_contains('hold') && $patron->is_expired ); # Get the biblio or return an error code my $biblionumber = $cgi->param('bib_id'); 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 b9be5c22c5..ae3d38e045 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -342,7 +342,7 @@ Barcode [% END %] Call number - [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %] + [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions_contains('renew') ) ) %] Renew [% END %] [% IF ( OPACFinesTab ) %] @@ -444,7 +444,7 @@ Call number: [% ISSUE.itemcallnumber | html %] - [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %] + [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions_contains('renew') ) ) %] [% IF ( ISSUE.status && canrenew ) %] [% ELSE %] @@ -550,14 +550,14 @@ [% END # /FOREACH ISSUES %] - [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %] + [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions_contains('renew') ) ) %] [% END %] - [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %] + [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions_contains('renew') ) ) %]
[% INCLUDE 'csrf-token.inc' %] Renew diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl index 078fbef2be..cbee9c7a44 100755 --- a/opac/opac-renew.pl +++ b/opac/opac-renew.pl @@ -51,7 +51,7 @@ my $renewed = q{}; my $patron = Koha::Patrons->find( $borrowernumber ); -if ( $patron->category->effective_BlockExpiredPatronOpacActions +if ( $patron->category->effective_BlockExpiredPatronOpacActions_contains('renew') && $patron->is_expired ) { $errorstring = 'card_expired'; diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index bbc016cb79..002a7b13bf 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -113,7 +113,7 @@ if ( $#biblionumbers < 0 && $op ne 'cud-place_reserve' ) { # # my $noreserves = 0; -if ( $category->effective_BlockExpiredPatronOpacActions ) { +if ( $category->effective_BlockExpiredPatronOpacActions_contains('hold') ) { if ( $patron->is_expired ) { # cannot reserve, their card has expired and the rules set mean this is not allowed $noreserves = 1; -- 2.39.5