badBarcode: string = null;
puLibWsFallback = false;
+ puLibWsDefault = false;
// Orgs which are not valid pickup locations
disableOrgs: number[] = [];
this.userBarcode = this.staffCat.holdForBarcode;
}
- this.store.getItem('circ.staff_placed_holds_fallback_to_ws_ou')
- .then(setting => this.puLibWsFallback = setting === true);
+ this.store.getItemBatch([
+ 'circ.staff_placed_holds_fallback_to_ws_ou',
+ 'circ.staff_placed_holds_default_to_ws_ou'
+ ]).then(settings => {
+ this.puLibWsFallback =
+ settings['circ.staff_placed_holds_fallback_to_ws_ou'] === true;
+ this.puLibWsDefault =
+ settings['circ.staff_placed_holds_default_to_ws_ou'] === true;
+ });
this.org.list().forEach(org => {
if (org.ou_type().can_have_vols() === 'f') {
this.phoneValue = this.user.day_phone() || this.user.evening_phone();
// Default to work org if placing holds for staff.
- if (this.user.id() !== this.requestor.id() && !this.puLibWsFallback) {
- // This value may be superseded below by user settings.
- this.pickupLib = this.user.home_ou();
+ // Default to home org if placing holds for patrons unless
+ // settings default or fallback to the workstation.
+ if (this.user.id() !== this.requestor.id()) {
+ if (!this.puLibWsFallback && !this.puLibWsDefault) {
+ // This value may be superseded below by user settings.
+ this.pickupLib = this.user.home_ou();
+ }
}
if (!this.user.settings()) { return; }
break;
case 'opac.default_pickup_location':
- if (value) {
+ if (!this.puLibWsDefault && value) {
this.pickupLib = Number(value);
}
break;
'eg.catalog.search.form.open',
'eg.staff.catalog.results.show_more',
'circ.staff_placed_holds_fallback_to_ws_ou',
+ 'circ.staff_placed_holds_default_to_ws_ou',
'opac.staff.jump_to_details_on_single_hit',
'eg.staffcat.search_filters'
]).then(settings => {
)
);
+INSERT INTO config.org_unit_setting_type (
+ name, grp, label, description, datatype
+) VALUES (
+ 'circ.staff_placed_holds_default_to_ws_ou',
+ 'circ',
+ oils_i18n_gettext(
+ 'circ.staff_placed_holds_default_to_ws_ou',
+ 'Workstation OU is the default for staff-placed holds',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.staff_placed_holds_default_to_ws_ou',
+ 'For staff-placed holds, regardless of the patron preferred pickup location, the staff workstation OU is the default pickup location',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+);
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('xxxx', :eg_version);
+
+INSERT INTO config.org_unit_setting_type (
+ name, grp, label, description, datatype
+) VALUES (
+ 'circ.staff_placed_holds_default_to_ws_ou',
+ 'circ',
+ oils_i18n_gettext(
+ 'circ.staff_placed_holds_default_to_ws_ou',
+ 'Workstation OU is the default for staff-placed holds',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.staff_placed_holds_default_to_ws_ou',
+ 'For staff-placed holds, regardless of the patron preferred pickup location, the staff workstation OU is the default pickup location',
+ 'coust',
+ 'description'
+ ),
+ 'bool'
+);
+
+COMMIT;
// Safe at this point as we already set cur_hold_barcode
document.getElementById('hold_usr_input').value = load_info.barcode;
- // Patron preferred pickup loc always overrides the default pickup lib
+ // Patron preferred pickup loc overrides the default pickup lib
+ // unless the default to workstation setting is enabled
document.getElementById('pickup_lib').value =
+ !load_info.settings['circ.staff_placed_holds_default_to_ws_ou'] &&
load_info.settings['opac.default_pickup_location'] ?
load_info.settings['opac.default_pickup_location'] : load_info.pickup_lib;
}
return null;
}
- egCore.org.settings(['circ.staff_placed_holds_fallback_to_ws_ou'])
+ var wsFallback = 'circ.staff_placed_holds_fallback_to_ws_ou';
+ var wsDefault = 'circ.staff_placed_holds_default_to_ws_ou';
+
+ egCore.org.settings([wsFallback, wsDefault])
.then(function(auth_usr_aous){
// copied more or less directly from XUL menu.js
settings[user.settings()[i].name()] =
JSON2js(user.settings()[i].value());
}
+ settings[wsDefault] = auth_usr_aous[wsDefault];
// find applicable YAOUSes for staff-placed holds
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, optionally default to ws ou
- if (auth_usr_aous['circ.staff_placed_holds_fallback_to_ws_ou']){
+ if (auth_usr_aous[wsFallback] || auth_usr_aous[wsDefault]) {
pickup_lib = requestor.ws_ou();
}
}