From 73c4ad8493995507919d1bcf62c38442d79c3225 Mon Sep 17 00:00:00 2001
From: edoceo <code@edoceo.com>
Date: Wed, 25 Jul 2012 02:00:55 -0700
Subject: [PATCH] Patch to improve the warning on double checkout attempt

Code modifications by David Busby of Edoceo for KCLS
Released without restriction to Evergreen community
Signed-off-by: edoceo <code@edoceo.com>

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
---
 Open-ILS/xul/staff_client/server/circ/checkout.js           | 13 +++++++++++++
 .../xul/staff_client/server/locale/en-US/circ.properties    |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js
index 08455c3ac4..30dcec2853 100644
--- a/Open-ILS/xul/staff_client/server/circ/checkout.js
+++ b/Open-ILS/xul/staff_client/server/circ/checkout.js
@@ -924,6 +924,8 @@ circ.checkout.prototype = {
                                 }
 
                                 if (foreign_circ) { // OFFER CANCEL, NORMAL CHECKIN, AND POSSIBLY FORGIVING-BACKDATED CHECKIN
+                                    if (msg.length) msg += ' / ';
+                                    msg+= document.getElementById('circStrings').getFormattedString('staff.circ.checkout.failed_to_patron_other', [ util.date.formatted_date( my_circ.create_time(), '%{localized_date}' ) ]);
                                     var r = obj.error.yns_alert(
                                         msg,
                                         document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
@@ -954,6 +956,17 @@ circ.checkout.prototype = {
                                             }
                                         } );
                                     } else {
+
+                                        // Include info about date of previous checkout in warning
+                                        if (msg.length) msg += ' / ';
+                                        var cko_d = util.date.formatted_date( my_circ.create_time(), '%{localized_date}' );
+                                        var cur_d = util.date.formatted_date( new Date(), '%{localized_date}');
+                                        if (cko_d == cur_d) {
+                                            msg+= document.getElementById('circStrings').getString('staff.circ.checkout.failed_to_patron_today');
+                                        } else {
+                                            msg+= document.getElementById('circStrings').getString('staff.circ.checkout.failed_to_patron_renew');
+                                        }
+
                                         var r = obj.error.yns_alert(
                                             msg,
                                             document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
index 3f34a0f796..2acaf706b2 100644
--- a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
+++ b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
@@ -70,6 +70,9 @@ staff.circ.checkout.permission_denied=Permission Denied = %1$s
 # "Offline Interface" - check &staff.main.menu.circ.offline.label; in lang.dtd
 staff.circ.checkout.suggest_offline=Check Out Failed.  If you wish to use the offline interface, in the top menubar select Circulation -> Offline Interface
 staff.circ.checkout.barcode=Barcode:
+staff.circ.checkout.failed_to_patron_other=This copy was checked out by another patron on %1$s.
+staff.circ.checkout.failed_to_patron_renew=This copy is already checked out to this patron.
+staff.circ.checkout.failed_to_patron_today=This copy was already checked out to this patron today.
 staff.circ.circ_brief.staff_out_id=Check Out Staff ID = %1$s
 staff.circ.circ_brief.staff_in_id=Check In Staff ID = %1$s
 staff.circ.circ_brief.failure=Failure rendering circulation.
-- 
2.11.0