Bug 17530: Use may_article_request method in opac-search
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 1 Mar 2018 14:25:44 +0000 (15:25 +0100)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 7 Sep 2018 13:16:06 +0000 (13:16 +0000)
commit2b0e73b9e1b7f19a55510521a990fa00411157c5
tree52fb5964f1f7855dc0dfaef9fa6d98d35aa7ec52
parentc1d2363063d1c3eb2d37e45c9a3074cea9c783b4
Bug 17530: Use may_article_request method in opac-search

If you enable pref ArticleRequests, until now all search results got the
'Request article' link. This patch tries to improve the situation by
using the new sub with the itemtype of the search result.

In most cases the number of links will drastically decrease. It may still
be possible sometimes that a link is shown while it effectively is not
possible, but we do not get the performance burden of determining that and
going through all items.

Test plan:
[1] Look for two borrowers P1 and P2 within categories C1 resp. C2.
[2] Look for two biblios B1 and B2 with default item types I1 resp. I2.
    (See 942c in case of MARC21.)
[3] Make sure that no circ rules allow article requests. Enable the pref.
[4] Add/modify circ rule category=C1, itemtype=I1, art_req=yes.
    Log out. Search for B1 and B2, verify that only B1 has AR link.
    Log in as P1. Verify that only B1 has AR link.
    Log in as P2. Verify that no biblio has AR link.
[5] Add/modify circ rule category=C2, itemtype=I2, art_req=item_only.
    Log out. Search for B1 and B2, verify that both have AR links.
    Log in as P1. Verify that only B1 has AR link.
    Log in as P2. Verify that only B2 has AR link.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
opac/opac-search.pl