www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 6126a49feab63ca29d5a9ab500d2ae845cda8b03
parent 5c8209da5c99d91372ee2af6871cd429e4297a93
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat, 25 Apr 2015 03:05:54 -0400

Don't require non-identified items to have loaded data in getField()

This allows getField() on an unsaved item to work properly without a pointless
loadItemData() call.

Diffstat:
Mchrome/content/zotero/xpcom/data/item.js | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -267,10 +267,9 @@ Zotero.Item.prototype.getField = function(field, unformatted, includeBaseMapped) return ''; } - // Either item data has to be loaded (which sets empty valid fields to false) - // or this field has to be populated (e.g., by Zotero.Items.cacheFields()) - // before getField() is called. - if (value === null) { + // If the item is identified (has an id or key), this field has to be populated (e.g., by + // Zotero.Items.cacheFields()) or item data has to be loaded + if (this._identified && value === null && !this._loaded.itemData) { throw new Zotero.Exception.UnloadedDataException( "Item data not loaded and field '" + field + "' not set", "itemData" );