https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24254
Martin Renvoize <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #114665|0 |1 is obsolete| | --- Comment #46 from Martin Renvoize <[email protected]> --- Created attachment 115148 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=115148&action=edit Bug 24254: Add Koha::Items->filter_by_visible_in_opac This patch adds a method based on the original idea from Nick, but on Koha::Items. The idea is to build a proper filter, based on the current rules for hiding things, directly on the DBIC query. The caller takes care of knowing if the filtering should apply (i.e. checking the patron category exceptions) and then it would do something like: my @items; if ( <patron_category_does_not_have_exception> ) { @items = $biblio->items->filter_by_visible_in_opac( { rules => $rules } ); } else { # still want to enforce 'hidelostitems' @items = $biblio->items->filter_by_visible_in_opac; } To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Items.t => SUCCESS: Tests pass! 3. Look at the use cases on the tests, read the code => SUCCESS: It all makes sense 4. Compare with Koha::Item->hidden_in_opac => SUCCESS: It all makes sense 5. Sign off :-D Signed-off-by: Kyle M Hall <[email protected]> Signed-off-by: Martin Renvoize <[email protected]> Signed-off-by: Kyle M Hall <[email protected]> Signed-off-by: Martin Renvoize <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
