Bugzilla – Attachment 72914 Details for
Bug 17530
Don't show 'article request' link when no article requests are permitted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17530: Use may_article_request method in opac-search
Bug-17530-Use-mayarticlerequest-method-in-opac-sea.patch (text/plain), 4.13 KB, created by
Brendan Gallagher
on 2018-03-15 09:40:08 UTC
(
hide
)
Description:
Bug 17530: Use may_article_request method in opac-search
Filename:
MIME Type:
Creator:
Brendan Gallagher
Created:
2018-03-15 09:40:08 UTC
Size:
4.13 KB
patch
obsolete
>From 7880b1bf82dcef94b3073a1c8f0b351f65560c51 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 1 Mar 2018 15:25:44 +0100 >Subject: [PATCH] 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> >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 2 +- > opac/opac-search.pl | 13 +++++++++++++ > 2 files changed, 14 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >index 36211c9..212ac34 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -509,7 +509,7 @@ > [% END # IF RequestOnOpac %] > > [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %] >- [% IF Koha.Preference('ArticleRequests') %] >+ [% IF SEARCH_RESULT.artreqpossible %] > <span class="actions"><a class="article_request" href="/cgi-bin/koha/opac-request-article.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Request article</a></span> > [% END %] > [% END %] >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index f06e40a..3b7c405 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -56,6 +56,7 @@ use Koha::ItemTypes; > use Koha::Ratings; > use Koha::Virtualshelves; > use Koha::Library::Groups; >+use Koha::Patrons; > > use POSIX qw(ceil floor strftime); > use URI::Escape; >@@ -644,6 +645,12 @@ for (my $i=0;$i<@servers;$i++) { > } > $hits = 0 unless @newresults; > >+ my $categorycode; # needed for may_article_request >+ if( $borrowernumber && C4::Context->preference('ArticleRequests') ) { >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ $categorycode = $patron ? $patron->categorycode : undef; >+ } >+ > foreach my $res (@newresults) { > > # must define a value for size if not present in DB >@@ -699,6 +706,12 @@ for (my $i=0;$i<@servers;$i++) { > $res->{ratings} = $ratings; > $res->{my_rating} = $borrowernumber ? $ratings->search({ borrowernumber => $borrowernumber })->next : undef; > } >+ >+ # BZ17530: 'Intelligent' guess if result can be article requested >+ $res->{artreqpossible} = Koha::Biblio->may_article_request({ >+ categorycode => $categorycode, >+ itemtype => $res->{itemtype}, >+ }); > } > > if ($results_hashref->{$server}->{"hits"}){ >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17530
:
72857
|
72858
|
72859
|
72860
|
72909
|
72910
|
72911
|
72912
|
72913
|
72914
|
72915
|
72930
|
72931
|
75697
|
75751
|
76617
|
76618
|
76619
|
76620
|
76621
|
76622
|
77258
|
77259
|
77260
|
77261
|
77262
|
77263
|
78030
|
78031
|
78032
|
78033
|
78034
|
78035
|
78362
|
78363
|
78364
|
78365
|
78366
|
78367
|
78368
|
78499