From f9f8c6bbd0afeafa09554cf98f551228a6607952 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 25 Jul 2018 12:25:58 -0300 Subject: [PATCH] Bug 21096: Do not display loggedinusername in template MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch is a little fix for a much bigger hidden issues. The original issue: 1. Set the firstname and surname values of a paontr to utf-8 characters ("wide characters"), for instance 月月 2. Use this patron to login at the staff interface => In the header the logged in patron's info (concat of firstname and surname) are displayed correctly 3. Hit whatever link => In the header the info are now displayed incorrectly ("ææ") What happens? After that the user loggin, loggedinusername is set with the value from the DB (borrowers.userid) On next hits it is picked from the session (which contains the decoded utf8 value, see first lines of C4::Context->set_userenv) From C4::Auth::checkauth: 834 $s_userid = $session->param('id') // '' The quick fix is to use the logged_in_user variable in the template, but it seems that issues may occurred if external authentication is used (ldap, shib, cas). Could someone test this? Test plan: Make sure the original issue is fixed Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens (cherry picked from commit be691d86e35acebace0f1576ea9380f405dd55ce) Signed-off-by: Martin Renvoize --- C4/Auth.pm | 2 +- koha-tmpl/intranet-tmpl/prog/en/includes/header.inc | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt | 4 ++-- .../intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt | 2 +- .../intranet-tmpl/prog/en/modules/serials/subscription-add.tt | 2 +- .../intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index df62174a2c..45070ae519 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -261,7 +261,7 @@ sub get_template_and_user { } # user info - $template->param( loggedinusername => $user ); # FIXME Should be replaced with something like patron-title.inc + $template->param( loggedinusername => $user ); # OBSOLETE - Do not reuse this in template, use logged_in_user.userid instead $template->param( loggedinusernumber => $borrowernumber ); # FIXME Should be replaced with logged_in_user.borrowernumber $template->param( logged_in_user => $patron ); $template->param( sessionID => $sessionID ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 365abbc2a3..5e4687535e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -58,7 +58,7 @@ - [% loggedinusername %] + [% logged_in_user.userid | html %] | [% IF ( AutoLocation ) %] @@ -81,7 +81,7 @@
  • Logged in as:
    - [% loggedinusername %] + [% logged_in_user.userid | html %]
  • [% IF ( AutoLocation ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index 96c2f51ee3..31961750ba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -87,7 +87,7 @@ [% UNLESS no_orders_to_display %]
    -

    Invoice number: [% invoice |html %] Received by: [% loggedinusername %] On: [% datereceived | $KohaDates %]

    +

    Invoice number: [% invoice | html %] Received by: [% logged_in_user.userid | html %]On: [% datereceived | $KohaDates %]

    [% UNLESS (invoiceclosedate) %]
  • - Owner: [% loggedinusername %] + Owner: [% logged_in_user.userid | html %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt index 8f95b49d27..786aac82cf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -30,7 +30,7 @@ fieldset.rows li.radio { width: 100%; } /* override staff-global.css */ [% ELSE %] [% END %] - +
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 35a70ff8d3..38bf212095 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -274,12 +274,12 @@
  • Owner: [% IF op == 'add_form' %] - [% loggedinusername %]
  • + [% logged_in_user.userid | html %] [% ELSE %] [% IF owner %] [% owner.firstname _ ' ' _ owner.surname %] [% ELSE %] - [% loggedinusername %] + [% logged_in_user.userid | html %] [% END %] [% END %] -- 2.39.5