From bcc2a65e3ef03aa28f460a8ab5947852b48417ca Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Tue, 20 Mar 2018 23:08:58 +0000 Subject: [PATCH] Bug 20400: Display new tab in OPAC only for patrons with routing lists The visibility of the routing list tab in the OPAC depends on the system preference RoutingSerials and the existence of routing list entries for the patron. Some libraries only offer routing lists to certain user groups and would not want it generally visible. As there are currently no actions you can perform from the list, this appears to be a reasonable behaviour. See test plan in first patch. --- C4/Auth.pm | 3 ++- koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index c3ad351..f7a1923 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -208,12 +208,12 @@ sub get_template_and_user { } my $borrowernumber; + my $patron; if ($user) { # It's possible for $user to be the borrowernumber if they don't have a # userid defined (and are logging in through some other method, such # as SSL certs against an email address) - my $patron; $borrowernumber = getborrowernumber($user) if defined($user); if ( !defined($borrowernumber) && defined($user) ) { $patron = Koha::Patrons->find( $user ); @@ -582,6 +582,7 @@ sub get_template_and_user { PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"), PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), useDischarge => C4::Context->preference('useDischarge'), + routing_lists_exist => ( $patron and $patron->get_routinglists ), ); $template->param( OpacPublic => '1' ) if ( $user || C4::Context->preference("OpacPublic") ); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc index 0e8c5bd..5914f04 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -96,7 +96,7 @@ your lists [% END %] - [% IF Koha.Preference( 'RoutingSerials' ) == 1 %] + [% IF Koha.Preference( 'RoutingSerials' ) && routing_lists_exist %] [% IF ( routinglistsview ) %]
  • [% ELSE %] -- 2.1.4