diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index 2a6a0f8478..8fdf7a96ef 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -419,15 +419,6 @@ var Zotero_QuickFormat = new function () { // necessary data var items = yield Zotero.Items.getAsync(searchResultIDs); yield Zotero.Items.loadDataTypes(items); - // Load child items of search matches - // TODO: exclude child items from itemToExportFormat() so this isn't necessary? - for (let item of items) { - let ids = item.getAttachments().concat(item.getNotes()); - if (ids.length) { - let childItems = yield Zotero.Items.getAsync(ids); - yield Zotero.Items.loadDataTypes(childItems) - } - } searchString = searchString.toLowerCase(); var collation = Zotero.getLocaleCollation(); diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 15de41d3d4..c6c5c126ed 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1613,9 +1613,11 @@ Zotero.Utilities = { * is passed */ "itemToCSLJSON":function(zoteroItem) { + // If a Zotero.Item was passed, convert it to the proper format (skipping child items) and + // call this function again with that object if (zoteroItem instanceof Zotero.Item) { return this.itemToCSLJSON( - Zotero.Utilities.Internal.itemToExportFormat(zoteroItem) + Zotero.Utilities.Internal.itemToExportFormat(zoteroItem, false, true) ); } diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index 2054fb7587..5770ff9c0f 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -765,7 +765,7 @@ Zotero.Utilities.Internal = { * @param {Boolean} legacy Add mappings for legacy (pre-4.0.27) translators * @return {Object} */ - itemToExportFormat: function (zoteroItem, legacy) { + itemToExportFormat: function (zoteroItem, legacy, skipChildItems) { function addCompatibilityMappings(item, zoteroItem) { item.uniqueFields = {}; @@ -862,7 +862,7 @@ Zotero.Utilities.Internal = { item.uri = Zotero.URI.getItemURI(zoteroItem); delete item.key; - if (!zoteroItem.isAttachment() && !zoteroItem.isNote()) { + if (!skipChildItems && !zoteroItem.isAttachment() && !zoteroItem.isNote()) { // Include attachments item.attachments = []; let attachments = zoteroItem.getAttachments();