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 <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Pedro Amorim 2024-03-26 17:11:32 +00:00 committed by Martin Renvoize
parent 679281e4ef
commit 1dfec21694
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
5 changed files with 11 additions and 9 deletions

View file

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

View file

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

View file

@ -342,7 +342,7 @@
<th>Barcode</th>
[% END %]
<th>Call number</th>
[% 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') ) ) %]
<th>Renew</th>
[% END %]
[% IF ( OPACFinesTab ) %]
@ -444,7 +444,7 @@
<span class="tdlabel">Call number:</span>
[% ISSUE.itemcallnumber | html %]
</td>
[% 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 ) %]
<td class="renew" data-order="[% ISSUE.renewsleft | html %]">
[% ELSE %]
@ -550,14 +550,14 @@
[% END # /FOREACH ISSUES %]
</tbody>
</table>
[% 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') ) ) %]
<input type="submit" class="btn btn-primary d-print-none" value="Renew selected" />
<input type="hidden" name="op" value="cud-renew" />
<button type="button" id="renewall_js" class="btn btn-primary d-print-none">Renew all</button>
[% END %]
</form>
[% 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') ) ) %]
<form id="renewall" class="js-hide" action="/cgi-bin/koha/opac-renew.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Renew</legend>

View file

@ -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';

View file

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