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:
parent
44fd598699
commit
6ff51103f5
1 changed files with 5 additions and 0 deletions
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue