From: Thomas Berezansky Date: Thu, 26 Jan 2012 17:44:21 +0000 (-0500) Subject: TPac: Load user's hold prefs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=36961e9f5b3819fd362d4bf3ce53d9a028ecd938;p=contrib%2FConifer.git TPac: Load user's hold prefs When staff place holds attempt to load the user's hold preferences. This also hooks up the barcode completion code to the TPac hold placement interface. Signed-off-by: Thomas Berezansky Signed-off-by: Ben Shum --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 261aefe3f5..bf01bc4433 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -622,7 +622,7 @@ sub load_place_hold { { flesh => 1, flesh_fields => { - au => ['settings'] + au => ['settings', 'card'] } } ]) or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; diff --git a/Open-ILS/src/templates/opac/parts/place_hold.tt2 b/Open-ILS/src/templates/opac/parts/place_hold.tt2 index fc2f3e85e6..dca48f2f1f 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold.tt2 @@ -22,7 +22,8 @@ -
[%# XXX multi-barcode users? %] +
[%# XXX multi-barcode users? %] + -1; + var phone = load_info.settings['opac.hold_notify'].indexOf('phone') > -1; + var sms = load_info.settings['opac.hold_notify'].indexOf('sms') > -1; + var update_elements = document.getElementsByName('email_notify'); + for(var i in update_elements) update_elements[i].checked = (email ? 'checked' : ''); + update_elements = document.getElementsByName('phone_notify_checkbox'); + for(var i in update_elements) update_elements[i].checked = (phone ? 'checked' : ''); + update_elements = document.getElementsByName('sms_notify_checkbox'); + for(var i in update_elements) update_elements[i].checked = (sms ? 'checked' : ''); + } + update_elements = document.getElementsByName('phone_notify'); + for(var i in update_elements) update_elements[i].value = load_info.settings['opac.default_phone']; + update_elements = document.getElementsByName('sms_notify'); + for(var i in update_elements) update_elements[i].value = load_info.settings['opac.default_sms_notify']; + update_elements = document.getElementsByName('sms_carrier'); + for(var i in update_elements) update_elements[i].value = load_info.settings['opac.default_sms_carrier']; + } } window.onload = function() { // record details page events diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index d0657a92cb..14c4cd3fe5 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -106,7 +106,7 @@ function set_brief_view() { "set_patron_tab", "volume_item_creator", "get_new_session", "holdings_maintenance_tab", "open_chrome_window", "url_prefix", "network_meter", "page_meter", "set_statusbar", "set_help_context", - "get_barcode", "reload_opac" + "get_barcode", "reload_opac", "get_barcode_and_settings" ].forEach(function(k) { content_params[k] = xulG[k]; }); top_pane.set_iframe( @@ -328,7 +328,8 @@ function open_acq_orders() { "set_patron_tab", "volume_item_creator", "get_new_session", "holdings_maintenance_tab", "set_tab_name", "open_chrome_window", "url_prefix", "network_meter", "page_meter", "set_statusbar", - "set_help_context", "get_barcode", "reload_opac" + "set_help_context", "get_barcode", "reload_opac", + "get_barcode_and_settings" ].forEach(function(k) { content_params[k] = xulG[k]; }); var loc = urls.XUL_BROWSER + "?url=" + window.escape( @@ -365,7 +366,8 @@ function open_alt_serial_mgmt() { "set_patron_tab", "volume_item_creator", "get_new_session", "holdings_maintenance_tab", "set_tab_name", "open_chrome_window", "url_prefix", "network_meter", "page_meter", "set_statusbar", - "set_help_context", "get_barcode", "reload_opac" + "set_help_context", "get_barcode", "reload_opac", + "get_barcode_and_settings" ].forEach(function(k) { content_params[k] = xulG[k]; }); var loc = urls.XUL_BROWSER + "?url=" + window.escape( @@ -402,7 +404,8 @@ function set_opac() { g.error.standard_unexpected_error_alert('window_open',E); } }, - 'get_barcode' : xulG.get_barcode + 'get_barcode' : xulG.get_barcode, + 'get_barcode_and_settings' : xulG.get_barcode_and_settings }, 'on_url_load' : function(f) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); @@ -541,6 +544,7 @@ function set_opac() { content_params.set_statusbar = xulG.set_statusbar; content_params.set_help_context = xulG.set_help_context; content_params.get_barcode = xulG.get_barcode; + content_params.get_barcode_and_settings = xulG.get_barcode_and_settings; var secure_opac = true; // default to secure netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); @@ -718,6 +722,7 @@ function bib_in_new_tab() { content_params.set_statusbar = xulG.set_statusbar; content_params.set_help_context = xulG.set_help_context; content_params.get_barcode = xulG.get_barcode; + content_params.get_barcode_and_settings = xulG.get_barcode_and_settings; xulG.new_tab(xulG.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params); } catch(E) { @@ -733,7 +738,8 @@ function batch_receive_in_new_tab() { "set_patron_tab", "volume_item_creator", "get_new_session", "holdings_maintenance_tab", "set_tab_name", "open_chrome_window", "url_prefix", "network_meter", "page_meter", "set_statusbar", - "set_help_context", "get_barcode", "reload_opac" + "set_help_context", "get_barcode", "reload_opac", + "get_barcode_and_settings" ].forEach(function(k) { content_params[k] = xulG[k]; }); xulG.new_tab( diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 4d8b482349..c6d9755ee2 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -62,6 +62,7 @@ main.menu.prototype = { urls.remote = params['server']; xulG.get_barcode = this.get_barcode; + xulG.get_barcode_and_settings = this.get_barcode_and_settings; // Pull in local customizations var r = new XMLHttpRequest(); @@ -2275,6 +2276,7 @@ commands: content_params.network_meter = obj.network_meter; content_params.page_meter = obj.page_meter; content_params.get_barcode = obj.get_barcode; + content_params.get_barcode_and_settings = obj.get_barcode_and_settings; content_params.render_toolbar_layout = function(layout) { return obj.render_toolbar_layout(layout); }; content_params.set_statusbar = function(slot,text,tooltiptext,click_handler) { var e = document.getElementById('statusbarpanel'+slot); @@ -2528,6 +2530,29 @@ commands: return "user_false"; }, + 'get_barcode_and_settings' : function(window, barcode, settings, settings_only) { + JSAN.use('util.network'); + if(!settings_only) { + // We need to double-check the barcode for completion and such. + var new_barcode = xulG.get_barcode(window, 'actor', barcode); + if(new_barcode == "user_false") return; + // No error means we have a (hopefully valid) completed barcode to use. + // Otherwise, fall through to other methods of checking + if(typeof new_barcode.ilsevent == 'undefined') + barcode = new_barcode.barcode; + else + return false; + } + var network = new util.network(); + // We have a barcode! Time to load settings. + // First, we need the user ID + var user_id = network.simple_request('FM_AU_ID_RETRIEVE_VIA_BARCODE_OR_USERNAME', [ ses(), barcode ]); + if(user_id.ilsevent != undefined || user_id.textcode != undefined) + return false; + var settings = network.simple_request('FM_AUS_RETRIEVE', [ ses(), user_id, settings ]); + return {"barcode": barcode, "settings" : settings}; + }, + 'sort_menu' : function(menu, recurse) { var curgroup = new Array(); var curstart = 1; diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js index 054e364bb2..d3a45879f3 100644 --- a/Open-ILS/xul/staff_client/server/patron/display.js +++ b/Open-ILS/xul/staff_client/server/patron/display.js @@ -391,7 +391,8 @@ patron.display.prototype = { urls.EG_ACQ_USER_REQUESTS + '?usr=' + obj.patron.id(), {}, { - 'get_barcodes' : function(a) { return xulG.get_barcodes(a); } + 'get_barcode' : function(a,b,c) { return xulG.get_barcode(a,b,c); }, + 'get_barcode_and_settings' : function(a,b,c,d) { return xulG.get_barcode_and_settings(a,b,c,d); } } ); } @@ -884,6 +885,7 @@ patron.display.prototype = { } }, 'get_barcode' : xulG.get_barcode, + 'get_barcode_and_settings' : xulG.get_barcode_and_settings, 'url_prefix' : xulG.url_prefix } );