From 0c7de890b5fc5cb696dc4bfc80aef0c3ac7830af 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 --- 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 f0f41dc128..d1635babeb 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.20.1