When trying to use the barcode filter of the bundled items table, the REST API returns an error 500 with the following message in logs: Unknown column 'me.barcode' in 'where clause' at /usr/share/perl5/Data/Page.pm line 49 The URL looks like this: /api/v1/items/3/bundled_items?&_page=1&_per_page=20&q=[{"me.external_id":{"like":"%1%"}}]&_match=contains If I manually remove "me." from the URL, it works.
Created attachment 161812 [details] [review] Bug 35963: Fix bundled items table ordering and filtering Using the many-to-many relationship results in the table alias `me` to be used for table `item_bundles` instead of the expected table `items`. This causes ordering and filtering to fail for columns Callnumber and Barcode. Using Koha::Items->search does not have this problem. This patch also disables ordering by status because it does not work (error message is: "Cannot find Koha::Object class for return_claim'") Test plan: 1. Create an item bundle https://koha-community.org/manual/23.11/en/html/circulation.html#circulating-bundles 2. Add at least 2 items to this bundle 3. Verify that ordering/filtering by callnumber or barcode works 4. Run `prove t/db_dependent/api/v1/items/bundled_items.t`
Created attachment 162521 [details] [review] Bug 35963: Add tests Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Created attachment 162522 [details] [review] Bug 35963: Fix bundled items table ordering and filtering Using the many-to-many relationship results in the table alias `me` to be used for table `item_bundles` instead of the expected table `items`. This causes ordering and filtering to fail for columns Callnumber and Barcode. Using Koha::Items->search does not have this problem. This patch also disables ordering by status because it does not work (error message is: "Cannot find Koha::Object class for return_claim'") Test plan: 1. Create an item bundle https://koha-community.org/manual/23.11/en/html/circulation.html#circulating-bundles 2. Add at least 2 items to this bundle 3. Verify that ordering/filtering by callnumber or barcode works 4. Run `prove t/db_dependent/api/v1/items/bundled_items.t` Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Created attachment 162523 [details] [review] Bug 35963: (QA follow-up): tidy up code and fix exec permission
It works :) Also split commit to check that the new tests indeed need the implementation to pass.
Created attachment 162718 [details] [review] Bug 35963: Add tests Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 162719 [details] [review] Bug 35963: Fix bundled items table ordering and filtering Using the many-to-many relationship results in the table alias `me` to be used for table `item_bundles` instead of the expected table `items`. This causes ordering and filtering to fail for columns Callnumber and Barcode. Using Koha::Items->search does not have this problem. This patch also disables ordering by status because it does not work (error message is: "Cannot find Koha::Object class for return_claim'") Test plan: 1. Create an item bundle https://koha-community.org/manual/23.11/en/html/circulation.html#circulating-bundles 2. Add at least 2 items to this bundle 3. Verify that ordering/filtering by callnumber or barcode works 4. Run `prove t/db_dependent/api/v1/items/bundled_items.t` Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 162720 [details] [review] Bug 35963: (QA follow-up): tidy up code and fix exec permission Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Thanks chaps, Passing QA here.
Pushed for 24.05! Well done everyone, thank you!
Pushed to 23.11.x for 23.11.04
Backported to 23.05.x for upcoming 23.05.10.