commit b75376c1c17715a3299ce033ad0a90ae3fdcc3fe
parent 965f4c3c0a5845d4de3e3491fe3ace355c616724
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 28 Jun 2006 15:47:58 +0000
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
Diffstat:
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
@@ -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;
}
}