Don't save library catalog from translation if not valid for item type

Fixes #1781
This commit is contained in:
Dan Stillman 2020-01-28 20:19:18 -05:00
parent 4e11c7927d
commit 851af7f45b

View file

@ -607,6 +607,15 @@ Zotero.Translate.Sandbox = {
if(item.libraryCatalog === undefined && item.itemType != "webpage") {
item.libraryCatalog = translate.translator[0].label;
}
// Remove library catalog if not valid for type, so it doesn't get saved to Extra
if (item.libraryCatalog) {
let itemTypeID = Zotero.ItemTypes.getID(item.itemType);
let fieldID = Zotero.ItemFields.getID('libraryCatalog');
if (!Zotero.ItemFields.isValidForType(fieldID, itemTypeID)) {
delete item.libraryCatalog;
}
}
// automatically set access date if URL is set
if(item.url && typeof item.accessDate == 'undefined') {