Follow automatic tags prefs when retrieving PDF metadata by ISBN

https://forums.zotero.org/discussion/85777/retrieve-metadata-for-pdf-creates-automatic-tags-even-when-pref-is-off
This commit is contained in:
Dan Stillman 2020-10-27 01:26:59 -04:00
parent 38b997bee9
commit 2e2a4bca7f

View file

@ -504,18 +504,23 @@ Zotero.RecognizePDF = new function () {
let newItem = new Zotero.Item; let newItem = new Zotero.Item;
newItem.libraryID = libraryID; newItem.libraryID = libraryID;
// Convert tags to automatic. For other items this is done automatically in // Convert tags to automatic. For other items this is done automatically in
// translate.js for other items, but for ISBNs we just get the data // translate.js, but for ISBNs we just get the data (libraryID=false) and do the
// (libraryID=false) and do the saving manually. // saving manually.
translatedItems[0].tags = translatedItems[0].tags.map(tag => { if (Zotero.Prefs.get('automaticTags')) {
if (typeof tag == 'string') { translatedItems[0].tags = translatedItems[0].tags.map(tag => {
return { if (typeof tag == 'string') {
tag, return {
type: 1 tag,
}; type: 1
} };
tag.type = 1; }
return tag; tag.type = 1;
}); return tag;
});
}
else {
translatedItems[0].tags = [];
}
newItem.fromJSON(translatedItems[0]); newItem.fromJSON(translatedItems[0]);
if (!newItem.abstractNote && res.abstract) { if (!newItem.abstractNote && res.abstract) {
newItem.setField('abstractNote', res.abstract); newItem.setField('abstractNote', res.abstract);