added batch org unit settings fetcher. added org setting to turn on popup alerts...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 16 Sep 2008 21:18:34 +0000 (21:18 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 16 Sep 2008 21:18:34 +0000 (21:18 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10606 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/org_utils.js
Open-ILS/web/opac/extras/selfcheck/selfcheck.css
Open-ILS/web/opac/extras/selfcheck/selfcheck.js
Open-ILS/web/opac/extras/selfcheck/selfcheck.xml

index 2c1aca3..9fe33f4 100644 (file)
@@ -9,6 +9,17 @@ function fetchOrgSettingDefault(orgId, name) {
     return (res) ? res.value : null;
 }
 
+function fetchBatchOrgSetting(orgId, nameList, onload) {
+    var req = new Request(
+        'open-ils.actor:open-ils.actor.ou_setting.ancestor_default.batch', orgId, nameList);
+    if(onload) {
+        req.callback(function(r) { onload(r.getResultObject()); });
+        req.send();
+    } else {
+        req.send(true);
+        return req.result();
+    }
+}
 
 
 /* takes an org unit or id and return the numeric depth */
index 3064574..3db3dd7 100644 (file)
@@ -92,4 +92,11 @@ body { font-size: 12pt; }
     font-weight: bold;
 }
 
-
+#selfck-print-queuing {
+    font-size: 110%;
+    border: 2px solid #808080;
+    width: 100%;
+    text-align: center;
+    padding: 10px;
+    margin: 5px;
+}
index 582d647..3f966ca 100644 (file)
@@ -36,6 +36,10 @@ var patronBarcodeRegex;
 var orgUnit;
 var orgUnitAddress;
 var orgUnitHours;
+var alertOnCheckoutEvent = false;
+var SET_PATRON_TIMEOUT = 'circ.selfcheck.patron_login_timeout';
+var SET_BARCODE_REGEX = 'opac.barcode_regex';
+var SET_ALERT_ON_CHECKOUT_EVENT = 'circ.selfcheck.alert_on_checkout_event';
 
 
 function selfckInit() {
@@ -47,11 +51,15 @@ function selfckInit() {
     orgUnit = findOrgUnitSN(cgi.param('l')) || globalOrgTree;
     selfckFetchOrgDetails();
 
-    var t = fetchOrgSettingDefault(orgUnit.id(), 'circ.selfcheck.patron_login_timeout');
-    patronTimeout = (t) ? parseInt(t) * 1000 : patronTimeout;
-
-    var reg = fetchOrgSettingDefault(orgUnit.id(), 'opac.barcode_regex');
-    if(reg) patronBarcodeRegex = new RegExp(reg);
+    // fetch the relevent org-unit setting
+    var settings = fetchBatchOrgSetting(orgUnit.id(), 
+        [SET_PATRON_TIMEOUT, SET_BARCODE_REGEX, SET_ALERT_ON_CHECKOUT_EVENT]);
+    if(settings[SET_PATRON_TIMEOUT])
+        patronTimeout = parseInt(settings[SET_PATRON_TIMEOUT].value) * 1000;
+    if(settings[SET_BARCODE_REGEX])
+        patronBarcodeRegex = new RegExp(settings[SET_BARCODE_REGEX].value);
+    if(settings[SET_ALERT_ON_CHECKOUT_EVENT])
+        alertOnCheckoutEvent = (settings[SET_ALERT_ON_CHECKOUT_EVENT].value) ? true : false;
 
     if(!staff) {
         // should not happen when behind the proxy
@@ -167,11 +175,13 @@ function selfckResetTimer() {
 function selfckLogoutPatron() {
     $('selfck-item-barcode-input').value = ''; // prevent browser caching
     $('selfck-patron-login-input').value = '';
+    hideMe($('selfck-patron-checkout-container'));
+    unHideMe($('selfck-print-queuing'));
     if(patron) {
         selfckPrint();
         setTimeout(
             function() { location.href = location.href; },
-            800
+            3500 // give the browser time to send the page to the printer
         );
     }
 }
@@ -316,6 +326,9 @@ function selfckShowMsgNode(evt) {
 
     appendClear($('selfck-event-time'), text(new Date().toLocaleString()));
     appendClear($('selfck-event-span'), text($('selfck-event-' + code).innerHTML));
+
+    if(code != 'SUCCESS' && alertOnCheckoutEvent)
+        alert($('selfck-event-' + code).innerHTML);
 }
 
 /**
index 658c9a6..8a6ac3d 100644 (file)
                 <span id='selfck-patron-not-found' class='hide_me'>&selfck.event.patron_not_found;</span>
             </div>
 
+            <div id='selfck-print-queuing' class='hide_me'>
+                <div><img src='../../../images/small_logo.jpg'/></div>
+                <div>Printing Receipt...</div>
+            </div>
+
             <!--***********************************************************************
                 Checkout form
                 *********************************************************************** -->