Bugzilla – Attachment 5298 Details for
Bug 6840
error in Template.pm in logs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-Bug-6840-warning-in-logs.patch (text/plain), 2.06 KB, created by
Paul Poulain
on 2011-09-02 16:40:27 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2011-09-02 16:40:27 UTC
Size:
2.06 KB
patch
obsolete
>From 884a09ccedb57ead00936bbbae728f71168c57d5 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Fri, 2 Sep 2011 18:39:53 +0200 >Subject: [PATCH] Bug 6840 warning in logs > >In staff interface, in search (catalogue/search.pl), there is a warning saying: >[Fri Sep 2 18:20:24 2011] search.pl: Use of uninitialized value $key in hash >element at /home/paul/koha.dev/koha-community/C4/Templates.pm line 227. > >The problem happens when searching from the quick search toolbar, not when you >search from advanced search. >Investigating, it seems it's because the sort_by is not defined in this case. > > >This patch >* fixes the problem in Search.pl by setting the parameter only if there is a sort_by field >* modify te Template->param sub to get a better error message. Instead of having just "use of uninitia..." get the value you try to set to an empty key. Much easier to understand which line causes the problem >--- > C4/Templates.pm | 6 +++++- > catalogue/search.pl | 2 +- > 2 files changed, 6 insertions(+), 2 deletions(-) > >diff --git a/C4/Templates.pm b/C4/Templates.pm >index 4368492..b7751f6 100644 >--- a/C4/Templates.pm >+++ b/C4/Templates.pm >@@ -224,7 +224,11 @@ sub param { > my $val = shift; > if ( ref($val) eq 'ARRAY' && !scalar @$val ) { $val = undef; } > elsif ( ref($val) eq 'HASH' && !scalar %$val ) { $val = undef; } >- $self->{VARS}->{$key} = $val; >+ if ( $key ) { >+ $self->{VARS}->{$key} = $val; >+ } else { >+ warn "Problem = a value of $val has been passed to param without key"; >+ } > } > } > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index b9f9ed3..ec97d81 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -369,7 +369,7 @@ if ( C4::Context->preference('defaultSortField') > @sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'}; > $sort_by[0] = $default_sort_by unless $sort_by[0]; > foreach my $sort (@sort_by) { >- $template->param($sort => 1); >+ $template->param($sort => 1) if $sort; > } > $template->param('sort_by' => $sort_by[0]); > >-- >1.7.4.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 6840
:
5298
|
5671