commit f4a8822ea70a21f24fd92098c0eb5225b3d60994
parent 6256d6fee88037b3d86a7c7ff5113d58488f308b
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 3 Oct 2008 19:33:59 +0000
Fix "constraint failed" error when trying to delete attachment with annotations/highlights
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
@@ -3218,7 +3218,9 @@ Zotero.Item.prototype.erase = function(deleteChildren) {
//Zotero.Fulltext.clearItemContent(this.id);
}
-
+
+ Zotero.DB.query('DELETE FROM annotations WHERE itemID=?', this.id);
+ Zotero.DB.query('DELETE FROM highlights WHERE itemID=?', this.id);
Zotero.DB.query('DELETE FROM itemCreators WHERE itemID=?', this.id);
Zotero.DB.query('DELETE FROM itemNotes WHERE itemID=?', this.id);
Zotero.DB.query('DELETE FROM itemAttachments WHERE itemID=?', this.id);
@@ -3227,8 +3229,6 @@ Zotero.Item.prototype.erase = function(deleteChildren) {
Zotero.DB.query('DELETE FROM itemTags WHERE itemID=?', this.id);
Zotero.DB.query('DELETE FROM itemData WHERE itemID=?', this.id);
Zotero.DB.query('DELETE FROM items WHERE itemID=?', this.id);
- Zotero.DB.query('DELETE FROM annotations WHERE itemID=?', this.id);
- Zotero.DB.query('DELETE FROM highlights WHERE itemID=?', this.id);
try {
Zotero.DB.commitTransaction();