[open-ils-commits] [GIT] Evergreen ILS branch master updated. 4b094b126ae2575a03377300fb66b3f5095544fb

Evergreen Git git at git.evergreen-ils.org
Tue Nov 17 13:09:19 EST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  4b094b126ae2575a03377300fb66b3f5095544fb (commit)
      from  69e5ef2e2d7600733f05f80b21e18b2eabc43c6b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4b094b126ae2575a03377300fb66b3f5095544fb
Author: blake <blake at mobiusconsortium.org>
Date:   Mon Jan 5 10:38:18 2015 -0600

    LP1402018_Acq_Copy_location_UI_scoped_to_registered_workstation
    
    This little patch will open up the acq copy location dropdown UI
    to include other library's copy locations outside of the workstation
    registration. When the user permissions are scoped to more branches.
    
    Signed-off-by: blake <blake at mobiusconsortium.org>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
index 9ae36f2..149d53d 100644
--- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
+++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
@@ -486,8 +486,29 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                 return this._buildPermGrpSelector();
             if(linkClass == 'aou')
                 return this._buildOrgSelector();
-            if(linkClass == 'acpl')
-                return this._buildCopyLocSelector();
+            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 == 'acqpro')
                 return this._buildAutoCompleteSelector(linkClass, vfield.selector);
 
@@ -693,22 +714,21 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
             return true;
         },
 
-        _buildCopyLocSelector : function() {
+        _buildCopyLocSelector : function(orgs,self) {
             dojo.require('dijit.form.FilteringSelect');
-            this.widget = new dijit.form.FilteringSelect(this.dijitArgs, this.parentNode);
-            this.widget.searchAttr = this.widget.labalAttr = 'name';
-            this.widget.valueAttr = 'id';
+            self.widget = new dijit.form.FilteringSelect(self.dijitArgs, self.parentNode);
+            self.widget.searchAttr = self.widget.labalAttr = 'name';
+            self.widget.valueAttr = 'id';
             
             // my orgs
             var ws_ou = openils.User.user.ws_ou();
-            var orgs = fieldmapper.aou.findOrgUnit(ws_ou).orgNodeTrail().map(function (i) { return i.id() });
+            orgs = orgs.concat(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(this.cache.copyLocStore) {
-                var store = this.cache.copyLocStore;
+            if(self.cache.copyLocStore) {
+                var store = self.cache.copyLocStore;
                 var allGood = false;
                 var locIds = [];
 
@@ -718,7 +738,7 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                 // the set of locations to fetch.
 
                 var allGood = false;
-                if (this.widgetValue) {
+                if (self.widgetValue) {
                 
                     store.fetch({
                         onComplete : function(list) {
@@ -736,21 +756,21 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                 }
 
                 if (allGood) {
-                    this.widget.store = this.cache.copyLocStore;
-                    this.widget.startup();
-                    this.async = false;
+                    self.widget.store = self.cache.copyLocStore;
+                    self.widget.startup();
+                    self.async = false;
                     return true;
 
                 } else {
-                    // cached IDs plus id of this.widgetValue;
-                    locIds.push(this.widgetValue);
+                    // cached IDs plus id of self.widgetValue;
+                    locIds.push(self.widgetValue);
                     search = {id : locIds, deleted: 'f'};
                 }
             } 
 
 
-            new openils.PermaCrud().search('acpl', search, {
-                async : !this.forceSync,
+            new openils.PermaCrud().search('acpl', search, {			
+                async : !self.forceSync,
                 order_by : {"acpl": "name"},
                 oncomplete : function(r) {
                     var list = openils.Util.readResponse(r, false, true);
@@ -759,8 +779,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.indexOf(loc.owning_lib()) < 0) {
+                    dojo.forEach(list, function(loc) {					
+                        if (orgs.length>1) {
                             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 5d0a841..4eda197 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
@@ -183,7 +183,7 @@ function AcqLiTable() {
                 "labelFormat": (field == 'fund') ? fundLabelFormat : null,
                 "searchFormat": (field == 'fund') ? fundSearchFormat : null,
                 "searchFilter": (field == 'fund') ? fundSearchFilter : null,
-                "orgLimitPerms": [perms],
+                "orgLimitPerms": (field == 'location') ? ['CREATE_PICKLIST', 'CREATE_PURCHASE_ORDER'] : [perms],
                 "dijitArgs": {
                     "required": false,
                     "labelType": (field == "fund") ? "html" : null

-----------------------------------------------------------------------

Summary of changes:
 .../web/js/dojo/openils/widget/AutoFieldWidget.js  |   60 +++++++++++++-------
 Open-ILS/web/js/ui/default/acq/common/li_table.js  |    2 +-
 2 files changed, 41 insertions(+), 21 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list