bug 2502: correctly check patron account expiration
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 14 Aug 2008 16:13:50 +0000 (11:13 -0500)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 28 Oct 2008 21:09:22 +0000 (22:09 +0100)
When placing a hold request from the staff interface,
now correctly indicate if the patron account has expired.
Prior to this patch, would warn that the account
had expired even when the expiry date is in the future,
and vice versa.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
reserve/request.pl

index eb41244..a2abe4a 100755 (executable)
@@ -110,9 +110,10 @@ if ($cardnumber) {
     }
 
     # we check the date expiry of the borrower (only if there is an expiry date, otherwise, set to 1 (warn)
-    my $expiry = $borrowerinfo->{dateexpiry};
-    unless ($expiry and $expiry ne '0000-00-00' and
-            Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry)) {
+    my $expiry_date = $borrowerinfo->{dateexpiry};
+    my $expiry = 0; # flag set if patron account has expired
+    if ($expiry_date and $expiry_date ne '0000-00-00' and
+            Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
                $messages = $expiry = 1;
     }