From ddca12ba26a43cfaca25fbb172a14261a09b8dcd Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 22 Jul 2011 22:41:42 +0000 Subject: [PATCH] Match only books by ISBN, since book sections shouldn't be merged --- chrome/content/zotero/xpcom/duplicates.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/duplicates.js b/chrome/content/zotero/xpcom/duplicates.js index fccc30c6d..64be83b34 100644 --- a/chrome/content/zotero/xpcom/duplicates.js +++ b/chrome/content/zotero/xpcom/duplicates.js @@ -180,8 +180,24 @@ Zotero.Duplicates.prototype._findDuplicates = function () { return a == b ? 1 : -1; }); + // Match books by ISBN + var sql = "SELECT itemID, value FROM items JOIN itemData USING (itemID) " + + "JOIN itemDataValues USING (valueID) " + + "WHERE libraryID=? AND itemTypeID=? AND fieldID=? " + + "AND itemID NOT IN (SELECT itemID FROM deletedItems) " + + "ORDER BY value"; + var rows = Zotero.DB.query( + sql, + [ + this._libraryID, + Zotero.ItemTypes.getID('book'), + Zotero.ItemFields.getID('ISBN') + ] + ); + processRows(); + // Match on exact fields - var fields = ['DOI', 'ISBN']; + var fields = ['DOI']; for each(var field in fields) { var sql = "SELECT itemID, value FROM items JOIN itemData USING (itemID) " + "JOIN itemDataValues USING (valueID) "