Fix sync error downloading new item with related item
This commit is contained in:
parent
ce12c999ca
commit
e157d8bc57
1 changed files with 0 additions and 16 deletions
|
@ -1546,26 +1546,10 @@ Zotero.Item.prototype.save = function() {
|
|||
var newids = [];
|
||||
var currentIDs = this._getRelatedItems(true);
|
||||
|
||||
for each(var id in this._previousData.related) {
|
||||
if (currentIDs.indexOf(id) == -1) {
|
||||
removed.push(id);
|
||||
}
|
||||
}
|
||||
for each(var id in currentIDs) {
|
||||
if (this._previousData.related.indexOf(id) != -1) {
|
||||
continue;
|
||||
}
|
||||
newids.push(id);
|
||||
}
|
||||
|
||||
if (removed.length) {
|
||||
var sql = "DELETE FROM itemSeeAlso WHERE itemID=? "
|
||||
+ "AND linkedItemID IN ("
|
||||
+ removed.map(function () '?').join()
|
||||
+ ")";
|
||||
Zotero.DB.query(sql, [itemID].concat(removed));
|
||||
}
|
||||
|
||||
if (newids.length) {
|
||||
var sql = "INSERT INTO itemSeeAlso (itemID, linkedItemID) VALUES (?,?)";
|
||||
var insertStatement = Zotero.DB.getStatement(sql);
|
||||
|
|
Loading…
Add table
Reference in a new issue