Child items of deleted items appeared in gray (i.e., not deleted) in Trash

This commit is contained in:
Dan Stillman 2009-11-28 05:04:24 +00:00
parent 3e7f1f0608
commit 99d19f35f7

View file

@ -1004,9 +1004,19 @@ Zotero.Search.prototype._buildQuery = function(){
}
}
// Exclude deleted items by default
// Exclude deleted items (and their child items) by default
sql += " WHERE itemID " + (deleted ? "" : "NOT ") + "IN "
+ "(SELECT itemID FROM deletedItems)";
+ "("
+ "SELECT itemID FROM deletedItems "
+ "UNION "
+ "SELECT itemID FROM itemNotes "
+ "WHERE sourceItemID IS NOT NULL AND "
+ "sourceItemID IN (SELECT itemID FROM deletedItems) "
+ "UNION "
+ "SELECT itemID FROM itemAttachments "
+ "WHERE sourceItemID IS NOT NULL AND "
+ "sourceItemID IN (SELECT itemID FROM deletedItems) "
+ ")";
if (noChildren){
sql += " AND (itemID NOT IN (SELECT itemID FROM itemNotes "