Koha::Patron::Attribute::Types should be used as an example.
Created attachment 115989 [details] [review] Bug 23830: Make Koha::AuthorisedValues use Koha::Objects::Limit::Library This patch makes Koha::AuthorisedValues inherit the 'search_with_library_limits' method from Koha::Objects::Limit::Library. This was left out of the original implementation and this patch makes this library have a similar implementation to that of Koha::ItemTypes, etc. To test: 1. Run: $ kshell k$ prove t/db_dependent/AuthorisedValues.t => SUCCESS: Tests pass! 2. Apply this patch 3. Notice Koha::AuthorisedValues now inherits this new library 4. Notice the overloaded ->search method is removed 5. Repeat (1) => SUCCESS: The behavior of the newly used method on the tests is the same as before. We only changed the method name and how we pass the library_id. 6. Sign off :-D
Created attachment 115990 [details] [review] Bug 23830: Adapt callers This patch is the result of making the same changes we did on the t/db_dependent/AuthorisedValues.t file (replacing the calls to Koha::AuthorisedValues->search with the tricky branchcode param, and call ->search_with_library_limits, with the library_id as a third parameter. What I did was: $ git grep 'Koha::AuthorisedValues\->search' and then revisited each of the grep results to check if they added the 'branchcode' parameter to the filters. This patch changes the calls to ->search, for ->search_with_library_limits in all the places that require it in the current codebase [1]. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Charges/Sales.t \ t/db_dependent/Ill* 3. Verify the batchmod.pl script is working and filtering the authorised values keeps working [1] Some places like the Koha/Template/Plugin/AuthorisedValues.pm plugin don't seem to be tested, at first glance.
Created attachment 116185 [details] [review] Bug 23830: Make Koha::AuthorisedValues use Koha::Objects::Limit::Library This patch makes Koha::AuthorisedValues inherit the 'search_with_library_limits' method from Koha::Objects::Limit::Library. This was left out of the original implementation and this patch makes this library have a similar implementation to that of Koha::ItemTypes, etc. To test: 1. Run: $ kshell k$ prove t/db_dependent/AuthorisedValues.t => SUCCESS: Tests pass! 2. Apply this patch 3. Notice Koha::AuthorisedValues now inherits this new library 4. Notice the overloaded ->search method is removed 5. Repeat (1) => SUCCESS: The behavior of the newly used method on the tests is the same as before. We only changed the method name and how we pass the library_id. 6. Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 116186 [details] [review] Bug 23830: Adapt callers This patch is the result of making the same changes we did on the t/db_dependent/AuthorisedValues.t file (replacing the calls to Koha::AuthorisedValues->search with the tricky branchcode param, and call ->search_with_library_limits, with the library_id as a third parameter. What I did was: $ git grep 'Koha::AuthorisedValues\->search' and then revisited each of the grep results to check if they added the 'branchcode' parameter to the filters. This patch changes the calls to ->search, for ->search_with_library_limits in all the places that require it in the current codebase [1]. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/Charges/Sales.t \ t/db_dependent/Ill* 3. Verify the batchmod.pl script is working and filtering the authorised values keeps working [1] Some places like the Koha/Template/Plugin/AuthorisedValues.pm plugin don't seem to be tested, at first glance. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Oooh, thanks for this Tomas.. I had entirely forgotten I'd reported this one! Code is trivial and good, all cases seem covered.. test suit passes, QA script passes (well, except for a false positive on POD removal). I think we can safely go for a straight to PQA on this one.!
Pushed to master for 21.05, thanks to everybody involved!
Enhancement not pushed to 20.11.x