webstaff: booking options from Patron interface
authorJason Etheridge <jason@esilibrary.com>
Tue, 3 Jan 2017 11:58:25 +0000 (06:58 -0500)
committerKathy Lussier <klussier@masslnc.org>
Mon, 9 Jan 2017 15:59:00 +0000 (10:59 -0500)
Includes some workarounds for xulG errors, and lets the booking interfaces
receive the patron barcode via a query param instead of xulG.  The XUL client
spawns a new tab for these interfaces, but we stick with web norms and load in
the current tab (control+click will open a new tab).  This does, however, blow
away the patron interface; it doesn't embed like most of the options from the
Other menu.  One other change: we don't have support for nested drop-down menus
in the web client, so I've flattened the entries like so:

* Booking: Create or Cancel Reservations
* Booking: Pick Up Reservations
* Booking: Return Reservations

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>

Open-ILS/src/templates/staff/circ/patron/index.tt2
Open-ILS/web/js/ui/default/booking/pickup.js
Open-ILS/web/js/ui/default/booking/reservation.js
Open-ILS/web/js/ui/default/booking/return.js

index 65d14e7..407668d 100644 (file)
@@ -165,6 +165,21 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
               [% l('Test Password') %]
             </a>
           </li>
+          <li>
+            <a href="./booking/legacy/booking/reservation?patron_barcode={{patron().card().barcode()}}" target="_top">
+              [% l('Booking: Create or Cancel Reservations') %]
+            </a>
+          </li>
+          <li>
+            <a href="./booking/legacy/booking/pickup?patron_barcode={{patron().card().barcode()}}" target="_top">
+              [% l('Booking: Pick Up Reservations') %]
+            </a>
+          </li>
+          <li>
+            <a href="./booking/legacy/booking/return?patron_barcode={{patron().card().barcode()}}" target="_top">
+              [% l('Booking: Return Reservations') %]
+            </a>
+          </li>
        </ul>
       </li>
       <li ng-class="{active : tab == 'search'}" class="pull-right">
index 62dfea5..fed016d 100644 (file)
@@ -29,6 +29,20 @@ function my_init() {
     init_auto_l10n(document.getElementById("auto_l10n_start_here"));
 
     setTimeout(
-        function() { react_to_pass_in(xulG.bresv_interface_opts); }, 0
+        function() {
+            var opts;
+            if (typeof xulG != 'undefined' && typeof xulG.bresv_interface_opts != 'undefined') {
+                opts = xulG.bresv_interface_opts;
+            } else {
+                opts = {};
+            }
+            var uri = location.href;
+            var query = uri.substring(uri.indexOf("?") + 1, uri.length);
+            var queryObject = dojo.queryToObject(query);
+            if (typeof queryObject['patron_barcode'] != 'undefined') {
+                opts.patron_barcode = queryObject['patron_barcode'];
+            }
+            react_to_pass_in(opts);
+        }, 0
     );
 }
index 590c6b7..1e9901c 100644 (file)
@@ -797,6 +797,13 @@ function early_action_passthru() {
         return false;
     }
 
+    var uri = location.href;
+    var query = uri.substring(uri.indexOf("?") + 1, uri.length);
+    var queryObject = dojo.queryToObject(query);
+    if (typeof queryObject['patron_barcode'] != 'undefined') {
+        opts.patron_barcode = queryObject['patron_barcode'];
+    }
+
     if (opts.patron_barcode) {
         document.getElementById("contain_patron_barcode").style.display="none";
         document.getElementById("patron_barcode").value = opts.patron_barcode;
@@ -837,7 +844,11 @@ function my_init() {
 
     setTimeout(
         function() {
-            if (!(opts = xulG.bresv_interface_opts)) opts = {};
+            if (typeof xulG != 'undefined' && typeof xulG.bresv_interface_opts != 'undefined') {
+                opts = xulG.bresv_interface_opts;
+            } else {
+                opts = {};
+            }
             if (early_action_passthru())
                 provide_brt_selector(document.getElementById("brt_selector_here"));
         }, 0
index cdc3edd..b47156b 100644 (file)
@@ -38,6 +38,20 @@ function my_init() {
     init_auto_l10n(document.getElementById("auto_l10n_start_here"));
 
     setTimeout(
-        function() { react_to_pass_in(xulG.bresv_interface_opts); }, 0
+        function() {
+            var opts;
+            if (typeof xulG != 'undefined' && typeof xulG.bresv_interface_opts != 'undefined') {
+                opts = xulG.bresv_interface_opts;
+            } else {
+                opts = {};
+            }
+            var uri = location.href;
+            var query = uri.substring(uri.indexOf("?") + 1, uri.length);
+            var queryObject = dojo.queryToObject(query);
+            if (typeof queryObject['patron_barcode'] != 'undefined') {
+                opts.patron_barcode = queryObject['patron_barcode'];
+            }
+            react_to_pass_in(opts);
+        }, 0
     );
 }