From b06de53a244dba0115336dc997888ff930ede3dc Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 17 May 2010 19:57:04 +0000 Subject: [PATCH] don't assume an autofieldwidget cached linked object list contains the linked object in question. it may have been filtered out of the original list 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 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js index f0831e5c65..d6a108c9b9 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js @@ -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 -- 2.11.0