From: Michael Peters <mrpeters@library.in.gov>
Date: Thu, 8 Nov 2012 19:14:42 +0000 (-0500)
Subject: Warn on card expiring within 28 days
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=136dd85b33c6ffddbf587dcdccbb5c07d9cf0189;p=evergreen%2Fmasslnc.git

Warn on card expiring within 28 days

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

diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
index 55b750c5b3..567a40c06c 100644
--- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
+++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
@@ -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
diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js
index 2deb0c86f1..393fa32306 100644
--- a/Open-ILS/xul/staff_client/server/patron/display.js
+++ b/Open-ILS/xul/staff_client/server/patron/display.js
@@ -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();