From 6ff51103f50b12746e8b147d984e09c753d42c41 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 20 Feb 2018 03:39:46 -0500 Subject: [PATCH] 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. --- chrome/content/zotero/xpcom/data/itemFields.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chrome/content/zotero/xpcom/data/itemFields.js b/chrome/content/zotero/xpcom/data/itemFields.js index 67bb7053f3..c1ac1f126b 100644 --- a/chrome/content/zotero/xpcom/data/itemFields.js +++ b/chrome/content/zotero/xpcom/data/itemFields.js @@ -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]; }