Warn on card expiring within 28 days
authorMichael Peters <mrpeters@library.in.gov>
Thu, 8 Nov 2012 19:14:42 +0000 (14:14 -0500)
committerBen Shum <bshum@biblio.org>
Wed, 21 Nov 2012 15:03:44 +0000 (10:03 -0500)
Thank you to Thomas Berzansky for pointing out a simple way of
accomplishing this, since we were already checking and alerting
if card was already expired.

This places an alert on the "stop sign" page if the card expires
within 28 days from the current date.

Interval can be configured by editing preexpire.setDate in display.js.

Signed-off-by: Michael Peters <mrpeters@library.in.gov>
Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
Open-ILS/xul/staff_client/server/patron/display.js

index 55b750c..567a40c 100644 (file)
@@ -102,6 +102,7 @@ staff.patron.display.init.network_request.alert_message=Alert message: "%1$s"<br
 staff.patron.display.init.network_request.inactive_card=Patron account retrieved with an INACTIVE card.<br/><br/>
 staff.patron.display.init.network_request.account_barred=Patron account is BARRED.<br/><br/>
 staff.patron.display.init.network_request.account_inactive=Patron account is INACTIVE.<br/><br/>
+staff.patron.display.init.network_request.account_expire_soon=Patron account will expire soon.  Please renew.<br/><br/>
 staff.patron.display.init.network_request.account_expired=Patron account is EXPIRED.<br/><br/>
 staff.patron.display.init.holds_ready=Holds available: %1$s
 staff.patron.display.init.network_request.window_title=Alert
index 2deb0c8..393fa32 100644 (file)
@@ -973,6 +973,9 @@ patron.display.prototype = {
                 if (patron.expire_date()) {
                     var now = new Date();
                     now = now.getTime()/1000;
+                     var preexpire = new Date();
+                     preexpire.setDate(preexpire.getDate() + 28);
+                     preexpire = preexpire.getTime()/1000;
 
                     var expire_parts = patron.expire_date().substr(0,10).split('-');
                     expire_parts[1] = expire_parts[1] - 1;
@@ -983,7 +986,9 @@ patron.display.prototype = {
 
                     if (expire < now) {
                         msg += $("patronStrings").getString('staff.patron.display.init.network_request.account_expired');
-                    obj.stop_checkouts = true;
+                        obj.stop_checkouts = true;
+                    } else if (expire < preexpire) {
+                         msg += $("patronStrings").getString('staff.patron.display.init.network_request.account_expire_soon');   
                     }
                 }
                 var penalties = patron.standing_penalties();