Bugzilla – Attachment 131183 Details for
Bug 29826
Manage call of Template Plugin Branches GetName() with null or empty branchcode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29826: Manage call of Template Plugin Branches GetName() with null or empty branchcode
Bug-29826-Manage-call-of-Template-Plugin-Branches-.patch (text/plain), 2.40 KB, created by
Martin Renvoize
on 2022-03-01 14:59:01 UTC
(
hide
)
Description:
Bug 29826: Manage call of Template Plugin Branches GetName() with null or empty branchcode
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2022-03-01 14:59:01 UTC
Size:
2.40 KB
patch
obsolete
>From baa1f3f68558beef4c187cb8748afd3496016622 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 7 Jan 2022 15:34:49 -1000 >Subject: [PATCH] Bug 29826: Manage call of Template Plugin Branches GetName() > with null or empty branchcode > >Bug 26587 added a concatenation that sends a warning if var is undef : >$ prove t/db_dependent/Template/Plugin/Branches.t >Use of uninitialized value $branchcode in concatenation (.) or string at /kohadevbox/koha/Koha/Template/Plugin/Branches.pm line 35. > >This patch adds an early return empty string when GetName is called with $branchcode null or empty string. > >Test plan : >1) Run t/db_dependent/Template/Plugin/Branches.t without patch >2) Run with the patch to see warning disappear > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Template/Plugin/Branches.pm | 2 ++ > t/db_dependent/Template/Plugin/Branches.t | 5 ++++- > 2 files changed, 6 insertions(+), 1 deletion(-) > >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index 2cdb1be81d..981c5b413d 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -30,6 +30,8 @@ use Koha::Libraries; > > sub GetName { > my ( $self, $branchcode ) = @_; >+ return q{} unless defined $branchcode; >+ return q{} if $branchcode eq q{}; > > my $memory_cache = Koha::Cache::Memory::Lite->get_instance; > my $cache_key = "Library_branchname:" . $branchcode; >diff --git a/t/db_dependent/Template/Plugin/Branches.t b/t/db_dependent/Template/Plugin/Branches.t >index 3957887525..a1145d6693 100755 >--- a/t/db_dependent/Template/Plugin/Branches.t >+++ b/t/db_dependent/Template/Plugin/Branches.t >@@ -38,7 +38,7 @@ my $builder = t::lib::TestBuilder->new; > > subtest 'all() tests' => sub { > >- plan tests => 18; >+ plan tests => 19; > > $schema->storage->txn_begin; > >@@ -68,6 +68,9 @@ subtest 'all() tests' => sub { > $name = $plugin->GetName(undef); > is($name, '', 'received empty string as name of NULL/undefined library code'); > >+ $name = $plugin->GetName(q{}); >+ is($name, '', 'received empty string as name of empty string library code'); >+ > is($plugin->GetLoggedInBranchcode(), '', 'no active library code if there is no active user session'); > is($plugin->GetLoggedInBranchname(), '', 'no active library name if there is no active user session'); > >-- >2.20.1
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 29826
:
129208
|
129630
|
130030
|
130201
| 131183