From 468cd16534fb78e379706e9c1d109f43b6803dc1 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 16 Mar 2009 07:09:30 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20error:=20"[QUERY:=20DELETE=20FROM=20creat?= =?UTF-8?q?orData=20WHERE=20creatorDataID=3D=3F]=20[ERROR:=20constraint=20?= =?UTF-8?q?failed]"?= --- chrome/content/zotero/xpcom/data/creator.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/creator.js b/chrome/content/zotero/xpcom/data/creator.js index d61a65566..f9756c5e0 100644 --- a/chrome/content/zotero/xpcom/data/creator.js +++ b/chrome/content/zotero/xpcom/data/creator.js @@ -212,10 +212,10 @@ Zotero.Creator.prototype.save = function () { var creatorDataID = this.creatorDataID; } // Existing data row with the new data -- switch to that - // and delete old row + // and flag old row for deletion below else if (newCreatorDataID) { + var deleteDataID = this.creatorDataID; var creatorDataID = newCreatorDataID; - Zotero.Creators.deleteData(this.creatorDataID); } // Update current data row with new data else { @@ -249,6 +249,10 @@ Zotero.Creator.prototype.save = function () { creatorID = insertID; } + if (deleteDataID) { + Zotero.Creators.deleteData(deleteDataID); + } + if (this.id) { Zotero.debug("Updating linked items"); this.updateLinkedItems();