From 876d95285ef06224b0d50249b7096b55abff400d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 26 Mar 2020 13:49:57 +0000 Subject: [PATCH] Bug 24201: (follow-up) Use GetLoggedInDeskName This patch updates the templates to use the new TT plugin instead of adding additional variables to the already crouded get_template_and_user. Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Martin Renvoize Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart --- C4/Auth.pm | 3 --- Koha/Template/Plugin/Desks.pm | 16 ++++++++++++++++ .../intranet-tmpl/prog/en/includes/header.inc | 10 +++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 4585893968..17df921ad2 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -463,7 +463,6 @@ sub get_template_and_user { GoogleJackets => C4::Context->preference("GoogleJackets"), OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"), KohaAdminEmailAddress => "" . C4::Context->preference("KohaAdminEmailAddress"), - LoginDeskname => ( C4::Context->userenv ? C4::Context->userenv->{"desk_name"} : undef ), LoginFirstname => ( C4::Context->userenv ? C4::Context->userenv->{"firstname"} : "Bel" ), LoginSurname => C4::Context->userenv ? C4::Context->userenv->{"surname"} : "Inconnu", emailaddress => C4::Context->userenv ? C4::Context->userenv->{"emailaddress"} : undef, @@ -491,7 +490,6 @@ sub get_template_and_user { IntranetNav => C4::Context->preference("IntranetNav"), IntranetmainUserblock => C4::Context->preference("IntranetmainUserblock"), LibraryName => C4::Context->preference("LibraryName"), - LoginDeskname => ( C4::Context->userenv ? C4::Context->userenv->{"desk_name"} : undef ), advancedMARCEditor => C4::Context->preference("advancedMARCEditor"), canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'), intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), @@ -559,7 +557,6 @@ sub get_template_and_user { opac_name => $opac_name, LibraryName => "" . C4::Context->preference("LibraryName"), LibraryNameTitle => "" . $LibraryNameTitle, - LoginDeskname => C4::Context->userenv ? C4::Context->userenv->{"desk_name"} : "", OPACAmazonCoverImages => C4::Context->preference("OPACAmazonCoverImages"), OPACFRBRizeEditions => C4::Context->preference("OPACFRBRizeEditions"), OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"), diff --git a/Koha/Template/Plugin/Desks.pm b/Koha/Template/Plugin/Desks.pm index 99fe2329e3..a3be8c365f 100644 --- a/Koha/Template/Plugin/Desks.pm +++ b/Koha/Template/Plugin/Desks.pm @@ -67,6 +67,22 @@ sub GetLoggedInDeskId { ''; } +=head3 GetLoggedInDeskName + +[% Desks.GetLoggedInDeskName %] + +Return the desk name that is attached to the session or empty string + +=cut + +sub GetLoggedInDeskName { + my ($self) = @_; + + return C4::Context->userenv ? + C4::Context->userenv->{'desk_name'} : + ''; +} + =head3 all [% Desks.all %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index f65cd87205..152483c94f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -89,10 +89,10 @@ [% IF (Desks.defined) %] | - [% IF ( LoginDeskname == '') %] + [% IF ( Desks.GetLoggedInDeskName == '' ) %] NO DESK SET [% ELSE %] - [% LoginDeskname | html %] + [% Desks.GetLoggedInDeskName | html %] [% Desks.GetLoggedInDeskId | html %] [% END %] @@ -119,10 +119,10 @@
  • Desk:
    - [% IF ( LoginDeskname == '' AND Desks.defined ) %] + [% IF ( Desks.GetLoggedInDeskName == '' AND Desks.defined ) %] NO DESK SET - [% ELSIF ( LoginDeskname != '' ) %] - [% LoginDeskname | html %] + [% ELSIF ( Desks.GetLoggedInDeskName != '' ) %] + [% Desks.GetLoggedInDeskName | html %] [% Desks.GetLoggedInDeskId | html %] [% END %]
  • -- 2.39.5