Bugzilla – Attachment 98936 Details for
Bug 21746
Remove NO_LIBRARY_SET
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21746: Remove GetLoggedInBranchcode
Bug-21746-Remove-GetLoggedInBranchcode.patch (text/plain), 7.23 KB, created by
Jonathan Druart
on 2020-02-14 12:07:50 UTC
(
hide
)
Description:
Bug 21746: Remove GetLoggedInBranchcode
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-02-14 12:07:50 UTC
Size:
7.23 KB
patch
obsolete
>From ae1765c8027cef9b568cedd4df81f349a01c55b5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 14 Feb 2020 12:45:54 +0100 >Subject: [PATCH] Bug 21746: Remove GetLoggedInBranchcode > >This method from the Branches TT plugin is not needed as we can use >logged_in_user >--- > Koha/Template/Plugin/Branches.pm | 8 -------- > koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt | 2 +- > t/db_dependent/Template/Plugin/Branches.t | 7 +------ > 7 files changed, 6 insertions(+), 19 deletions(-) > >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index 08dbcb5c1a..27512f6e01 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -37,14 +37,6 @@ sub GetName { > return $b ? $b->{'branchname'} : q{}; > } > >-sub GetLoggedInBranchcode { >- my ($self) = @_; >- >- return C4::Context->userenv ? >- C4::Context->userenv->{'branch'} : >- ''; >-} >- > sub GetURL { > my ( $self, $branchcode ) = @_; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 1eeb19e3af..e01d17b3db 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -787,7 +787,7 @@ > Hold placed on [% w.reservedate | $KohaDates %]. > > <br/> >- [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode() ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %] >+ [% IF ( w.branch.branchcode == logged_in_user.branchcode ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %] > [% SET expires_on = w.expirationdate %] > Waiting at [% w.branch.branchname | html %] [% IF expires_on %] until [% expires_on | $KohaDates %] [% END %] > </strong> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >index e2257fc8e5..ead954802a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt >@@ -136,7 +136,7 @@ > <label for="branchcode">Pickup library:</label> > <select name="branchcode" id="branchcode"> > [% FOREACH b IN Branches.all %] >- [% IF b.branchcode == Branches.GetLoggedInBranchcode %] >+ [% IF b.branchcode == logged_in_user.branchcode %] > <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option> > [% ELSE %] > <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 19e573752d..fb1ecc20f2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -862,7 +862,7 @@ > var interface = "[% interface | html %]"; > var theme = "[% theme | html %]"; > var borrowernumber = "[% patron.borrowernumber | html %]"; >- var branchcode = "[% Branches.GetLoggedInBranchcode() | html %]"; >+ var branchcode = "[% logged_in_user.branchcode | html %]"; > var exports_enabled = "[% Koha.Preference('ExportCircHistory') | html %]"; > var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 | html %] > var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 | html %]; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt >index df223c78c5..b698415faf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt >@@ -52,7 +52,7 @@ > </form> > [% END %] > [% ELSE %] >- <h1>Batch patron deletion and anonymization for [% Branches.GetName( Branches.GetLoggedInBranchcode ) | html %]</h1> >+ <h1>Batch patron deletion and anonymization for [% logged_in_user.library.branchname | html %]</h1> > [% END %] > > [% IF step == 1 %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt >index b5c0de07b3..82cdc039bf 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt >@@ -112,7 +112,7 @@ > <label for="branchcode">Pickup library:</label> > <select name="branchcode" id="branchcode" required="required"> > [% FOREACH b IN Branches.all %] >- [% IF b.branchcode == Branches.GetLoggedInBranchcode %] >+ [% IF b.branchcode == logged_in_user.library.branchcode %] > <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option> > [% ELSE %] > <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option> >diff --git a/t/db_dependent/Template/Plugin/Branches.t b/t/db_dependent/Template/Plugin/Branches.t >index be0d1134f9..61374e571c 100644 >--- a/t/db_dependent/Template/Plugin/Branches.t >+++ b/t/db_dependent/Template/Plugin/Branches.t >@@ -39,7 +39,7 @@ my $builder = t::lib::TestBuilder->new; > > subtest 'all() tests' => sub { > >- plan tests => 16; >+ plan tests => 14; > > $schema->storage->txn_begin; > >@@ -68,12 +68,7 @@ subtest 'all() tests' => sub { > $name = $plugin->GetName(undef); > is($name, '', 'received empty string as name of NULL/undefined library code'); > >- $library = $plugin->GetLoggedInBranchcode(); >- is($library, '', 'no active library if there is no active user session'); >- > t::lib::Mocks::mock_userenv({ branchcode => 'MYLIBRARY' }); >- $library = $plugin->GetLoggedInBranchcode(); >- is($library, 'MYLIBRARY', 'GetLoggedInBranchcode() returns active library'); > > t::lib::Mocks::mock_preference( 'IndependentBranches', 0 ); > my $libraries = $plugin->all(); >-- >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 21746
:
98934
|
98935
|
98936
|
98937
|
99071
|
99681
|
99833