Bug 34784 introduced an endpoint for populating empty item callnumbers. In order to be able to create a CLI script for the same purpose, it would be positive to migrate that code into Koha::Biblio.
Created attachment 173134 [details] [review] Bug 38224: Unit tests
Created attachment 173135 [details] [review] Bug 38224: Add Koha::Biblio::populate_item_callnumbers This patch introduces two methods to the `Koha::Biblio` class: * `get_first_callnumber`: returns the first found callnumber on the record, based on the `itemcallnumber` syspref. * `populate_item_callnumbers`: populates the bibliographic record's items based on the return value of `get_first_callnumber`. Can be passed a filter on the items. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblio.t => SUCCESS: Tests pass! 3. Sign off :-D
Created attachment 173136 [details] [review] Bug 38224: (follow-up) Rewrite endpoint using new core methods Now we have core methods, we can use them to rewrite the controller. Behavior should remain unchanged, so to test: 1. Apply this patches 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/rpc/biblios.t => SUCCESS: tests pass! 3. Sign off :-D
Created attachment 174244 [details] [review] Bug 38224: Unit tests Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 174245 [details] [review] Bug 38224: Add Koha::Biblio::populate_item_callnumbers This patch introduces two methods to the `Koha::Biblio` class: * `get_first_callnumber`: returns the first found callnumber on the record, based on the `itemcallnumber` syspref. * `populate_item_callnumbers`: populates the bibliographic record's items based on the return value of `get_first_callnumber`. Can be passed a filter on the items. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblio.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 174246 [details] [review] Bug 38224: (follow-up) Rewrite endpoint using new core methods Now we have core methods, we can use them to rewrite the controller. Behavior should remain unchanged, so to test: 1. Apply this patches 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/rpc/biblios.t => SUCCESS: tests pass! 3. Sign off :-D Signed-off-by: Nick Clemens <nick@bywatersolutions.com>