From 5a39d42b640f26048cc7cf69b92fd4d90d9888a6 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Fri, 23 Mar 2018 13:07:45 -0400 Subject: [PATCH] LP#1699838 Scale back settings for staff-based hold placement For now, we will add just one new setting to optionally restore the old behavior. In the absence of a 'preferred pickup location', the staff form will default to the staff workstation OU. Also, add setting to seed data. Signed-off-by: Dan Wells Signed-off-by: Kathy Lussier Conflicts: Open-ILS/src/sql/Pg/950.data.seed-values.sql --- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 10 +++++++ ...ata.yaos-circ-holds-default-pickup-lib.sql | 8 ++---- Open-ILS/web/js/ui/default/opac/staff.js | 28 ++++--------------- .../js/ui/default/staff/services/eframe.js | 20 ++++--------- 4 files changed, 23 insertions(+), 43 deletions(-) diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 720a359111..6816911bab 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -5446,6 +5446,16 @@ INSERT into config.org_unit_setting_type 'description' ), 'bool', null) +,( 'circ.staff_placed_holds_fallback_to_ws_ou', 'circ', + oils_i18n_gettext( + 'circ.staff_placed_holds_fallback_to_ws_ou', + 'Workstation OU fallback for staff-placed holds', + 'coust', 'label'), + oils_i18n_gettext( + 'circ.staff_placed_holds_fallback_to_ws_ou', + 'For staff-placed holds, in the absence of a patron preferred pickup location, fall back to using the staff workstation OU (rather than patron home OU)', + 'coust', 'description'), + 'bool', null) ; UPDATE config.org_unit_setting_type diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.yaos-circ-holds-default-pickup-lib.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.yaos-circ-holds-default-pickup-lib.sql index 236dc1bfb0..4bad1468e2 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.yaos-circ-holds-default-pickup-lib.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.yaos-circ-holds-default-pickup-lib.sql @@ -3,12 +3,8 @@ BEGIN; -- SELECT evergreen.upgrade_deps_block_check('xxxx', :eg_version); INSERT into config.org_unit_setting_type (name, label, grp, description, datatype) -values ('circ.staff_placed_holds_honor_patron_prefs_first','Honor the patron-preferred Pickup Library as default for staff-placed holds.', - 'circ', 'Honor the patron-preferred Pickup Library as the default for staff-placed holds.', 'bool'); - -INSERT into config.org_unit_setting_type (name, label, grp, description, datatype) -values ('circ.staff_placed_holds_staff_ws_ou_override','During Staff-placed holds, use the patron-preferred location or their home OU instead of the Staff User Workstation Org. unit as default pickup location.', - 'circ', 'During staff-placed holds, use the patron-preferred location or their home OU instead of the Staff User Workstation Org. unit as default pickup location.', 'bool'); +values ('circ.staff_placed_holds_fallback_to_ws_ou','Workstation OU fallback for staff-placed holds', + 'circ', 'For staff-placed holds, in the absence of a patron preferred pickup location, fall back to using the staff workstation OU (rather than patron home OU)', 'bool'); COMMIT; diff --git a/Open-ILS/web/js/ui/default/opac/staff.js b/Open-ILS/web/js/ui/default/opac/staff.js index 711c995686..51d9eaa284 100644 --- a/Open-ILS/web/js/ui/default/opac/staff.js +++ b/Open-ILS/web/js/ui/default/opac/staff.js @@ -110,31 +110,13 @@ function staff_hold_usr_barcode_changed2( } cur_hold_barcode = load_info.barcode; if (!only_settings || (isload && isload !== true)) { - document.getElementById('hold_usr_input').value = load_info.barcode; - // Safe at this point as we already set cur_hold_barcode - } - - var patronDefaultPickupOU; - if (!only_settings || (isload && isload !== true) && load_info.pickup_lib) { - - // Patron default is either their preferred pickup loc or their home OU - patronDefaultPickupOU = load_info.settings['opac.default_pickup_location'] - ? load_info.settings['opac.default_pickup_location'] : load_info.pickup_lib; - - document.getElementById('pickup_lib').value = patronDefaultPickupOU; // Safe at this point as we already set cur_hold_barcode - } - - if (load_info.settings['staff_WS_OU']){ // this is staff-placed hold! - - // check wether we want to default to staff's WS OU or just the patron's Home OU - document.getElementById('pickup_lib').value = load_info.settings['overrideStaff_WS_OU'] - ? patronDefaultPickupOU : load_info.settings['staff_WS_OU']; - - // use staff WS OU as default pickup_lib unless YAOUS says otherwise - document.getElementById('pickup_lib').value = load_info.settings['honorPatronPrefPickupOU'] - ? patronDefaultPickupOU : load_info.settings['staff_WS_OU']; + document.getElementById('hold_usr_input').value = load_info.barcode; + // Patron preferred pickup loc always overrides the default pickup lib + document.getElementById('pickup_lib').value = + load_info.settings['opac.default_pickup_location'] ? + load_info.settings['opac.default_pickup_location'] : load_info.pickup_lib; } if (!load_info.settings['opac.default_sms_notify']){ diff --git a/Open-ILS/web/js/ui/default/staff/services/eframe.js b/Open-ILS/web/js/ui/default/staff/services/eframe.js index 1b423b2faf..5096165f75 100644 --- a/Open-ILS/web/js/ui/default/staff/services/eframe.js +++ b/Open-ILS/web/js/ui/default/staff/services/eframe.js @@ -239,8 +239,7 @@ angular.module('egCoreMod') return null; } - egCore.org.settings(['circ.staff_placed_holds_honor_patron_prefs_first', - 'circ.staff_placed_holds_staff_ws_ou_override']) + egCore.org.settings(['circ.staff_placed_holds_fallback_to_ws_ou']) .then(function(auth_usr_aous){ // copied more or less directly from XUL menu.js @@ -251,19 +250,12 @@ angular.module('egCoreMod') } // find applicable YAOUSes for staff-placed holds - var honorPatronPrefPickupOU; - var overrideStaff_WS_OU; var requestor = egCore.auth.user(); + var pickup_lib = user.home_ou(); // default to home ou if (requestor.id() !== user.id()){ - // this is a staff-placed hold - - settings["staff_WS_OU"] = requestor.ws_ou(); - if (auth_usr_aous['circ.staff_placed_holds_honor_patron_prefs_first']){ - settings['honorPatronPrefPickupOU'] = true; - } - - if (auth_usr_aous['circ.staff_placed_holds_staff_ws_ou_override']){ - settings['overrideStaff_WS_OU'] = true; + // this is a staff-placed hold, optionally default to ws ou + if (auth_usr_aous['circ.staff_placed_holds_fallback_to_ws_ou']){ + pickup_lib = requestor.ws_ou(); } } @@ -283,7 +275,7 @@ angular.module('egCoreMod') deferred.resolve({ "barcode": barcode, - "pickup_lib": user.home_ou(), + "pickup_lib": pickup_lib, "settings" : settings, "user_email" : user.email(), "patron_name" : patron_name -- 2.43.2