Fix FK constraint error with tags, often after the tag conflict window

This commit is contained in:
Dan Stillman 2009-02-21 22:13:57 +00:00
parent 03826c4254
commit 4d1081be1a

View file

@ -221,11 +221,11 @@ Zotero.Tag.prototype.save = function (full) {
} }
if (this.type != 0 && this.type != 1) { if (this.type != 0 && this.type != 1) {
throw ('Invalid tag type ' + this.type + ' in Zotero.Tag.save()'); throw ('Invalid tag type ' + this.type + ' for tag ' + this.id + ' in Zotero.Tag.save()');
} }
if (!this.name) { if (!this.name) {
throw ('Tag name is empty in Zotero.Tag.save()'); throw ('Tag ' + this.id + ' name is empty in Zotero.Tag.save()');
} }
if (!this._changed) { if (!this._changed) {
@ -590,7 +590,9 @@ Zotero.Tag.prototype._setLinkedItems = function (itemIDs) {
if (currentIDs.indexOf(id) != -1) { if (currentIDs.indexOf(id) != -1) {
Zotero.debug("Item " + itemIDs[i] Zotero.debug("Item " + itemIDs[i]
+ " is already linked to tag " + this.id); + " is already linked to tag " + this.id);
if (oldIDs.indexOf(id) == -1) {
oldIDs.push(id); oldIDs.push(id);
}
continue; continue;
} }