]> 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)
committerAndrew Fuerste-Henry <andrew@bywatersolutions.com>
Fri, 29 Jan 2021 18:42:31 +0000 (18:42 +0000)
commit172747f9adc0c39440dfe3f7930e2ad87b387d75
treedfe3a10881f853840737da193d183ba37906b8fe
parent2369428d7049f9847ed4ac578684a81fe03df4d0
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: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Koha/Items.pm
t/db_dependent/Koha/Items.t