commit 468cd16534fb78e379706e9c1d109f43b6803dc1
parent 4e7dfbad42852113bba925578403ca0c1b04d2ff
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 16 Mar 2009 07:09:30 +0000
Fix error: "[QUERY: DELETE FROM creatorData WHERE creatorDataID=?] [ERROR: constraint failed]"
Diffstat:
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
@@ -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();