Bugzilla – Attachment 77364 Details for
Bug 21137
Replace BORROWER_INFO and USER_INFO with logged_in_user
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21137: Replace USER_INFO with logged_in_user
Bug-21137-Replace-USERINFO-with-loggedinuser.patch (text/plain), 18.60 KB, created by
Jonathan Druart
on 2018-08-01 13:30:23 UTC
(
hide
)
Description:
Bug 21137: Replace USER_INFO with logged_in_user
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-08-01 13:30:23 UTC
Size:
18.60 KB
patch
obsolete
>From 7d19914167dc10854b914369c6b9cd51da6483e2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 1 Aug 2018 09:57:29 -0300 >Subject: [PATCH] Bug 21137: Replace USER_INFO with logged_in_user > >This patch set does several things: >- it removes USER_INFO and BORROWER_INFO >These 2 variables contained logged-in patron's info. They must be >accessed from logged_in_user >- Use patron-title.inc for the breadcrumb at the OPAC, for consistencies >--- > C4/Auth.pm | 4 +--- > C4/InstallAuth.pm | 2 +- > admin/aqbudgets.pl | 5 +---- > admin/aqplan.pl | 12 ++++++++---- > koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 10 +++++----- > .../intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt | 2 +- > .../intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc | 2 +- > .../opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt | 4 ++-- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt | 4 ++-- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 2 +- > .../opac-tmpl/bootstrap/en/modules/opac-search-history.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt | 2 +- > 16 files changed, 29 insertions(+), 30 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index e27b1b3ad7..f0f3eb8611 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -145,7 +145,7 @@ See C<&checkauth> for an explanation of these parameters. > > The C<template_name> is then used to find the correct template for > the page. The authenticated users details are loaded onto the >-template in the HTML::Template LOOP variable C<USER_INFO>. Also the >+template in the logged_in_user variable (which is a Koha::Patron object). Also the > C<sessionID> is passed to the template. This can be used in templates > if cookies are disabled. It needs to be put as and input to every > authenticated page. >@@ -285,8 +285,6 @@ sub get_template_and_user { > ); > } > >- $template->param( "USER_INFO" => $patron->unblessed ) if $borrowernumber != 0; >- > my $all_perms = get_all_subpermissions(); > > my @flagroots = qw(circulate catalogue parameters borrowers permissions reserveforothers borrow >diff --git a/C4/InstallAuth.pm b/C4/InstallAuth.pm >index 5f5f213331..67319b3db6 100644 >--- a/C4/InstallAuth.pm >+++ b/C4/InstallAuth.pm >@@ -96,7 +96,7 @@ InstallAuth - Authenticates Koha users for Install process > > The C<template_name> is then used to find the correct template for > the page. The authenticated users details are loaded onto the >- template in the HTML::Template LOOP variable C<USER_INFO>. Also the >+ template in the logged_in_user variable (which is a Koha::Patron object). Also the > C<sessionID> is passed to the template. This can be used in templates > if cookies are disabled. It needs to be put as and input to every > authenticated page. >diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl >index 5aeb8b9786..44f0d7fd08 100755 >--- a/admin/aqbudgets.pl >+++ b/admin/aqbudgets.pl >@@ -89,9 +89,6 @@ if ( $budget_period_id ) { > > # ------- get periods stuff ------------------ > >-# USED FOR PERMISSION COMPARISON LATER >-my $borrower_id = $template->{VARS}->{'USER_INFO'}->{'borrowernumber'}; >- > $template->param( > show_mine => $show_mine, > op => $op, >@@ -235,7 +232,7 @@ if ( $op eq 'list' ) { > ); > > my @budgets = @{ >- GetBudgetHierarchy( $$period{budget_period_id}, undef, ( $show_mine ? $borrower_id : 0 )) >+ GetBudgetHierarchy( $$period{budget_period_id}, undef, ( $show_mine ? $borrowernumber : 0 )) > }; > > my $period_total = 0; >diff --git a/admin/aqplan.pl b/admin/aqplan.pl >index f01e5e8b13..0ba3d25fef 100755 >--- a/admin/aqplan.pl >+++ b/admin/aqplan.pl >@@ -84,8 +84,8 @@ $template->param( > > # ------- get periods stuff ------------------ > >-my $borrower_id = $template->{VARS}->{'USER_INFO'}->{'borrowernumber'}; >-my $borrower_branchcode = $template->{VARS}->{'USER_INFO'}->{'branchcode'}; >+ >+my $borrower_branchcode = my $branch_code = C4::Context->userenv->{'branch'}; > > my $authcat = $input->param('authcat'); > my $show_active = $input->param('show_active') // 0; >@@ -108,7 +108,11 @@ $authcat = 'Asort1' if not defined $authcat; # defaults to Asort if no authcat > my $budget_id = $input->param('budget_id'); > my $op = $input->param("op") // q{}; > >-my $budgets_ref = GetBudgetHierarchy( $budget_period_id, $show_mine?$template->{VARS}->{'USER_INFO'}->{'branchcode'}:'', $show_mine?$template->{VARS}->{'USER_INFO'}->{'borrowernumber'}:'' ); >+my $budgets_ref = GetBudgetHierarchy( >+ $budget_period_id, >+ $show_mine ? $borrower_branchcode : '', >+ $show_mine ? $borrowernumber : '' >+); > > # build categories list > my $sth = $dbh->prepare("select distinct category from authorised_values where category like 'A%' "); >@@ -315,7 +319,7 @@ foreach my $budget (@budgets) { > if ( $period->{budget_period_locked} == 1 ) { > $budget_lock = 1; > } elsif ( $budget->{budget_permission} == 1 ) { >- $budget_lock = 1 if $borrower_id != $budget->{'budget_owner_id'}; >+ $budget_lock = 1 if $borrowernumber != $budget->{'budget_owner_id'}; > } elsif ( $budget->{budget_permission} == 2 ) { > $budget_lock = 1 if $borrower_branchcode ne $budget->{budget_branchcode}; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >index d052fd9b1d..25902afe67 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >@@ -620,7 +620,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > $( sel ).on( event, function (e) { > e.preventDefault(); > handler( e, Preferences.user[pref] ); >- Preferences.Save( [% USER_INFO.borrowernumber %] ); >+ Preferences.Save( [% logged_in_user.borrowernumber %] ); > showPreference(pref); > } ); > } >@@ -645,7 +645,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > $( document ).on( 'change', 'input.search-toggle-server', function() { > var server_id = $( this ).closest('li').data('server-id'); > Preferences.user.selected_search_targets[server_id] = this.checked; >- Preferences.Save( [% USER_INFO.borrowernumber %] ); >+ Preferences.Save( [% logged_in_user.borrowernumber %] ); > } ); > break; > } >@@ -683,7 +683,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > delete Preferences.user.macros[name]; > } > >- Preferences.Save( [% USER_INFO.borrowernumber %] ); >+ Preferences.Save( [% logged_in_user.borrowernumber %] ); > } > > function showSavedMacros( macros ) { >@@ -980,7 +980,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > $( '#switch-editor' ).click( function() { > if ( !confirm( _("Any changes will not be saved. Continue?") ) ) return; > >- $.cookie( 'catalogue_editor_[% USER_INFO.borrowernumber %]', 'basic', { expires: 365, path: '/' } ); >+ $.cookie( 'catalogue_editor_[% logged_in_user.borrowernumber %]', 'basic', { expires: 365, path: '/' } ); > > if ( state.backend == 'catalog' ) { > window.location = '/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=' + state.recordID; >@@ -1093,7 +1093,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > }; > > // Start editor >- Preferences.Load( [% USER_INFO.borrowernumber || 0 %] ); >+ Preferences.Load( [% logged_in_user.borrowernumber || 0 %] ); > displayPreferences(editor); > makeAuthorisedValueWidgets( '' ); > Search.Init( { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index 2f31727fbd..f8bf448156 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -111,7 +111,7 @@ > > if ( !confirm( breedingid ? _("This record cannot be transferred to the advanced editor. Continue?") : _("Any changes will not be saved. Continue?") ) ) return false; > >- $.cookie( 'catalogue_editor_[% USER_INFO.borrowernumber %]', 'advanced', { expires: 365, path: '/' } ); >+ $.cookie( 'catalogue_editor_[% logged_in_user.borrowernumber %]', 'advanced', { expires: 365, path: '/' } ); > > var biblionumber = [% biblionumber || "null" %]; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >index 7305bd54b6..fd2d8ba97b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >@@ -236,7 +236,7 @@ > }); > > $("#useadvanced").click(function(){ >- $.cookie( 'catalogue_editor_[% USER_INFO.borrowernumber %]', 'advanced', { expires: 365, path: '/' } ); >+ $.cookie( 'catalogue_editor_[% logged_in_user.borrowernumber %]', 'advanced', { expires: 365, path: '/' } ); > return true; > }); > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 15d185fe76..95b025f277 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -103,7 +103,7 @@ > [% END %] > [% END %] > [% IF ( loggedinusername ) %] >- <li><p class="members navbar-text">Welcome, <a class="login-link" href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername" data-borrowernumber="[% USER_INFO.borrowernumber %]" data-branchcode="[% USER_INFO.branchcode %]" >[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</span></a></p></li> >+ <li><p class="members navbar-text">Welcome, <a class="login-link" href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername" data-borrowernumber="[% logged_in_user.borrowernumber %]" data-branchcode="[% logged_in_user.branchcode %]" >[% INCLUDE 'patron-title.inc' patron = logged_in_user no_html = 1 %]</span></a></p></li> > <li class="divider-vertical"></li> > [% END %] > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt >index 805b072130..e47844e2c7 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt >@@ -9,8 +9,8 @@ > <div class="main"> > <ul class="breadcrumb"> > <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> >- [% IF ( loggedinusername ) %] >- <li><a href="/cgi-bin/koha/opac-user.pl">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">›</span></li> >+ [% IF ( logged_in_user ) %] >+ <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">›</span></li> > [% END %] > <li> > [% IF shelf.category == 1 %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >index 073f8d31a4..fadd6fbed5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >@@ -16,8 +16,8 @@ > <div class="main"> > <ul class="breadcrumb noprint"> > <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> >- [% IF ( loggedinusername ) %] >- <li><a href="/cgi-bin/koha/opac-user.pl">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">›</span></li> >+ [% IF ( logged_in_user ) %] >+ <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE patron-title.inc patron = logged_in_user %]</a> <span class="divider">›</span></li> > [% END %] > > [% IF method != 'list' %] >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 892840e0d4..24c3d43166 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt >@@ -145,7 +145,7 @@ > [% ELSE %] > [% IF Koha.Preference('OPACUserSummary') && dashboard_info %] > <div id="user_summary"> >- <h3>Welcome, <a href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</span></a></h3> >+ <h3>Welcome, <a href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</span></a></h3> > <ul id="user_summary_shortcuts"> > [% IF checkouts && checkouts > 0 %] > <li><a href="/cgi-bin/koha/opac-user.pl#opac-user-checkouts"><span class="user_checkouts_count count_label">[% checkouts %]</span> checkout(s)</a></li> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >index 4b13a3a12f..ae417ba815 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -123,7 +123,7 @@ > > [% UNLESS ( message ) %] > [% UNLESS ( none_available ) %] >- <h3>Confirm holds for:[% USER_INFO.firstname %] [% USER_INFO.surname %] ([% USER_INFO.cardnumber %])</h3> >+ <h3>Confirm holds for:[% INCLUDE 'patron-title.inc' patron = logged_in_user %] ([% logged_in_user.cardnumber %])</h3> > [% END # / UNLESS none_available %] > > [% IF (RESERVE_CHARGE) %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >index 5a8e07ae69..8fac44a4ee 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >@@ -13,7 +13,7 @@ > <ul class="breadcrumb"> > <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> > [% IF ( loggedinusername ) %] >- <li><a href="/cgi-bin/koha/opac-user.pl">[% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">›</span></li> >+ <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">›</span></li> > <li><a href="#">Your search history</a></li> > [% ELSE %] > <li><a href="#">Search history</a></li> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt >index 6b0fc07d27..cffc687971 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt >@@ -11,7 +11,7 @@ > <ul class="breadcrumb"> > <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> > [% IF ( loggedinusername ) %] >- <li><a href="/cgi-bin/koha/opac-user.pl">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">›</span></li> >+ <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">›</span></li> > [% END %] > <li><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a> <span class="divider">›</span></li> > <li>Share a list</li> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index c122ae23f7..eb523c6a46 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -36,7 +36,7 @@ > <ul class="breadcrumb noprint"> > <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> > [% IF ( loggedinusername ) %] >- <li><a href="/cgi-bin/koha/opac-user.pl">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">›</span></li> >+ <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">›</span></li> > [% END %] > > [% IF op != 'list' %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index 45b40478e2..06c851cea2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -16,7 +16,7 @@ > <div class="main"> > <ul class="breadcrumb"> > <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> >- <li><a href="/cgi-bin/koha/opac-user.pl">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">›</span></li> >+ <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">›</span></li> > <li><a href="#">Your purchase suggestions</a></li> > </ul> > >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21137
:
77364
|
77365
|
77369
|
77370
|
77371
|
77376
|
77377
|
77378
|
77397
|
77398
|
77399
|
77400
|
77401
|
77402
|
77403
|
77404