don't assume an autofieldwidget cached linked object list contains the linked object...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 17 May 2010 19:57:04 +0000 (19:57 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 17 May 2010 19:57:04 +0000 (19:57 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16444 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js

index f0831e5..d6a108c 100644 (file)
@@ -288,10 +288,8 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                 return false;
             var lclass = linkInfo.linkClass;
 
-            if(lclass == 'aou') {
-                this.widgetValue = fieldmapper.aou.findOrgUnit(this.widgetValue).shortname();
-                return;
-            }
+            if(lclass == 'aou') 
+                return false;
 
             // first try the store cache
             var self = this;
@@ -299,12 +297,17 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                 var store = this.cache[this.auth].list[lclass];
                 var query = {};
                 query[linkInfo.vfield.name] = ''+this.widgetValue;
+                var found = false;
                 store.fetch({query:query, onComplete:
                     function(list) {
-                        self.widgetValue = store.getValue(list[0], linkInfo.vfield.selector);
+                        if(list[0]) {
+                            self.widgetValue = store.getValue(list[0], linkInfo.vfield.selector);
+                            found = true;
+                        }
                     }
                 });
-                return;
+
+                if(found) return;
             }
 
             // then try the single object cache