Don't unload object on save error if not new
This commit is contained in:
parent
79a07cad9e
commit
76bc61e882
1 changed files with 10 additions and 8 deletions
|
@ -909,14 +909,16 @@ Zotero.DataObject.prototype._initSave = Zotero.Promise.coroutine(function* (env)
|
|||
}
|
||||
|
||||
// Undo registerObject() on failure
|
||||
var func = function () {
|
||||
this.ObjectsClass.unload(this._id);
|
||||
}.bind(this);
|
||||
if (env.options.tx) {
|
||||
env.transactionOptions.onRollback = func;
|
||||
}
|
||||
else {
|
||||
Zotero.DB.addCurrentCallback("rollback", func);
|
||||
if (env.isNew) {
|
||||
var func = function () {
|
||||
this.ObjectsClass.unload(this._id);
|
||||
}.bind(this);
|
||||
if (env.options.tx) {
|
||||
env.transactionOptions.onRollback = func;
|
||||
}
|
||||
else {
|
||||
Zotero.DB.addCurrentCallback("rollback", func);
|
||||
}
|
||||
}
|
||||
|
||||
env.relationsToRegister = [];
|
||||
|
|
Loading…
Reference in a new issue