- Fix "itemID 'undefined' not an integer in Zotero.Item.addRelatedItem()" sync error

- Allow last remote sync times to be decimals
This commit is contained in:
Dan Stillman 2009-11-04 06:25:56 +00:00
parent b921d5ac31
commit d421f25878

View file

@ -1025,7 +1025,7 @@ Zotero.Sync.Server = new function () {
return Zotero.DB.valueQuery("SELECT version FROM version WHERE schema='lastremotesync'"); return Zotero.DB.valueQuery("SELECT version FROM version WHERE schema='lastremotesync'");
}); });
this.__defineSetter__("lastRemoteSyncTime", function (val) { 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 () { this.__defineGetter__("lastLocalSyncTime", function () {
return Zotero.DB.valueQuery("SELECT version FROM version WHERE schema='lastlocalsync'"); 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); var item = Zotero.Items.getByLibraryAndKey(lk.libraryID, lk.key);
for each(var relKey in relatedItemsStore[libraryKeyHash]) { for each(var relKey in relatedItemsStore[libraryKeyHash]) {
var relItem = Zotero.Items.getByLibraryAndKey(lk.libraryID, relKey); 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.addRelatedItem(relItem.id);
} }
item.save(); item.save();