From a850f4716ad926993ba6f6aec0bbbd266fa61373 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 1 Mar 2017 15:52:21 -0500 Subject: [PATCH] Revert "LP1402018_Acq_Copy_location_UI_scoped_to_registered_workstation" JBAS-1706 limit to workstation-local copy locations in ACQ selectors. This works OK for us becuase we have a acp_location_fixer_trig on asset.copy and a nightly location fixer process (copy_loc_fix/run_copy_location_fix.sh) to forces copies to use the location matching their circ lib. The extra copies added by this commit make the selector practically unusable. This reverts commit 025682d8d58785d030e0ed43fb9e9d37d168388a. --- .../web/js/dojo/openils/widget/AutoFieldWidget.js | 60 ++++++++-------------- Open-ILS/web/js/ui/default/acq/common/li_table.js | 2 +- 2 files changed, 21 insertions(+), 41 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js index 149d53d150..9ae36f2b93 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js @@ -486,29 +486,8 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { return this._buildPermGrpSelector(); if(linkClass == 'aou') return this._buildOrgSelector(); - if(linkClass == 'acpl'){ - var self2 = this; - var orgs = []; - /* ----------------------------------------------------- - When the copy location dropdown is in a link context - we need to expand the list to the provided permission - branches - ------------------------------------------------------*/ - if(this.orgLimitPerms){ - var buildCopyLocSelector = this._buildCopyLocSelector; - new openils.User().getPermOrgList( - self2.orgLimitPerms, - function(orgsi) { - orgs = orgs.concat(orgsi); - buildCopyLocSelector(orgs,self2); - }, - true, true // descendants, id_list - ); - return true; - } - else - return this._buildCopyLocSelector(orgs,self); - } + if(linkClass == 'acpl') + return this._buildCopyLocSelector(); if(linkClass == 'acqpro') return this._buildAutoCompleteSelector(linkClass, vfield.selector); @@ -714,21 +693,22 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { return true; }, - _buildCopyLocSelector : function(orgs,self) { + _buildCopyLocSelector : function() { dojo.require('dijit.form.FilteringSelect'); - self.widget = new dijit.form.FilteringSelect(self.dijitArgs, self.parentNode); - self.widget.searchAttr = self.widget.labalAttr = 'name'; - self.widget.valueAttr = 'id'; + this.widget = new dijit.form.FilteringSelect(this.dijitArgs, this.parentNode); + this.widget.searchAttr = this.widget.labalAttr = 'name'; + this.widget.valueAttr = 'id'; // my orgs var ws_ou = openils.User.user.ws_ou(); - orgs = orgs.concat(fieldmapper.aou.findOrgUnit(ws_ou).orgNodeTrail().map(function (i) { return i.id() })); + var orgs = fieldmapper.aou.findOrgUnit(ws_ou).orgNodeTrail().map(function (i) { return i.id() }); orgs = orgs.concat(fieldmapper.aou.descendantNodeList(ws_ou).map(function (i) { return i.id() })); + var self = this; var search = {owning_lib : orgs, deleted : 'f'}; - if(self.cache.copyLocStore) { - var store = self.cache.copyLocStore; + if(this.cache.copyLocStore) { + var store = this.cache.copyLocStore; var allGood = false; var locIds = []; @@ -738,7 +718,7 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { // the set of locations to fetch. var allGood = false; - if (self.widgetValue) { + if (this.widgetValue) { store.fetch({ onComplete : function(list) { @@ -756,21 +736,21 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { } if (allGood) { - self.widget.store = self.cache.copyLocStore; - self.widget.startup(); - self.async = false; + this.widget.store = this.cache.copyLocStore; + this.widget.startup(); + this.async = false; return true; } else { - // cached IDs plus id of self.widgetValue; - locIds.push(self.widgetValue); + // cached IDs plus id of this.widgetValue; + locIds.push(this.widgetValue); search = {id : locIds, deleted: 'f'}; } } - new openils.PermaCrud().search('acpl', search, { - async : !self.forceSync, + new openils.PermaCrud().search('acpl', search, { + async : !this.forceSync, order_by : {"acpl": "name"}, oncomplete : function(r) { var list = openils.Util.readResponse(r, false, true); @@ -779,8 +759,8 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { // if we are including any copy locations outside our org // unit scope, tag them with a context org unit to prevent // confusion caused by having multiple like-named entries - dojo.forEach(list, function(loc) { - if (orgs.length>1) { + dojo.forEach(list, function(loc) { + if (orgs.indexOf(loc.owning_lib()) < 0) { loc.name(loc.name() + ' (' + fieldmapper.aou.findOrgUnit(loc.owning_lib()).shortname() + ')'); } diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 8b12f9ce8c..a3b63a8cd6 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -197,7 +197,7 @@ function AcqLiTable() { "searchFormat": (field == 'fund') ? fundSearchFormat : null, "searchFilter": (field == 'fund') ? fundSearchFilter : null, "searchOptions": (field == 'fund') ? fundSort : null, - "orgLimitPerms": (field == 'location') ? ['CREATE_PICKLIST', 'CREATE_PURCHASE_ORDER'] : [perms], + "orgLimitPerms": [perms], "dijitArgs": { "required": false, "labelType": (field == "fund") ? "html" : null -- 2.11.0