[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch rel_2_3 updated. 83a48f9fd36731ecae552d1c3ce0ebafcf5a7164

Evergreen Git git at git.evergreen-ils.org
Tue Nov 19 15:15:09 EST 2013


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, rel_2_3 has been updated
       via  83a48f9fd36731ecae552d1c3ce0ebafcf5a7164 (commit)
       via  d934e9f3a8342b068cfbf90139e9c141227957e1 (commit)
      from  e95a1509ea714783bf9fecc43df60c9c63f978b9 (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 83a48f9fd36731ecae552d1c3ce0ebafcf5a7164
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Sep 28 15:48:22 2012 -0400

    AutoFieldWidget support external copy loc retrieval
    
    When rendering a collection of copy locations, AFW fetches locations
    relevant to the context org unit.  While rendering an AFW for an
    existing object, though, whose copy location is outside of that scope,
    the code will now append the non-local copy location to the selector and
    tag it with the owning lib (to avoid dupes).
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
index 6e4c88f..f5e5a99 100644
--- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
+++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
@@ -697,26 +697,74 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
             this.widget = new dijit.form.FilteringSelect(this.dijitArgs, this.parentNode);
             this.widget.searchAttr = this.widget.labalAttr = 'name';
             this.widget.valueAttr = 'id';
-
-            if(this.cache.copyLocStore) {
-                this.widget.store = this.cache.copyLocStore;
-                this.widget.startup();
-                this.async = false;
-                return true;
-            } 
-
+            
             // 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.descendantNodeList(ws_ou).map(function (i) { return i.id() }));
 
             var self = this;
-            new openils.PermaCrud().search('acpl', {owning_lib : orgs}, {
+            var search = {owning_lib : orgs};
+
+            if(this.cache.copyLocStore) {
+                var store = this.cache.copyLocStore;
+                var allGood = false;
+                var locIds = [];
+
+                // make sure the copy location the caller cares 
+                // about (our value) is present in the cache.
+                // if not, fetch the list, adding our value to
+                // the set of locations to fetch.
+
+                var allGood = false;
+                if (this.widgetValue) {
+                
+                    store.fetch({
+                        onComplete : function(list) {
+                            dojo.forEach(list, function(item) {
+                                var id = store.getValue(item, 'id');
+                                if (id == self.widgetValue)
+                                    allGood = true;
+                                locIds.push(id);
+                            });
+                        }
+                    });
+
+                } else {
+                    allGood = true;
+                }
+
+                if (allGood) {
+                    this.widget.store = this.cache.copyLocStore;
+                    this.widget.startup();
+                    this.async = false;
+                    return true;
+
+                } else {
+                    // cached IDs plus id of this.widgetValue;
+                    locIds.push(this.widgetValue);
+                    search = {id : locIds};
+                }
+            } 
+
+
+            new openils.PermaCrud().search('acpl', search, {
                 async : !this.forceSync,
                 order_by : {"acpl": "name"},
                 oncomplete : function(r) {
                     var list = openils.Util.readResponse(r, false, true);
                     if(!list) return;
+
+                    // 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) {
+                            loc.name(loc.name() + ' (' + 
+                                fieldmapper.aou.findOrgUnit(loc.owning_lib()).shortname() + ')');
+                        }
+                    });
+
                     self.widget.store = 
                         new self.storeConstructor({data:fieldmapper.acpl.toStoreData(list)});
                     self.cache.copyLocStore = self.widget.store;

commit d934e9f3a8342b068cfbf90139e9c141227957e1
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Sep 28 15:00:37 2012 -0400

    ACQ order upload use copy location from owner
    
    When uploading an ACQ MARC order record, attempt to match copy locations
    to copies based on the copy owning location instead of the upload
    context org unit.  This allows one branch to order copies for another
    and have the copies use the copy location of the other (owning) branch
    (when they exist) instead of the ordering branch (or parent org).
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
index 06aa7c4..f7768a5 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
@@ -1652,17 +1652,28 @@ sub extract_lineitem_detail_data {
     # ---------------------------------------------------------------------
     # Shelving Location
     if( my $name = $compiled{copy_location}) {
-        my $loc = $mgr->cache($base_org, "copy_loc.$name");
+
+        my $cp_base_org = $base_org;
+
+        if ($compiled{owning_lib}) {
+            # start looking for copy locations at the copy 
+            # owning lib instaed of the upload context org
+            $cp_base_org = $compiled{owning_lib};
+        }
+
+        my $loc = $mgr->cache($cp_base_org, "copy_loc.$name");
         unless($loc) {
-            for my $org (@$org_path) {
+            my $org = $cp_base_org;
+            while ($org) {
                 $loc = $mgr->editor->search_asset_copy_location(
                     {owning_lib => $org, name => $name}, {idlist => 1})->[0];
                 last if $loc;
+                $org = $mgr->editor->retrieve_actor_org_unit($org)->parent_ou;
             }
         }
         return $killme->("Invalid copy location $name") unless $loc;
         $compiled{copy_location} = $loc;
-        $mgr->cache($base_org, "copy_loc.$name", $loc);
+        $mgr->cache($cp_base_org, "copy_loc.$name", $loc);
     }
 
     return \%compiled;

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Acq/Order.pm  |   17 ++++-
 .../web/js/dojo/openils/widget/AutoFieldWidget.js  |   66 +++++++++++++++++---
 2 files changed, 71 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list