From 136dd85b33c6ffddbf587dcdccbb5c07d9cf0189 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Thu, 8 Nov 2012 14:14:42 -0500 Subject: [PATCH] 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 Signed-off-by: Ben Shum Signed-off-by: Dan Scott --- Open-ILS/xul/staff_client/server/locale/en-US/patron.properties | 1 + Open-ILS/xul/staff_client/server/patron/display.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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"

staff.patron.display.init.network_request.account_barred=Patron account is BARRED.

staff.patron.display.init.network_request.account_inactive=Patron account is INACTIVE.

+staff.patron.display.init.network_request.account_expire_soon=Patron account will expire soon. Please renew.

staff.patron.display.init.network_request.account_expired=Patron account is EXPIRED.

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(); -- 2.11.0