Fix item duplication
This commit is contained in:
parent
828f3f5024
commit
bb3496dfa8
2 changed files with 4 additions and 10 deletions
|
@ -3737,6 +3737,7 @@ Zotero.Item.prototype.multiDiff = Zotero.Promise.coroutine(function* (otherItems
|
|||
*
|
||||
* @param {Number} [libraryID] - libraryID of the new item, or the same as original if omitted
|
||||
* @param {Boolean} [skipTags=false] - Skip tags
|
||||
* @return {Promise<Zotero.Item>}
|
||||
*/
|
||||
Zotero.Item.prototype.clone = Zotero.Promise.coroutine(function* (libraryID, skipTags) {
|
||||
Zotero.debug('Cloning item ' + this.id);
|
||||
|
|
|
@ -1548,19 +1548,12 @@ var ZoteroPane = new function()
|
|||
var item = self.getSelectedItems()[0];
|
||||
var newItem;
|
||||
|
||||
yield Zotero.DB.executeTransaction(function () {
|
||||
// Create new unsaved clone item in target library
|
||||
newItem = new Zotero.Item(item.itemTypeID);
|
||||
newItem.libraryID = item.libraryID;
|
||||
// DEBUG: save here because clone() doesn't currently work on unsaved tagged items
|
||||
var id = yield newItem.save();
|
||||
|
||||
var newItem = yield Zotero.Items.getAsync(id);
|
||||
yield item.clone(false, newItem, false, !Zotero.Prefs.get('groups.copyTags'));
|
||||
yield Zotero.DB.executeTransaction(function* () {
|
||||
newItem = yield item.clone(null, !Zotero.Prefs.get('groups.copyTags'));
|
||||
yield newItem.save();
|
||||
|
||||
if (self.collectionsView.selectedTreeRow.isCollection() && newItem.isTopLevelItem()) {
|
||||
self.collectionsView.selectedTreeRow.ref.addItem(newItem.id);
|
||||
yield self.collectionsView.selectedTreeRow.ref.addItem(newItem.id);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue