wshanks / Zutilo

Zotero plugin providing some additional editing features
Other
1.52k stars 71 forks source link

Batch edit 'item type' ? #162

Closed floriandierickx closed 3 years ago

floriandierickx commented 3 years ago

Hello, I hope I didn't look over it, but after a scan of the documentation and context menu items, I don't seem to find a way to batch edit/change item types (book, article, document, etc..) of zotero items. Does this feature exist or is there a way to accomplish this using Zutilo? From my understanding of the book <-> book section feature Zutilo should be able to accomplish this.. ?

Regardless of the above, thanks a lot for having made batch edit of item fields possible. I stumbled upon this future recently and I love it!

wshanks commented 3 years ago

You are right that that is not currently possible. I think it would be best as a new function, though item type could possibly be treated as a special field in the copy/paste fields functions.

qqobb commented 3 years ago

It's possible to batch edit item types through Zotero's JavaScript API as explained in this discussion. However, keep in mind that the values of fields that are invalid for the new type will be lost, see here.

qqobb commented 3 years ago

I created pull request #166 which adds batch editing of item types to the existing copy/paste functions. With this, using "Paste all item fields" will change item types if there's a single name-value pair in the JSON string, e.g., {"itemType": "book"}.

One could also consider new functions, "copy item type" and "paste item type". However, some of the Paste-all use cases already require editing the JSON text. So, rather than adding new functions, updating the Paste-all documentation (https://github.com/wshanks/Zutilo/issues/142) seems appropriate.

floriandierickx commented 3 years ago

Wonderful, thanks for the explanation and consideration of the feature! I recently discovered these very helpful features of Zutilo, and this would be the 'cherry on the cake' :)) For example: in the sense of creating a 'dummy reference' that contains the item type and other common field values, and copy pasting this to a batch of references (after doing 'create parent items') for a bulk update.

qqobb commented 3 years ago

creating a 'dummy reference' that contains the item type and other common field values, and copy pasting this to a batch of references

This would require two steps with the proposed changes. Changing item types would always be separate from editing item fields.

Pull request #167 updates the documentation for Paste-all.