Bugzilla – Attachment 106358 Details for
Bug 25765
Replace LoginBranchname and LoginBranchcode with use of Branches template plugin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25765: Replace LoginBranchname and LoginBranchcode with use of Branches template plugin
Bug-25765-Replace-LoginBranchname-and-LoginBranchc.patch (text/plain), 18.02 KB, created by
Victor Grousset/tuxayo
on 2020-06-27 23:00:53 UTC
(
hide
)
Description:
Bug 25765: Replace LoginBranchname and LoginBranchcode with use of Branches template plugin
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2020-06-27 23:00:53 UTC
Size:
18.02 KB
patch
obsolete
>From b7b3409620b09da79fdc65a680b5ca5b7ccb245b Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Tue, 16 Jun 2020 14:01:39 +0200 >Subject: [PATCH] Bug 25765: Replace LoginBranchname and LoginBranchcode with > use of Branches template plugin > >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> >--- > C4/Auth.pm | 3 --- > circ/set-library.pl | 3 +-- > koha-tmpl/intranet-tmpl/prog/en/includes/header.inc | 8 ++++---- > .../intranet-tmpl/prog/en/includes/members-toolbar.inc | 2 +- > .../intranet-tmpl/prog/en/modules/acqui/acqui-home.tt | 2 +- > .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 2 +- > .../intranet-tmpl/prog/en/modules/circ/branchoverdues.tt | 6 +++--- > koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt | 3 ++- > .../intranet-tmpl/prog/en/modules/circ/set-library.tt | 2 +- > .../prog/en/modules/labels/label-edit-batch.tt | 1 - > .../intranet-tmpl/prog/en/modules/labels/label-manage.tt | 1 - > .../prog/en/modules/patroncards/edit-batch.tt | 1 - > .../intranet-tmpl/prog/en/modules/patroncards/manage.tt | 1 - > koha-tmpl/opac-tmpl/bootstrap/en/includes/bodytag.inc | 5 +++-- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 2 +- > 15 files changed, 18 insertions(+), 24 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 6889c2532c..449cfecd7b 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -462,7 +462,6 @@ sub get_template_and_user { > 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, >@@ -490,7 +489,6 @@ sub get_template_and_user { > 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"), >@@ -558,7 +556,6 @@ sub get_template_and_user { > 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"), >diff --git a/circ/set-library.pl b/circ/set-library.pl >index 375a7f7809..35b013ca33 100755 >--- a/circ/set-library.pl >+++ b/circ/set-library.pl >@@ -49,14 +49,13 @@ my @updated; > 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 { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >index 868b22a418..ef6cf61c70 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >@@ -77,11 +77,11 @@ > <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 %] >@@ -97,11 +97,11 @@ > <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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >index c9cbea57bf..bebe5a143c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -120,7 +120,7 @@ > </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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >index 83dc7e30d1..b64911f96a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >@@ -64,7 +64,7 @@ > > [% 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"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index efbf34fb5d..33158835de 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -174,7 +174,7 @@ > <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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt >index 37744f6aa4..2fe5e873a2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt >@@ -1,14 +1,14 @@ > [% 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"> >@@ -19,7 +19,7 @@ > [% 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"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt >index a46d4e78dd..012033cfba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt >@@ -1,5 +1,6 @@ > [% USE raw %] > [% USE Asset %] >+[% USE Branches %] > [% SET footerjs = 1 %] > <!DOCTYPE html> > [% IF (AllowOfflineCirculation) %] >@@ -314,7 +315,7 @@ > > 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(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt >index 325b17eb9f..14784e7d98 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt >@@ -36,7 +36,7 @@ > 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 %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >index 27282a95b9..b735ebf9ef 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt >@@ -57,7 +57,6 @@ > [% 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;"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt >index 08c5e5d8a2..86e8fa2200 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt >@@ -42,7 +42,6 @@ > [% 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' ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt >index 459f7d8cda..e786485684 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt >@@ -38,7 +38,6 @@ > > [% 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;"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt >index 2df180a814..87ab3083a4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt >@@ -45,7 +45,6 @@ > [% 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> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/bodytag.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/bodytag.inc >index ab56ed53d3..8730eb5f5b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/bodytag.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/bodytag.inc >@@ -1,7 +1,8 @@ > [% 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 %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index 554af2f760..2c6b848b33 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -479,7 +479,7 @@ > [% ELSE %] > <li id="tab_holdings"> > [% END %] >- [% BLOCK holding_tab_title %][% IF SeparateHoldings %]<span>[% LoginBranchname | html %] holdings</span>[% ELSE %]<span>Holdings</span>[% END %][% END %] >+ [% BLOCK holding_tab_title %][% IF SeparateHoldings %]<span>[% Branches.GetLoggedInBranchname | html %] holdings</span>[% ELSE %]<span>Holdings</span>[% END %][% END %] > <a href="#holdings">[% PROCESS holding_tab_title %] [% UNLESS too_many_items %][% ' ( ' _ (itemloop.size || 0) _ ' )' | html %][% END %]</a> > </li> > [% IF (SeparateHoldings) %] >-- >2.27.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 25765
:
105909
|
105910
|
106357
|
106358
|
107154
|
107155
|
107156
|
107157