Make Zotero.ItemFields.getFieldIDFromTypeAndBase() work on non-base fields

This previously returned false if a non-base-mapped field was passed,
even if the field was valid for the given item type. It now returns the
passed field as long as the field is valid for the type, which matches
the behavior for base fields.
This commit is contained in:
Dan Stillman 2018-02-20 03:39:46 -05:00
parent 44fd598699
commit 6ff51103f5

View file

@ -260,6 +260,11 @@ Zotero.ItemFields = new function() {
throw new Error("Invalid field '" + baseField + '" for base field');
}
// If field isn't a base field, return it if it's valid for the type
if (!this.isBaseField(baseFieldID)) {
return this.isValidForType(baseFieldID, itemTypeID) ? baseFieldID : false;
}
return _baseTypeFields[itemTypeID][baseFieldID];
}