From 53e40bb0f4d934e9bd7e8daef9c4e9f35fa3adc5 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 4 May 2015 02:39:12 -0400 Subject: [PATCH] Miscellaneous tweaks --- chrome/content/zotero/xpcom/data/item.js | 9 +++++---- chrome/content/zotero/xpcom/search.js | 2 -- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index b2bc96a0e9..41e73a852f 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -783,7 +783,7 @@ Zotero.Item.prototype.setField = function(field, value, loadIn) { var fieldID = Zotero.ItemFields.getID(field); if (!fieldID) { - throw ('"' + field + '" is not a valid itemData field.'); + throw new Error('"' + field + '" is not a valid itemData field'); } if (loadIn && this.isNote() && field == 110) { // title @@ -1230,7 +1230,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { sqlColumns.unshift('itemID'); sqlValues.unshift(parseInt(itemID)); - var sql = "INSERT INTO items (" + sqlColumns.join(", ") + ") " + let sql = "INSERT INTO items (" + sqlColumns.join(", ") + ") " + "VALUES (" + sqlValues.map(function () "?").join() + ")"; var insertID = yield Zotero.DB.queryAsync(sql, sqlValues); if (!itemID) { @@ -1242,7 +1242,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { } } else { - var sql = "UPDATE items SET " + sqlColumns.join("=?, ") + "=? WHERE itemID=?"; + let sql = "UPDATE items SET " + sqlColumns.join("=?, ") + "=? WHERE itemID=?"; sqlValues.push(parseInt(itemID)); yield Zotero.DB.queryAsync(sql, sqlValues); @@ -1380,8 +1380,9 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { } let oldParentKey = this._previousData.parentKey; + let oldParentItemID; if (oldParentKey) { - let oldParentItemID = this.ObjectsClass.getIDFromLibraryAndKey(this.libraryID, oldParentKey); + oldParentItemID = this.ObjectsClass.getIDFromLibraryAndKey(this.libraryID, oldParentKey); if (oldParentItemID) { let oldParentItemNotifierData = {}; //oldParentItemNotifierData[oldParentItemID] = {}; diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index be7cc2f038..6d7a52850a 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -653,8 +653,6 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable // haven't already been found by the main search if (joinMode == 'any') { if (!tmpTable) { - Zotero.debug('='); - Zotero.debug(ids); tmpTable = yield Zotero.Search.idsToTempTable(ids); }