diff --git a/chrome/content/zotero/duplicatesMerge.js b/chrome/content/zotero/duplicatesMerge.js index 8dc7868f54..232c79f1ee 100644 --- a/chrome/content/zotero/duplicatesMerge.js +++ b/chrome/content/zotero/duplicatesMerge.js @@ -147,10 +147,6 @@ var Zotero_Duplicates_Pane = new function () { this.merge = function () { var itembox = document.getElementById('zotero-duplicates-merge-item-box'); - // Work around item.clone() weirdness -- the cloned item can't safely be - // used after it's saved, because it's not the version in memory and - // doesn't get reloaded properly in item.save() - var item = Zotero.Items.get(itembox.item.id); - Zotero.Items.merge(item, _otherItems); + Zotero.Items.merge(itembox.item, _otherItems); } } diff --git a/chrome/content/zotero/xpcom/data/items.js b/chrome/content/zotero/xpcom/data/items.js index a26f814b6c..29c9e29797 100644 --- a/chrome/content/zotero/xpcom/data/items.js +++ b/chrome/content/zotero/xpcom/data/items.js @@ -413,13 +413,12 @@ Zotero.Items = new function() { for each(var relatedItemID in relatedItems) { item.addRelatedItem(relatedItemID); } - item.save(); // Relations Zotero.Relations.copyURIs( item.libraryID, - Zotero.URI.getItemURI(item), - Zotero.URI.getItemURI(otherItem) + Zotero.URI.getItemURI(otherItem), + Zotero.URI.getItemURI(item) ); // Add relation to track merge @@ -431,6 +430,8 @@ Zotero.Items = new function() { otherItem.save(); } + item.save(); + Zotero.DB.commitTransaction(); }