Bug 29116: Use a pre-existing accessor instead of reimplementing it

We can use the Koha::Patron::is_expired accessor instead of re-writing
it in request.pl.

To test:
 1) Make that a warning is being shown with and without this patch
    when placing a hold to an expired patron account

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Joonas Kylmälä 2021-09-26 16:09:20 +00:00 committed by Jonathan Druart
parent f3e5607e92
commit 283b6b0c06
2 changed files with 3 additions and 12 deletions

View file

@ -385,10 +385,10 @@
</div>
[% END # /IF ( exceeded_maxreserves || ... %]
[% IF ( expiry || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
[% IF ( patron.is_expired || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
<div class="dialog message">
<ul>
[% IF ( expiry ) %]
[% IF ( patron.is_expired ) %]
<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>: <strong>Account has expired</strong></li>
[% END %]
@ -405,7 +405,7 @@
[% END %]
</ul> <!-- /.dialog.message -->
</div>
[% END # /IF expiry || diffbranch ... %]
[% END # /IF patron.is_expired || diffbranch ... %]
[% IF ( messageborrower ) %]
<div class="dialog alert">

View file

@ -226,14 +226,6 @@ if ($borrowernumber_hold && !$action) {
);
}
# we check the date expiry of the borrower (only if there is an expiry date, otherwise, set to 1 (warn)
my $expiry_date = $patron->dateexpiry;
my $expiry = 0; # flag set if patron account has expired
if ($expiry_date and
Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
$expiry = 1;
}
# check if the borrower make the reserv in a different branch
if ( $patron->branchcode ne C4::Context->userenv->{'branch'} ) {
$diffbranch = 1;
@ -242,7 +234,6 @@ if ($borrowernumber_hold && !$action) {
my $amount_outstanding = $patron->account->balance;
$template->param(
patron => $patron,
expiry => $expiry,
diffbranch => $diffbranch,
messages => $messages,
warnings => $warnings,