Fixes #520, deleting items from smart collections/search fails under certain circumstances

Simon, reopen if this doesn't fix the problem you were referring to.

(Also removes Notifier.enable()/disable() from its use in Item.erase() while we're at it.)
This commit is contained in:
Dan Stillman 2007-01-30 06:16:03 +00:00
parent b3588e6b75
commit 56a0863a9d

View File

@ -1868,19 +1868,9 @@ Zotero.Item.prototype.erase = function(deleteChildren){
// Remove item from parent collections
var parentCollectionIDs = this.getCollections();
if (parentCollectionIDs){
var notifierState = Zotero.Notifier.isEnabled();
Zotero.Notifier.disable();
for (var i=0; i<parentCollectionIDs.length; i++){
Zotero.Collections.get(parentCollectionIDs[i]).removeItem(this.getID());
}
if (notifierState){
Zotero.Notifier.enable();
}
else {
Zotero.Notifier.disable();
}
}
// Note
@ -2373,7 +2363,7 @@ Zotero.Items = new function(){
var item = this.get(id);
if (!item) {
Zotero.debug('Item ' + id + ' does not exist in Items.erase()!', 1);
Zotero.Notifier.trigger('item', 'delete', id);
Zotero.Notifier.trigger('delete', 'item', id);
continue;
}
item.erase(eraseChildren); // calls unload()