https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35052

--- Comment #17 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 205609
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205609&action=edit
Bug 35052: Add _resolve_opac_hidden_items_rules

New method on Koha::SearchEngine::Elasticsearch::QueryBuilder that decides
whether the OpacHiddenItems rules should be enforced at query time for a
given search, and returns them if so. Returns undef when: the search
isn't an OPAC search, OpacHiddenItemsHidesRecord is off, no OpacHiddenItems
rules are configured, or the searching patron's category is listed in
OpacHiddenItemsExceptions (delegates to the existing
Koha::Patron::Category->override_hidden_items rather than reimplementing
that check). Reads preferences live on every call - nothing is cached or
baked in, so editing the sysprefs takes effect on the very next search.

Not yet wired into build_query_compat (next commit) or consumed anywhere -
this commit only adds the method and its unit tests.

Test plan:
1) ktd --name "${KTD_INSTANCE:-kohadev}" --shell --run 'prove
t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t'
2) All tests pass, including the new '_resolve_opac_hidden_items_rules() tests'
   subtest, covering: staff (non-OPAC) search, OpacHiddenItemsHidesRecord off,
   no rules configured, the normal OPAC case, and a patron category listed in
   OpacHiddenItemsExceptions

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to