Add checks for fines / overdues before enabling checkout
authordbs <dbs@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Fri, 3 Jul 2009 18:22:53 +0000 (18:22 +0000)
committerdbs <dbs@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Fri, 3 Jul 2009 18:22:53 +0000 (18:22 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/trunk@563 6d9bc8c9-1ec2-4278-b937-99fde70a366f

circ/circ_permit_patron.js [new file with mode: 0755]

diff --git a/circ/circ_permit_patron.js b/circ/circ_permit_patron.js
new file mode 100755 (executable)
index 0000000..8bb1365
--- /dev/null
@@ -0,0 +1,42 @@
+function go() {
+
+/* load the script library */
+load_lib('circ/circ_lib.js');
+load_lib('JSON_v1.js');
+log_vars('circ_permit_patron');
+
+
+if( isTrue(patron.barred) ) 
+       result.events.push('PATRON_BARRED');
+
+var config = findGroupConfig(patronProfile);
+
+if( config ) {
+
+    var limit = config.maxItemsOut;
+    if( limit >= 0 ) {
+        log_info('patron items out = ' + patronItemsOut +' limit = ' + limit);
+        if( !isTrue(isRenewal) && patronItemsOut >= limit ) {
+            result.events.push('PATRON_EXCEEDS_CHECKOUT_COUNT');
+        }
+    }
+
+    if (patronFines > 0 && patron.home_ou == 103) {
+        result.events.push('PATRON_EXCEEDS_FINES');
+    }
+
+    if (patronOverdueCount > 0 && patron.home_ou == 103) {
+        result.events.push('PATRON_EXCEEDS_OVERDUE_COUNT');
+    }
+
+    
+} else {
+
+    log_warn("** profile has no configured information: " + patronProfile);
+}
+
+
+
+} go();
+
+