Missed lines from 420985661
This commit is contained in:
parent
cc3d81da93
commit
b8d9504a4f
1 changed files with 14 additions and 2 deletions
|
@ -144,10 +144,16 @@ Zotero.DataObject.prototype._set = function (field, value) {
|
|||
Zotero.DataObject.prototype._setIdentifier = function (field, value) {
|
||||
switch (field) {
|
||||
case 'id':
|
||||
value = Zotero.DataObjectUtilities.checkDataID(value);
|
||||
if (this._id) {
|
||||
if (value === this._id) {
|
||||
return;
|
||||
}
|
||||
throw new Error("ID cannot be changed");
|
||||
}
|
||||
if (this._key) {
|
||||
throw new Error("Cannot set id if key is already set");
|
||||
}
|
||||
value = Zotero.DataObjectUtilities.checkDataID(value);
|
||||
break;
|
||||
|
||||
case 'libraryID':
|
||||
|
@ -158,10 +164,16 @@ Zotero.DataObject.prototype._setIdentifier = function (field, value) {
|
|||
if (this._libraryID === null) {
|
||||
throw new Error("libraryID must be set before key");
|
||||
}
|
||||
value = Zotero.DataObjectUtilities.checkKey(value);
|
||||
if (this._key) {
|
||||
if (value === this._key) {
|
||||
return;
|
||||
}
|
||||
throw new Error("Key cannot be changed");
|
||||
}
|
||||
if (this._id) {
|
||||
throw new Error("Cannot set key if id is already set");
|
||||
}
|
||||
value = Zotero.DataObjectUtilities.checkKey(value);
|
||||
}
|
||||
|
||||
if (value === this['_' + field]) {
|
||||
|
|
Loading…
Add table
Reference in a new issue