I wrote this method in an attempt to fix a behavior that wasn't exactly as I understood in the first place. So not sure I'll use it. Putting it here in case it helps some other dev and deserves to be in the codebase.
Created attachment 175396 [details] [review] Bug 38686: Unit tests
Created attachment 175398 [details] [review] Bug 38686: Add Koha::Items->filter_by_checked_out() This patch adds a method for filtering `Koha::Items` resultsets by keeping only those items that currently checked out. Usage: ```perl if ( $biblio->items->filter_by_checked_out()->count ) { # do your stuff } ``` To test: 1. Apply this patches 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Items.t => SUCCESS: Tests pass 3. Sign off :-D
Created attachment 175763 [details] [review] Bug 38686: Unit tests Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Created attachment 175764 [details] [review] Bug 38686: Add Koha::Items->filter_by_checked_out() This patch adds a method for filtering `Koha::Items` resultsets by keeping only those items that currently checked out. Usage: ```perl if ( $biblio->items->filter_by_checked_out()->count ) { # do your stuff } ``` To test: 1. Apply this patches 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Items.t => SUCCESS: Tests pass 3. Sign off :-D Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Will be implemented on bug 37334. *** This bug has been marked as a duplicate of bug 37334 ***
(In reply to Jonathan Druart from comment #5) > Will be implemented on bug 37334. > > *** This bug has been marked as a duplicate of bug 37334 *** I liked my tests more :-P
Please add them there then. It's not pushed yet!