The template plugin Branches contains a method GetLoggedInBranchcode that returns current branch code.
This patch adds GetLoggedInBranchname to get current branch name.
It is used to replace vars LoginBranchname and LoginBranchcode sent to all templates in C4/Auth.pm.
In labels and patrons cards modules, I choose to remove a unseless display of
current branch in a hint.
In acqui/acqui-home.tt, I choose to remove a useless display of current
branch and also because table of founds contains a filter on library.
Test plan:
Check pages source code to see branch code or name is correct.
list of the pages:
/cgi-bin/koha/acqui/acqui-home.pl
/cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX
/cgi-bin/koha/circ/branchoverdues.pl
/cgi-bin/koha/circ/set-library.pl
/cgi-bin/koha/circ/offline.pl
/cgi-bin/koha/labels/label-edit-batch.pl?op=new
/cgi-bin/koha/labels/label-manage.pl
/cgi-bin/koha/patroncards/edit-batch.pl
/cgi-bin/koha/patroncards/manage.pl
OPAC:
/cgi-bin/koha/opac-detail.pl?biblionumber=XXX
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
GoogleJackets => C4::Context->preference("GoogleJackets"),
OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"),
KohaAdminEmailAddress => "" . C4::Context->preference("KohaAdminEmailAddress"),
- LoginBranchcode => ( C4::Context->userenv ? C4::Context->userenv->{"branch"} : 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,
IntranetNav => C4::Context->preference("IntranetNav"),
IntranetmainUserblock => C4::Context->preference("IntranetmainUserblock"),
LibraryName => C4::Context->preference("LibraryName"),
- LoginBranchname => ( C4::Context->userenv ? C4::Context->userenv->{"branchname"} : undef ),
advancedMARCEditor => C4::Context->preference("advancedMARCEditor"),
canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
opac_name => $opac_name,
LibraryName => "" . C4::Context->preference("LibraryName"),
LibraryNameTitle => "" . $LibraryNameTitle,
- LoginBranchname => C4::Context->userenv ? C4::Context->userenv->{"branchname"} : "",
OPACAmazonCoverImages => C4::Context->preference("OPACAmazonCoverImages"),
OPACFRBRizeEditions => C4::Context->preference("OPACFRBRizeEditions"),
OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"),
if ( $branch and my $library = Koha::Libraries->find($branch) ) {
if (! $userenv_branch or $userenv_branch ne $branch ) {
my $branchname = $library->branchname;
- $template->param(LoginBranchname => $branchname); # update template for new branch
- $template->param(LoginBranchcode => $branch); # update template for new branch
$session->param('branchname', $branchname); # update sesssion in DB
$session->param('branch', $branch); # update sesssion in DB
$session->flush();
push @updated, {
updated_branch => 1,
old_branch => $userenv_branch,
+ new_branch => $branch,
};
} # else branch the same, no update
} else {
<span class="separator">|</span>
[% IF ( AutoLocation ) %]
<brand>
- [% LoginBranchname | html %]
+ [% Branches.GetLoggedInBranchname | html %]
</brand>
[% ELSE %]
<strong>
- <span class="logged-in-branch-name">[% LoginBranchname | html %]</span>
+ <span class="logged-in-branch-name">[% Branches.GetLoggedInBranchname | html %]</span>
<span class="logged-in-branch-code content_hidden">[% Branches.GetLoggedInBranchcode | html %]</span>
</strong>
[% END %]
<li class="loggedin-menu-label">
[% IF ( AutoLocation ) %]
<brand>
- [% LoginBranchname | html %]
+ [% Branches.GetLoggedInBranchname | html %]
</brand>
[% ELSE %]
Location: <br />
- <span class="logged-in-branch-name">[% LoginBranchname | html %]</span>
+ <span class="logged-in-branch-name">[% Branches.GetLoggedInBranchname | html %]</span>
<span class="logged-in-branch-code content_hidden">[% Branches.GetLoggedInBranchcode | html %]</span>
[% END %]
</li>
</div>
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
<input type="hidden" name="batch" value="[% batch | html %]" />
- <input type="hidden" name="branchcode" value="[% LoginBranchcode | html %]" />
+ <input type="hidden" name="branchcode" value="[% Branches.GetLoggedInBranchcode | html %]" />
</div>
<div class="modal-footer">
<button class="btn btn-default approve" type="submit"><i class="fa fa-check"></i> Save</button>
[% IF ( loop_budget ) %]
- <h3>All available funds[% IF LoginBranchname %] for [% LoginBranchname | html %][% END %]</h3>
+ <h3>All available funds</h3>
<div id="BudgetsAndFunds">
<table id="accounts">
<ul>
[% IF (SeparateHoldings) %]
<li>
- <a href="#holdings">[% LoginBranchname | html %] holdings ([% itemloop.size() || 0 | html %])</a>
+ <a href="#holdings">[% Branches.GetLoggedInBranchname | html %] holdings ([% itemloop.size() || 0 | html %])</a>
</li>
<li>
<a href="#otherholdings">Other holdings ([% otheritemloop.size() || 0 | html %])</a>
[% USE Branches %]
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Circulation › Overdues at [% LoginBranchname | html %]</title>
+<title>Koha › Circulation › Overdues at [% Branches.GetLoggedInBranchname | html %]</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="circ_branchoverdues" class="circ">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'circ-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> › Overdues at [% LoginBranchname | html %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> › Overdues at [% Branches.GetLoggedInBranchname | html %]</div>
<div class="main container-fluid">
<div class="row">
[% END %]
<main>
-<h1>Circulation: Overdues at [% LoginBranchname | html %]</h1>
+<h1>Circulation: Overdues at [% Branches.GetLoggedInBranchname | html %]</h1>
<form name="selectlocation" action="branchoverdues.pl" method="post">
<label for="location">Shelving location selected: </label><select id="location" name="location">
[% USE raw %]
[% USE Asset %]
+[% USE Branches %]
[% SET footerjs = 1 %]
<!DOCTYPE html>
[% IF (AllowOfflineCirculation) %]
function synchronize() {
kohadb.saveSetting("userid", "[% logged_in_user.userid | html %]");
- kohadb.saveSetting("branchcode", "[% LoginBranchcode | html %]");
+ kohadb.saveSetting("branchcode", "[% Branches.GetLoggedInBranchcode | html %]");
showSyncInfo();
[% UNLESS (AllowOfflineCirculation) %]
reloadRecords();
Updated:<ul>
[% FOREACH update IN updated %]
[% IF ( update.updated_branch ) %]
- <li>Library: [% update.old_branch or "?" | html %] ⇒ [% update.LoginBranchcode or "?" | html %]</li>
+ <li>Library: [% update.old_branch or "?" | html %] ⇒ [% update.new_branch or "?" | html %]</li>
[% ELSE %]
<li>ERROR - unknown</li>
[% END %]
[% END %]
<div id="manage-label-batches">
- <div class="hint">Current library: [% LoginBranchname | html %]</div>
<form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
<div>
<fieldset class="rows" style="border-bottom: 0px; border: 0px;">
[% END %]
<div id="manage-label-layouts">
- <div class="hint">Current library: [% LoginBranchname | html %]</div>
[% IF ( table_loop ) %]
<form name="layouts" action="/cgi-bin/koha/label-manage.pl?label_element=[% label_element | html %]">
[% IF ( label_element == 'layout' ) %]
[% INCLUDE 'patroncards-errors.inc' %]
<div id="manage-patroncard-batches">
- <div class="hint">Current library: [% LoginBranchname | html %]</div>
<form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
<div>
<fieldset class="rows" style="border-bottom: 0px; border: 0px;">
[% INCLUDE 'patroncards-toolbar.inc' %]
[% INCLUDE 'patroncards-errors.inc' %]
<div id="manage-patroncards-layouts">
- <div class="hint">Current library: [% LoginBranchname | html %]</div>
[% IF ( table_loop ) %]
<form name="layouts" action="/cgi-bin/koha/manage.pl?card_element=[% card_element | html %]">
<h2>Currently available [% PROCESS translate_card_element element=card_element_title FILTER lower %]</h2>
[% USE raw %]
+[% USE Branches %]
[% SET classprop = 'class="' %]
-[% IF LoginBranchcode.defined %]
- [% classprop = classprop _ 'branch-' _ LoginBranchcode %]
+[% IF Branches.GetLoggedInBranchcode %]
+ [% classprop = classprop _ 'branch-' _ Branches.GetLoggedInBranchcode %]
[% ELSE %]
[% classprop = classprop _ 'branch-default' %]
[% END %]
[% ELSE %]
<li id="tab_holdings">
[% END %]
- [% BLOCK holding_tab_title %][% IF SeparateHoldings %]<span>[% LoginBranchname | html %] holdings</span>[% ELSE %][% IF specific_item %]<span>Item details</span>[% ELSE %]<span>Holdings</span>[% END %][% END %][% END %]
+ [% BLOCK holding_tab_title %][% IF SeparateHoldings %]<span>[% Branches.GetLoggedInBranchname | html %] holdings</span>[% ELSE %][% IF specific_item %]<span>Item details</span>[% ELSE %]<span>Holdings</span>[% END %][% END %][% END %]
<a href="#holdings">[% PROCESS holding_tab_title %] [% UNLESS too_many_items OR specific_item %][% ' ( ' _ (itemloop.size || 0) _ ' )' | html %][% END %]</a>
</li>
[% IF (SeparateHoldings) %]