]> git.koha-community.org Git - koha.git/commit
Bug 24254: Implement separate filters and add patron param
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 21 Dec 2020 18:50:13 +0000 (15:50 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 19 Jan 2021 07:44:34 +0000 (08:44 +0100)
commit1246cd1906803b162f748c69773cdf3d100762a7
tree776ecc59802ae38456ce709d2ae15e05c4644daa
parentf09f34864331f0b3ad0e5c23cd93e6dbb1e35087
Bug 24254: Implement separate filters and add patron param

This patch introduces two new methods for stacking filters on
Koha::Items:

- filter_out_lost
_ filter_out_opachiddenitems

This two filters are what actually happened inside the
filter_by_visible_in_opac. Everything is covered by tests.

In the process I added a Koha::Patron param to the method that is
internally used to decide if the OPACHiddenItems syspref needs to be
honoured or not. This *could* be better done with a fallback to
C4::Context->userenv if no param is passed.

I decided to leave that part for later, if we really find it would help
(e.g. if bug 10589 gets some action and we really need something here to
 handle that).

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Items.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 42c4089fad79461f5aaea3c3354e902d192af543)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Items.pm
t/db_dependent/Koha/Items.t