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.
This commit is contained in:
parent
5c8209da5c
commit
6126a49fea
1 changed files with 3 additions and 4 deletions
|
@ -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"
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue