From f4f5b5a5276fdc8919e967a35ddd5bc5a3853346 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 7 Oct 2021 11:38:14 -0300 Subject: [PATCH] Bug 29168: Only show 'Request article' if allowed on the detail view Content-Type: text/plain; charset=utf-8 This patch adds a check for the patron being able to place the request, in the case of logged in patron. The anonymous patron will still be displayed the link, and redirected to the login page as required. To test: 1. Set the article request limit to 1 2. Place a request on behalf of a known patron 3. With the patron session, in the OPAC, try to place a new article request from the detail page => SUCCESS: There's no link 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Marcel de Rooy --- opac/opac-detail.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 0860aa487a..f93ef646ff 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -794,14 +794,17 @@ if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour, opac => 1 }); -if( C4::Context->preference('ArticleRequests') ) { - my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef; +if ( C4::Context->preference('ArticleRequests') ) { my $itemtype = Koha::ItemTypes->find($biblio->itemtype); my $artreqpossible = $patron ? $biblio->can_article_request( $patron ) : $itemtype ? $itemtype->may_article_request : q{}; + + $artreqpossible &&= $patron->can_request_article + if $patron; + $template->param( artreqpossible => $artreqpossible ); } -- 2.20.1