Store inter-group linked-item relations with target, not source, library
User may not have write access to source library
This commit is contained in:
parent
d76a395a38
commit
05fef08a63
|
@ -1251,7 +1251,7 @@ Zotero.Attachments = new function(){
|
|||
Zotero.File.copyDirectory(dir, newDir);
|
||||
}
|
||||
|
||||
attachment.addLinkedItem(newAttachment);
|
||||
newAttachment.addLinkedItem(attachment);
|
||||
return newAttachment.id;
|
||||
}
|
||||
|
||||
|
|
|
@ -1429,7 +1429,7 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient)
|
|||
//var newItem = Zotero.Items.get(id);
|
||||
|
||||
// Record link
|
||||
item.addLinkedItem(newItem);
|
||||
newItem.addLinkedItem(item);
|
||||
var newID = id;
|
||||
|
||||
if (item.isNote()) {
|
||||
|
@ -1452,7 +1452,7 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient)
|
|||
newNote.setSource(newItem.id);
|
||||
newNote.save();
|
||||
|
||||
note.addLinkedItem(newNote);
|
||||
newNote.addLinkedItem(note);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4006,9 +4006,10 @@ Zotero.Item.prototype.addLinkedItem = function (item) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// If both group libraries, store relation with source group.
|
||||
// Otherwise, store with personal library.
|
||||
var libraryID = (this.libraryID && item.libraryID) ? this.libraryID : null;
|
||||
// If one of the items is a personal library, store relation with that.
|
||||
// Otherwise, use current item's library (which in calling code is the
|
||||
// new, copied item).
|
||||
var libraryID = (!this.libraryID || !item.libraryID) ? null : this.libraryID;
|
||||
|
||||
Zotero.Relations.add(libraryID, url1, predicate, url2);
|
||||
}
|
||||
|
|
|
@ -158,6 +158,8 @@ Zotero.Relation.prototype.save = function () {
|
|||
throw ("Missing object in Zotero.Relation.save()");
|
||||
}
|
||||
|
||||
Zotero.Relations.editCheck(this);
|
||||
|
||||
var sql = "INSERT INTO relations "
|
||||
+ "(libraryID, subject, predicate, object, clientDateModified) "
|
||||
+ "VALUES (?, ?, ?, ?, ?)";
|
||||
|
|
Loading…
Reference in New Issue
Block a user