Duplicate detection fixes:

- Fix saving of fields from other versions of an item
- Relations (e.g., cross-library links) were merged incorrectly
This commit is contained in:
Dan Stillman 2011-08-29 19:33:52 +00:00
parent 236901c1ad
commit 211da93be4
2 changed files with 5 additions and 8 deletions

View file

@ -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);
}
}

View file

@ -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();
}