Maybe fix "constraint failed" sync error in collection.js

This commit is contained in:
Dan Stillman 2011-03-30 00:38:14 +00:00
parent e9d69d80ee
commit 8da5e3bc09

View file

@ -534,6 +534,13 @@ Zotero.Collection.prototype.save = function () {
}
if (newids.length) {
// TEMP: Remove duplicates, which shouldn't be necessary
var len1 = newids.length;
newids = Zotero.Utilities.arrayUnique(newids);
if (len1 != newids.length) {
Zotero.debug("newids was not unique in Zotero.Collection.save()", 2);
}
var sql = "SELECT IFNULL(MAX(orderIndex)+1, 0) "
+ "FROM collectionItems WHERE collectionID=?"
var orderStatement = Zotero.DB.getStatement(sql);