From 4a8f85279807950d81f38133ca3aee45fb1a3eb4 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Fri, 10 Jan 2014 00:06:21 -0500 Subject: [PATCH] Bug 11513 - Warnings in Patron categories TEST PLAN --------- 1) Log in to staff client 2) Click 'Administration' 3) Click 'Patron categories' 4) Review error log, several warnings. 5) Apply patch 6) Refresh page 7) Review error log, no warnings. --- admin/categorie.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/admin/categorie.pl b/admin/categorie.pl index 952ef7a..d820414 100755 --- a/admin/categorie.pl +++ b/admin/categorie.pl @@ -49,8 +49,10 @@ use C4::Form::MessagingPreferences; sub StringSearch { my ($searchstring,$type)=@_; my $dbh = C4::Context->dbh; + $searchstring //= ''; $searchstring=~ s/\'/\\\'/g; my @data=split(' ',$searchstring); + push @data,q{} if $#data==-1; my $count=@data; my $sth=$dbh->prepare("Select * from categories where (description like ?) order by category_type,description,categorycode"); $sth->execute("$data[0]%"); @@ -67,7 +69,7 @@ my $input = new CGI; my $searchfield=$input->param('description'); my $script_name="/cgi-bin/koha/admin/categorie.pl"; my $categorycode=$input->param('categorycode'); -my $op = $input->param('op'); +my $op = $input->param('op') // ''; my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "admin/categorie.tmpl", @@ -240,11 +242,14 @@ if ($op eq 'add_form') { while ( my $branch = $sth->fetchrow_hashref ) { push @selected_branches, $branch; } + my $enrolmentperioddate = $results->[$i]{'enrolmentperioddate'}; + $enrolmentperioddate = undef if $enrolmentperioddate eq '0000-00-00'; + $enrolmentperioddate = C4::Dates::format_date($enrolmentperioddate); my %row = ( categorycode => $results->[$i]{'categorycode'}, description => $results->[$i]{'description'}, enrolmentperiod => $results->[$i]{'enrolmentperiod'}, - enrolmentperioddate => C4::Dates::format_date($results->[$i]{'enrolmentperioddate'}), + enrolmentperioddate => $enrolmentperioddate, upperagelimit => $results->[$i]{'upperagelimit'}, dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, enrolmentfee => sprintf("%.2f",$results->[$i]{'enrolmentfee'}), -- 1.7.9.5