From 3b9c0f338bdacb579ef4d68d1e3dc85515419929 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 22 Jul 2020 10:09:29 +0100 Subject: [PATCH] Bug 20799: (QA follow-up) Move syspref check This patch moves the syspref check into the controller to save a DB query if the module is not enabled. Signed-off-by: Martin Renvoize JD - amended patch: removing trailing parenthesis in the IF statement Signed-off-by: Jonathan Druart --- catalogue/detail.pl | 5 ++++- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 5e10954a63..d01de155a6 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -540,7 +540,10 @@ my $holds = $biblio->holds; $template->param( holdcount => $holds->count ); # Check if there are any ILL requests connected to the biblio -my $illrequests = Koha::Illrequests->search({ biblio_id => $biblionumber }); +my $illrequests = + C4::Context->preference('ILLModule') + ? Koha::Illrequests->search( { biblio_id => $biblionumber } ) + : []; $template->param( illrequests => $illrequests ); my $StaffDetailItemSelection = C4::Context->preference('StaffDetailItemSelection'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 96a8ebc142..dbb1ca14d8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -128,7 +128,7 @@ [% END %] - [% IF ( Koha.Preference( 'ILLModule' ) && illrequests.count ) %] + [% IF illrequests.count %] ILL requests: [% IF CAN_user_ill %] -- 2.39.5