Miscellaneous tweaks

This commit is contained in:
Dan Stillman 2015-05-04 02:39:12 -04:00
parent e96f091754
commit 53e40bb0f4
2 changed files with 5 additions and 6 deletions

View File

@ -783,7 +783,7 @@ Zotero.Item.prototype.setField = function(field, value, loadIn) {
var fieldID = Zotero.ItemFields.getID(field); var fieldID = Zotero.ItemFields.getID(field);
if (!fieldID) { 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 if (loadIn && this.isNote() && field == 110) { // title
@ -1230,7 +1230,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
sqlColumns.unshift('itemID'); sqlColumns.unshift('itemID');
sqlValues.unshift(parseInt(itemID)); sqlValues.unshift(parseInt(itemID));
var sql = "INSERT INTO items (" + sqlColumns.join(", ") + ") " let sql = "INSERT INTO items (" + sqlColumns.join(", ") + ") "
+ "VALUES (" + sqlValues.map(function () "?").join() + ")"; + "VALUES (" + sqlValues.map(function () "?").join() + ")";
var insertID = yield Zotero.DB.queryAsync(sql, sqlValues); var insertID = yield Zotero.DB.queryAsync(sql, sqlValues);
if (!itemID) { if (!itemID) {
@ -1242,7 +1242,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
} }
} }
else { else {
var sql = "UPDATE items SET " + sqlColumns.join("=?, ") + "=? WHERE itemID=?"; let sql = "UPDATE items SET " + sqlColumns.join("=?, ") + "=? WHERE itemID=?";
sqlValues.push(parseInt(itemID)); sqlValues.push(parseInt(itemID));
yield Zotero.DB.queryAsync(sql, sqlValues); 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 oldParentKey = this._previousData.parentKey;
let oldParentItemID;
if (oldParentKey) { if (oldParentKey) {
let oldParentItemID = this.ObjectsClass.getIDFromLibraryAndKey(this.libraryID, oldParentKey); oldParentItemID = this.ObjectsClass.getIDFromLibraryAndKey(this.libraryID, oldParentKey);
if (oldParentItemID) { if (oldParentItemID) {
let oldParentItemNotifierData = {}; let oldParentItemNotifierData = {};
//oldParentItemNotifierData[oldParentItemID] = {}; //oldParentItemNotifierData[oldParentItemID] = {};

View File

@ -653,8 +653,6 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable
// haven't already been found by the main search // haven't already been found by the main search
if (joinMode == 'any') { if (joinMode == 'any') {
if (!tmpTable) { if (!tmpTable) {
Zotero.debug('=');
Zotero.debug(ids);
tmpTable = yield Zotero.Search.idsToTempTable(ids); tmpTable = yield Zotero.Search.idsToTempTable(ids);
} }