https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43217
--- Comment #1 from Olivia Reynolds <[email protected]> --- Created attachment 203805 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203805&action=edit Bug 43217: Support editing items in BatchUpdateBiblio This patch adds support for editing existing items attached to a biblio using batch modification templates. If a template references an item field, the biblio record has its items embedded so they can be accessed and updated by the template. After the template has run, any item records with itemnumbers are used to update the corresponding item. The item fields without itemnumbers are merged together (a limitation of the template actions is that each newly added subfield is placed in a new field) and added as a new item. The number of created and updated items is reported for each biblio processed during the batch job. Similar functionality is added to the preview, so that the item fields appear embedded and merged there as well. Deleting an item through batch modification is still not possible: the template can make the change in the modified MARC record but this will not be reflected by actually deleting an item. As batch modification requires a bespoke "records_batchmod" permission, I haven't gated the item addition/modification any further. Test plan: 1. Apply patch. 2. Identify a biblio with one already extant item. On KTD, you can use http://localhost:8081/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=262 3. Under Cataloging > MARC modification templates, create a new template with the following actions, in order: - Add new field 952$a with value "CPL" - Add new field 952$b with value "CPL" - Add new field 952$p with value "new item" - Add new field 952$y with value "BK" - Update existing or add new field 952$e with value "test" If your Koha is not configured for MARC21, you may need to replace 952 with 995 in the above actions. 4. Navigate to Cataloging > Batch record modification, and prepare to apply the template created earlier to the biblio selected earlier. 5. Preview the MARC for the biblio after the modification. 6. Verify there are two item fields, one for the existing item and one for a new one. 7. Verify the new item field has its $a, $b, $p, and $y set as in the template actions. 8. Verify the old item has its $e set to the new value "test". 9. Verify the new item has its $e set to the new value "test". This value will be repeated multiple times - this is due to each "Add new field" creating a separate item field, which then each have $e set in them, before they are finally merged. 10. Run the batch job, and visit its details page. 11. Verify the job completes successfully, and displays "1 item created." and "1 item updated.". 12. Visit the biblio's items and verify they match the MARC preview. 13. Create a new batch modification template with the following action: - Delete field 952$a As before, you may need to alter the item field number depending on your MARC version. 14. Prepare to apply this new template to the same biblio. 15. Verify the MARC preview shows two item fields, both with $a removed. 16. Run the batch job, and visit its details page. 17. Verify the job failed with "An error occurred on modifying it. (No homebranch subfield found).". 18. Prove t/db_dependent/Koha/BackgroundJob/BatchUpdateBiblio.t and verify all of the tests pass. Sponsored-by: Open Fifth -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
