Browse Source

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

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
18.11.x
Jonathan Druart 6 years ago
committed by Nick Clemens
parent
commit
889f148e4e
  1. 4
      C4/Auth.pm
  2. 2
      C4/InstallAuth.pm
  3. 5
      admin/aqbudgets.pl
  4. 12
      admin/aqplan.pl
  5. 10
      koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
  6. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
  7. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt
  8. 2
      koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
  9. 4
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt
  10. 4
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt
  11. 2
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt
  12. 2
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt
  13. 2
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt
  14. 2
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt
  15. 2
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt
  16. 2
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt

4
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

2
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.

5
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;

12
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};
}

10
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( {

2
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" %];

2
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;
});

2
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 %]

4
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">&rsaquo;</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">&rsaquo;</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">&rsaquo;</span></li>
[% END %]
<li>
[% IF shelf.category == 1 %]

4
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">&rsaquo;</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">&rsaquo;</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">&rsaquo;</span></li>
[% END %]
[% IF method != 'list' %]

2
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>

2
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) %]

2
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">&rsaquo;</span></li>
[% IF ( loggedinusername ) %]
<li><a href="/cgi-bin/koha/opac-user.pl">[% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">&rsaquo;</span></li>
<li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
<li><a href="#">Your search history</a></li>
[% ELSE %]
<li><a href="#">Search history</a></li>

2
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">&rsaquo;</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">&rsaquo;</span></li>
<li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
[% END %]
<li><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a> <span class="divider">&rsaquo;</span></li>
<li>Share a list</li>

2
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">&rsaquo;</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">&rsaquo;</span></li>
<li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
[% END %]
[% IF op != 'list' %]

2
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">&rsaquo;</span></li>
<li><a href="/cgi-bin/koha/opac-user.pl">[% USER_INFO.title %] [% USER_INFO.firstname %] [% USER_INFO.surname %]</a> <span class="divider">&rsaquo;</span></li>
<li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
<li><a href="#">Your purchase suggestions</a></li>
</ul>

Loading…
Cancel
Save