Description
Emily Lamancusa (emlam)
2023-07-07 20:47:22 UTC
*** This bug has been marked as a duplicate of bug 34232 *** This is not exactly a duplicate of 34232 - it's the same problem, but in a different place. Created attachment 158148 [details] [review] Bug 34234: Add template plugin for listing and sorting ItemGroups This patch adds a template plugin to handle the retreiving and sorting of ItemGroups. 1. EnableItemGroups 2. Find a record and add some new item groups with display orders that are different from the order in which the groups were added 3. Check the checkbox next to one or more items and click the link to "Add/move to item group" 4. Notice that the values in the dropdown do not respect the display order. 5. Apply patch, restart all 6. Check again, sorting should be correct. I'm leaving this here to see what people think. This adds a template plugin for ItemGroups. If liked we can apply this elsewhere in Koha where we display item groups. Not sure if a template plugin is better than trying to retrieve the item groups from /api/v1/biblios/{biblionumber}/item_groups Created attachment 158294 [details] [review] Bug 34234: Add sub for count and logic to additem page To Test: 1. EnableItemGroups 2. Find a record and add some new item groups with different display orders 3. Now edit an item on the record and scroll down to the dropdown underneath "+ Add to item group" 4. Notice that the values in the dropdown do not respect the display order. 5. Apply patch and restart_all 6. The display order should now be respected Created attachment 158328 [details] [review] Bug 34234: Add template plugin for listing and sorting ItemGroups This patch adds a template plugin to handle the retreiving and sorting of ItemGroups. 1. EnableItemGroups 2. Find a record and add some new item groups with display orders that are different from the order in which the groups were added 3. Check the checkbox next to one or more items and click the link to "Add/move to item group" 4. Notice that the values in the dropdown do not respect the display order. 5. Apply patch, restart all 6. Check again, sorting should be correct. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Created attachment 158329 [details] [review] Bug 34234: Add sub for count and logic to additem page To Test: 1. EnableItemGroups 2. Find a record and add some new item groups with different display orders 3. Now edit an item on the record and scroll down to the dropdown underneath "+ Add to item group" 4. Notice that the values in the dropdown do not respect the display order. 5. Apply patch and restart_all 6. The display order should now be respected Signed-off-by: Owen Leonard <oleonard@myacpl.org> Can we please get some unit tests for the new module? Koha/Template/Plugin/ItemGroups.pm Created attachment 160442 [details] [review] Bug 34234: add a unit test Created attachment 160542 [details] [review] Bug 34234: add a unit test Created attachment 160543 [details] [review] Bug 34234: add a unit test Why using TT template? Replace [% FOREACH ig IN biblio.item_groups %] With [% FOREACH ig IN biblio.item_groups.search({}, {order_by => 'display_order'}) %] And you are done. I really don't understand the need of a TT plugin for that purpose. You could suggest a Koha::Biblio::ItemGroups->search_ordered method however. Created attachment 160992 [details] [review] Bug 34234: Respect display_order in additem.tt and detail.tt 1. APPLY PATCH 2. EnableItemGroups 3. Find a record and add some new item groups with display orders that are different from the order in which the groups were added 4. Check the checkbox next to one or more items and click the link to "Add/move to item group" 5. Ensure display order is correct 6. Now add a new item to the record and scroll down to the dropdown underneath "+ Add to item group" 7. Display order should be correct. New patchset, back to NSO. Created attachment 161019 [details] [review] Bug 34234: Respect display_order in additem.tt and detail.tt 1. APPLY PATCH 2. EnableItemGroups 3. Find a record and add some new item groups with display orders that are different from the order in which the groups were added 4. Check the checkbox next to one or more items and click the link to "Add/move to item group" 5. Ensure display order is correct 6. Now add a new item to the record and scroll down to the dropdown underneath "+ Add to item group" 7. Display order should be correct. Signed-off-by: David Nind <david@davidnind.com> Created attachment 161760 [details] [review] Bug 34234: Respect display_order in additem.tt and detail.tt 1. APPLY PATCH 2. EnableItemGroups 3. Find a record and add some new item groups with display orders that are different from the order in which the groups were added 4. Check the checkbox next to one or more items and click the link to "Add/move to item group" 5. Ensure display order is correct 6. Now add a new item to the record and scroll down to the dropdown underneath "+ Add to item group" 7. Display order should be correct. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Works, makes sense, QA script happy, code looks good, passing QA :) For some reason the add item form was already respecting the order (was not luck, changing the order was reflected). Still good to have this set in stone. Pushed for 24.05! Well done everyone, thank you! Maybe we should move this order by inside Koha::Biblio::item_groups Pushed to 23.11.x for 23.11.04 Backported to 23.05.x for upcoming 23.05.10 |