From ba5b978afbf473329437c77c8c01fc8cc7f40cac Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 6 Oct 2006 00:12:47 +0000 Subject: [PATCH] Quick fix for note saving problem from Roy --- chrome/content/zotero/xpcom/data_access.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js index 825cf31f9..63ad8dbca 100644 --- a/chrome/content/zotero/xpcom/data_access.js +++ b/chrome/content/zotero/xpcom/data_access.js @@ -907,12 +907,24 @@ Zotero.Item.prototype.updateNote = function(text){ Zotero.DB.beginTransaction(); if (this.isNote()){ - var sql = "UPDATE itemNotes SET note=? WHERE itemID=?"; + var sourceID = this.getSource(); + if (sourceID) + { + var sql = "REPLACE INTO itemNotes (note, sourceItemID, itemID) " + + "VALUES (?,?,?)"; + var bindParams = [{string:text}, sourceID, this.getID()]; + } + else + { + var sql = "REPLACE INTO itemNotes (note, itemID) VALUES (?,?)"; + var bindParams = [{string:text}, this.getID()]; + } } else { var sql = "REPLACE INTO itemNotes (note, itemID) VALUES (?,?)"; + var bindParams = [{string:text}, this.getID()]; } - var bindParams = [{string:text}, this.getID()]; + var updated = Zotero.DB.query(sql, bindParams); if (updated){ this.updateDateModified();