From b75376c1c17715a3299ce033ad0a90ae3fdcc3fe Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 28 Jun 2006 15:47:58 +0000 Subject: [PATCH] Fixes #96, When notify() is called for a new note, getNote() on the item returns false Item.save() changed to not call notify() if a transaction is in progress, which is totally going to trip someone up at some point, and probably me, but it's better than a new parameter --- .../chromeFiles/content/scholar/xpcom/data_access.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js index 77a7c3260..f99b7afcf 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/data_access.js +++ b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -364,6 +364,10 @@ Scholar.Item.prototype.setField = function(field, value, loadIn){ /* * Save changes back to database + * + * Note: Does not call notify() if transaction is in progress + * + * Returns true on item update or itemID of new item */ Scholar.Item.prototype.save = function(){ if (!this.hasChanged()){ @@ -739,11 +743,15 @@ Scholar.Item.prototype.save = function(){ Scholar.Items.reload(this.getID()); if (isNew){ - Scholar.Notifier.trigger('add', 'item', this.getID()); + if (!Scholar.DB.transactionInProgress()){ + Scholar.Notifier.trigger('add', 'item', this.getID()); + } return this.getID(); } else { - Scholar.Notifier.trigger('modify', 'item', this.getID()); + if (!Scholar.DB.transactionInProgress()){ + Scholar.Notifier.trigger('modify', 'item', this.getID()); + } return true; } }