Bug 17530: Use can_article_request to control sidebar link
Before this patch, the 'Request article' link is displayed whenever the
pref is enabled. In many cases this might be useless. Instead of a guess
as in opac-search, we now call can_article_request to know for sure.
Note: at least this is the case when a user has logged in.
Update sidebar template with template variable artreqpossible.
Add code in opac-detail, MARCdetail and ISBDdetail to fill it.
Test plan:
[1] Look for two biblios with items: one that should allow article requests
and one that should not (respecting branch, patron, item type).
[2] Verify on detail, ISBD and MARC that the link is displayed for
the first biblio and hidden for the second biblio.
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>
This commit is contained in:
parent
2b0e73b9e1
commit
b6813142dd
|
|
@ -14,7 +14,7 @@
|
|||
<li><a class="print-large" href="#">Print</a></li>
|
||||
|
||||
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
|
||||
[% IF Koha.Preference('ArticleRequests') %]
|
||||
[% IF artreqpossible %]
|
||||
<li><a class="article_request" href="/cgi-bin/koha/opac-request-article.pl?biblionumber=[% biblio.biblionumber | html %]">Request article</a></li>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -217,4 +217,11 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
|
|||
$template->param('OPACSearchForTitleIn' => $search_for_title);
|
||||
}
|
||||
|
||||
if( C4::Context->preference('ArticleRequests') ) {
|
||||
my $artreqpossible = $patron
|
||||
? $biblio->can_article_request( $patron )
|
||||
: $biblio->may_article_request;
|
||||
$template->param( artreqpossible => $artreqpossible );
|
||||
}
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -349,6 +349,13 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
|
|||
$template->param('OPACSearchForTitleIn' => $search_for_title);
|
||||
}
|
||||
|
||||
if( C4::Context->preference('ArticleRequests') ) {
|
||||
my $artreqpossible = $patron
|
||||
? $biblio->can_article_request( $patron )
|
||||
: $biblio->may_article_request;
|
||||
$template->param( artreqpossible => $artreqpossible );
|
||||
}
|
||||
|
||||
$template->param(
|
||||
item_loop => \@item_loop,
|
||||
item_header_loop => \@item_header_loop,
|
||||
|
|
|
|||
|
|
@ -756,6 +756,14 @@ if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) {
|
|||
my $marcnotesarray = GetMarcNotes ($record,$marcflavour);
|
||||
my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
|
||||
|
||||
if( C4::Context->preference('ArticleRequests') ) {
|
||||
my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
|
||||
my $artreqpossible = $patron
|
||||
? $biblio->can_article_request( $patron )
|
||||
: $biblio->may_article_request;
|
||||
$template->param( artreqpossible => $artreqpossible );
|
||||
}
|
||||
|
||||
$template->param(
|
||||
MARCNOTES => $marcnotesarray,
|
||||
norequests => $norequests,
|
||||
|
|
|
|||
Loading…
Reference in New Issue