[open-ils-commits] [GIT] Evergreen ILS branch master updated. 73a6d114b56af44b8af40b28d9406d527e6f94f6
Evergreen Git
git at git.evergreen-ils.org
Fri Mar 23 16:05:29 EDT 2012
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 73a6d114b56af44b8af40b28d9406d527e6f94f6 (commit)
from bf91e76a5aa38bfeae0c63ed1d2d27943051fb5d (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 73a6d114b56af44b8af40b28d9406d527e6f94f6
Author: Bill Erickson <berick at esilibrary.com>
Date: Thu Mar 22 13:41:29 2012 -0400
AutoFieldWidget single-object cache repairs
Caching single objects linked off the context object was failing in most
cases as it was caching under the display name instead of the true value
(pkey) for the linked object. This fixes that by always caching the
linked object by its true value, so that future cache lookups will be
looking in the right place.
Signed-off-by: Bill Erickson <berick at esilibrary.com>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
index ad5d92b..50d1a4f 100644
--- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
+++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
@@ -389,14 +389,18 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
}
// then try the single object cache
- if(this.cache[this.auth].single[lclass] &&
- this.cache[this.auth].single[lclass][this.widgetValue] &&
- this.cache[this.auth].single[lclass][this.widgetValue][self.labelFormat || '']) {
- this.widgetValue = this.cache[this.auth].single[lclass][this.widgetValue][self.labelFormat || ''];
+ var item;
+ if(this.cache[this.auth].single[lclass] && (
+ item = this.cache[this.auth].single[lclass][this.widgetValue]) ) {
+
+ this.widgetValue = (this.labelFormat) ?
+ this._applyLabelFormat(item.toStoreItem(), this.labelFormat) :
+ item[linkInfo.vfield.selector]();
+
return;
}
- console.log("Fetching sync object " + lclass + " : " + this.widgetValue);
+ console.log("Fetching linked object " + lclass + " : " + this.widgetValue);
// if those fail, fetch the linked object
this.async = true;
@@ -406,22 +410,14 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
oncomplete : function(r) {
var item = openils.Util.readResponse(r);
- var newvalue = item[linkInfo.vfield.selector]();
-
- var labelCacheKey = '';
-
- if(self.labelFormat) {
- labelCacheKey = self.labelFormat;
- self.widgetValue = self._applyLabelFormat(item.toStoreItem(), self.labelFormat);
- } else {
- self.widgetValue = newvalue;
- }
-
+ // cache the true object under its real value
if(!self.cache[self.auth].single[lclass])
self.cache[self.auth].single[lclass] = {};
- if(!self.cache[self.auth].single[lclass][self.widgetValue])
- self.cache[self.auth].single[lclass][self.widgetValue] = {};
- self.cache[self.auth].single[lclass][self.widgetValue][labelCacheKey] = newvalue;
+ self.cache[self.auth].single[lclass][self.widgetValue] = item;
+
+ self.widgetValue = (self.labelFormat) ?
+ self._applyLabelFormat(item.toStoreItem(), self.labelFormat) :
+ item[linkInfo.vfield.selector]();
self.widget.startup();
self._widgetLoaded();
-----------------------------------------------------------------------
Summary of changes:
.../web/js/dojo/openils/widget/AutoFieldWidget.js | 34 +++++++++-----------
1 files changed, 15 insertions(+), 19 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list