From d421f2587873ce55a0494cbd90876ea7cc7e6741 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 4 Nov 2009 06:25:56 +0000 Subject: [PATCH] - Fix "itemID 'undefined' not an integer in Zotero.Item.addRelatedItem()" sync error - Allow last remote sync times to be decimals --- chrome/content/zotero/xpcom/sync.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index f10b05372f..c81b62e251 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -1025,7 +1025,7 @@ Zotero.Sync.Server = new function () { return Zotero.DB.valueQuery("SELECT version FROM version WHERE schema='lastremotesync'"); }); this.__defineSetter__("lastRemoteSyncTime", function (val) { - Zotero.DB.query("REPLACE INTO version VALUES ('lastremotesync', ?)", { int: val }); + Zotero.DB.query("REPLACE INTO version VALUES ('lastremotesync', ?)", val); }); this.__defineGetter__("lastLocalSyncTime", function () { return Zotero.DB.valueQuery("SELECT version FROM version WHERE schema='lastlocalsync'"); @@ -2739,6 +2739,12 @@ Zotero.Sync.Server.Data = new function() { var item = Zotero.Items.getByLibraryAndKey(lk.libraryID, lk.key); for each(var relKey in relatedItemsStore[libraryKeyHash]) { var relItem = Zotero.Items.getByLibraryAndKey(lk.libraryID, relKey); + if (!relItem) { + var msg = "Related item doesn't exist in Zotero.Sync.Server.Data.processUpdatedXML() " + + "(" + lk.libraryID + "/" + relKey + ")"; + var e = new Zotero.Error(msg, "MISSING_OBJECT"); + throw (e); + } item.addRelatedItem(relItem.id); } item.save();