disable checkout interface
authorJason Etheridge <jason@esilibrary.com>
Fri, 20 Dec 2013 16:27:57 +0000 (11:27 -0500)
committerJason Etheridge <jason@esilibrary.com>
Wed, 2 Apr 2014 14:16:36 +0000 (10:16 -0400)
if an inactive card was used to retrieve the patron via the "F1" interface.

This is the stock behavior outside of this branch, but was obscurred due to
https://bugs.launchpad.net/evergreen/+bug/1154235

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/xul/staff_client/server/patron/patron.js

index 98b028e..7753832 100644 (file)
@@ -609,7 +609,31 @@ function patron_ui_populate() {
         }
         switch(main_interface) {
             case 'checkout':
-                cw.xulG.check_stop_checkouts = function() { return false; };
+                cw.xulG.check_stop_checkouts = function() {
+                    try {
+                        var p_obj = patron.util.retrieve_fleshed_au_via_id(
+                            ses(),
+                            patron_id,
+                            ["cards"]
+                        );
+                        var cards = p_obj.cards();
+                        var barcodes = util.functional.map_list(
+                            p_obj.cards(),
+                            function (c) {
+                                return c.barcode();
+                            }
+                        );
+                        var idx = barcodes.indexOf( barcode_for_some_interfaces );
+                        if (idx == -1) {
+                            return false;
+                        } else {
+                            return ! get_bool( cards[idx].active() );
+                        }
+                    } catch(E) {
+                        alert(E);
+                        return false;
+                    }
+                };
             break;
             case 'items_out':
             break;