From fd1ac3104a4ad3ba5d0087c5ef6d86f36c3b0ef8 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 12 Feb 2009 08:00:29 +0000 Subject: [PATCH] - Fix "creator.serialize() is not a function" sync error - Added Zotero.Utilities.isEmpty(obj) --- chrome/content/zotero/xpcom/sync.js | 4 +++- chrome/content/zotero/xpcom/utilities.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index 320e97164..ff47d1879 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -2452,7 +2452,9 @@ Zotero.Sync.Server.Data = new function() { }; if (type == 'item') { - io.dataIn.changedCreators = changedCreators; + if (!Zotero.Utilities.prototype.isEmpty(changedCreators)) { + io.dataIn.changedCreators = changedCreators; + } } var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 3e84aa499..a966e32aa 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -291,6 +291,20 @@ Zotero.Utilities.prototype.isInt = function(x) { } + +/** + * Test if an object is empty + * + * @param {Object} + */ +Zotero.Utilities.prototype.isEmpty = function (obj) { + for (var i in obj) { + return false; + } + return true; +} + + /** * Compares an array with another and returns an array with * the values from array2 that don't exist in array1