From e3809481a9634f9d3c5a18fde9121718d9a0bede Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 8 Feb 2021 11:30:39 +0100 Subject: [PATCH] Bug 27634: Fix Link on the OPAC main page Make sure the pref is filled with a valid patron's category to display the "register" link --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 2 +- opac/opac-main.pl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt index 040ceb0d96c..47ac603f858 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ -228,7 +228,7 @@

Forgot your password?

[% END %] - [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %] + [% IF self_registration_enabled %]

Don't have an account? Register here.

diff --git a/opac/opac-main.pl b/opac/opac-main.pl index 779c06d5870..3f7d890c28c 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -28,6 +28,7 @@ use C4::Overdues qw( checkoverdues ); use Koha::Checkouts; use Koha::Holds; use Koha::AdditionalContents; +use Koha::Patron::Categories; use Koha::Patron::Messages; my $input = CGI->new; @@ -108,10 +109,13 @@ if ( $patron ) { } } +my $PatronSelfRegistrationDefaultCategory = C4::Context->preference('PatronSelfRegistrationDefaultCategory'); +my $self_registration_enabled = $PatronSelfRegistrationDefaultCategory && Koha::Patron::Categories->find($PatronSelfRegistrationDefaultCategory); $template->param( koha_news => $koha_news, branchcode => $homebranch, daily_quote => Koha::Quotes->get_daily_quote(), + self_registration_enabled => $self_registration_enabled, ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.25.1