www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 3c70dee5c182c2871d919288f68d998cae74b6cb
parent 337144a5eb057abb099f8e888c84ae8c67989fcb
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri,  8 Jun 2018 05:57:20 -0400

Create import collection by default if there are non-trash items

Follow-up to 7494e4d88ca, which only checked for collections

Diffstat:
Mchrome/content/zotero/import/importWizard.js | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/import/importWizard.js b/chrome/content/zotero/import/importWizard.js @@ -13,10 +13,19 @@ var Zotero_Import_Wizard = { document.getElementById('radio-import-source-mendeley').hidden = false; } - // If no existing collections in the library, don't create a new collection by default + // If no existing collections or non-trash items in the library, don't create a new + // collection by default var args = window.arguments[0].wrappedJSObject; if (args && args.libraryID) { - let sql = "SELECT ROWID FROM collections WHERE libraryID=? LIMIT 1"; + let sql = "SELECT ROWID FROM collections WHERE libraryID=?1 " + + "UNION " + + "SELECT ROWID FROM items WHERE libraryID=?1 " + // Not in trash + + "AND itemID NOT IN (SELECT itemID FROM deletedItems) " + // And not a child item (which doesn't necessarily show up in the trash) + + "AND itemID NOT IN (SELECT itemID FROM itemNotes WHERE parentItemID IS NOT NULL) " + + "AND itemID NOT IN (SELECT itemID FROM itemAttachments WHERE parentItemID IS NOT NULL) " + + "LIMIT 1"; if (!await Zotero.DB.valueQueryAsync(sql, args.libraryID)) { document.getElementById('create-collection-checkbox').removeAttribute('checked'); }