diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 504028ff5f..d4394b5334 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -2320,10 +2320,13 @@ Zotero.Translate.Import.prototype._prepareTranslation = Zotero.Promise.method(fu } this._itemSaver = new Zotero.Translate.ItemSaver({ - "libraryID":this._libraryID, - "collections": this._collections, - "attachmentMode":Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")], - "baseURI":baseURI + libraryID: this._libraryID, + collections: this._collections, + attachmentMode: Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")], + baseURI, + saveOptions: { + skipSelect: true + } }); this.newItems = []; this.newCollections = []; diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index cfc6000641..44c86058ee 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -35,6 +35,7 @@ *
  • cookieSandbox - Cookie sandbox for attachment requests
  • *
  • proxy - A proxy to deproxify item URLs
  • *
  • baseURI - URI to which attachment paths should be relative
  • + *
  • saveOptions - Options to pass to DataObject::save() (e.g., skipSelect)
  • */ Zotero.Translate.ItemSaver = function(options) { // initialize constants @@ -66,6 +67,7 @@ Zotero.Translate.ItemSaver = function(options) { getService(Components.interfaces.nsIIOService).newURI(options.baseURI, null, null); } catch(e) {}; } + this._saveOptions = options.saveOptions || {}; }; Zotero.Translate.ItemSaver.ATTACHMENT_MODE_IGNORE = 0; @@ -126,7 +128,7 @@ Zotero.Translate.ItemSaver.prototype = { } // save item - myID = yield newItem.save(); + myID = yield newItem.save(this._saveOptions); // handle notes if (specialFields.notes) { @@ -195,9 +197,7 @@ Zotero.Translate.ItemSaver.prototype = { newCollection.parentID = rootCollectionID; topLevelCollections.push(newCollection) } - yield newCollection.save({ - skipSelect: true - }); + yield newCollection.save(this._saveOptions); var toAdd = []; @@ -307,7 +307,7 @@ Zotero.Translate.ItemSaver.prototype = { if (attachment.tags) newAttachment.setTags(this._cleanTags(attachment.tags)); if (attachment.note) newAttachment.setNote(attachment.note); this._handleRelated(attachment, newAttachment); - yield newAttachment.saveTx(); + yield newAttachment.saveTx(this._saveOptions); Zotero.debug("Translate: Created attachment; id is " + newAttachment.id, 4); attachmentCallback(attachment, 100); @@ -646,7 +646,7 @@ Zotero.Translate.ItemSaver.prototype = { if (!parentItemID && this._collections) { myNote.setCollections(this._collections); } - yield myNote.save(); + yield myNote.save(this._saveOptions); return myNote; }),