From b94229a9ef6b009e7771edd1e96a00ccef2910ba Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Tue, 3 Jan 2017 06:58:25 -0500 Subject: [PATCH] webstaff: booking options from Patron interface 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 Signed-off-by: Kathy Lussier --- .../src/templates/staff/circ/patron/index.tt2 | 15 +++++++++++++++ Open-ILS/web/js/ui/default/booking/pickup.js | 16 +++++++++++++++- .../web/js/ui/default/booking/reservation.js | 13 ++++++++++++- Open-ILS/web/js/ui/default/booking/return.js | 16 +++++++++++++++- 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/index.tt2 index 65d14e7822..407668d773 100644 --- a/Open-ILS/src/templates/staff/circ/patron/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2 @@ -165,6 +165,21 @@ angular.module('egCoreMod').run(['egStrings', function(s) { [% l('Test Password') %] +
  • + + [% l('Booking: Create or Cancel Reservations') %] + +
  • +
  • + + [% l('Booking: Pick Up Reservations') %] + +
  • +
  • + + [% l('Booking: Return Reservations') %] + +
  • diff --git a/Open-ILS/web/js/ui/default/booking/pickup.js b/Open-ILS/web/js/ui/default/booking/pickup.js index 62dfea5a23..fed016d4a8 100644 --- a/Open-ILS/web/js/ui/default/booking/pickup.js +++ b/Open-ILS/web/js/ui/default/booking/pickup.js @@ -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 ); } diff --git a/Open-ILS/web/js/ui/default/booking/reservation.js b/Open-ILS/web/js/ui/default/booking/reservation.js index 590c6b7d61..1e9901c523 100644 --- a/Open-ILS/web/js/ui/default/booking/reservation.js +++ b/Open-ILS/web/js/ui/default/booking/reservation.js @@ -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 diff --git a/Open-ILS/web/js/ui/default/booking/return.js b/Open-ILS/web/js/ui/default/booking/return.js index cdc3edd880..b47156bb89 100644 --- a/Open-ILS/web/js/ui/default/booking/return.js +++ b/Open-ILS/web/js/ui/default/booking/return.js @@ -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 ); } -- 2.43.2