Log warning if key not passed to getByLibraryAndKey()
This commit is contained in:
parent
531170353b
commit
dc11b37ced
|
@ -329,9 +329,10 @@ Zotero.DataObjects.prototype.getLibraryAndKeyFromID = function (id) {
|
||||||
|
|
||||||
|
|
||||||
Zotero.DataObjects.prototype.getIDFromLibraryAndKey = function (libraryID, key) {
|
Zotero.DataObjects.prototype.getIDFromLibraryAndKey = function (libraryID, key) {
|
||||||
if (!libraryID) {
|
if (!libraryID) throw new Error("Library ID not provided");
|
||||||
throw new Error("libraryID not provided");
|
// TEMP: Just warn for now
|
||||||
}
|
//if (!key) throw new Error("Key not provided");
|
||||||
|
if (!key) Zotero.logError("Key not provided");
|
||||||
return (this._objectIDs[libraryID] && this._objectIDs[libraryID][key])
|
return (this._objectIDs[libraryID] && this._objectIDs[libraryID][key])
|
||||||
? this._objectIDs[libraryID][key] : false;
|
? this._objectIDs[libraryID][key] : false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1373,7 +1373,9 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
|
||||||
|
|
||||||
// Parent item (DB update is done below after collection removals)
|
// Parent item (DB update is done below after collection removals)
|
||||||
var parentItemKey = this.parentKey;
|
var parentItemKey = this.parentKey;
|
||||||
var parentItemID = this.ObjectsClass.getIDFromLibraryAndKey(this.libraryID, parentItemKey) || null;
|
var parentItemID = parentItemKey
|
||||||
|
? (this.ObjectsClass.getIDFromLibraryAndKey(this.libraryID, parentItemKey) || null)
|
||||||
|
: null;
|
||||||
if (this._changed.parentKey) {
|
if (this._changed.parentKey) {
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
if (!parentItemID) {
|
if (!parentItemID) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user