From 78f78672f098d890e792b172f7a88030f746c966 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 6 Jun 2016 14:21:01 +0100 Subject: [PATCH] Bug 14874: Tidy previous patch remove debug statements remove useless add of new var $termsearchfieldstype rename term_is_dt with term_dt (term_is_dt is not a boolean but a dt) --- C4/Utils/DataTables/Members.pm | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index 720cbf0..b91a1e4 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -88,22 +88,20 @@ sub search { foreach my $term (@terms) { next unless $term; - my $termsearchfieldstype; - my $term_is_dt = eval { local $SIG{__WARN__}={}; Koha::DateUtils::output_pref( { str=>$term, dateonly=>1, dateformat=>'sql' } ); }; + my $term_dt = eval { local $SIG{__WARN__} = {}; output_pref( { str => $term, dateonly => 1, dateformat => 'sql' } ); }; - if ( $term_is_dt ){ - $termsearchfieldstype = 'dateofbirth' ; - $term = $term_is_dt; + if ($term_dt) { + $searchfieldstype = 'dateofbirth'; + $term = $term_dt; } else { - $termsearchfieldstype = $searchfieldstype; - $term .= '%' # end with anything - if $term !~ /%$/; - $term = "%$term" # begin with anythin unless start_with - if $searchtype eq 'contain' && $term !~ /^%/; + $term .= '%' # end with anything + if $term !~ /%$/; + $term = "%$term" # begin with anythin unless start_with + if $searchtype eq 'contain' && $term !~ /^%/; } my @where_strs_or; - for my $searchfield ( split /,/, $searchfields->{$termsearchfieldstype} ) { + for my $searchfield ( split /,/, $searchfields->{$searchfieldstype} ) { push @where_strs_or, "borrowers." . $dbh->quote_identifier($searchfield) . " LIKE ?"; push @where_args, $term; } @@ -145,8 +143,6 @@ sub search { ($limit ? $limit : "") ); my $sth = $dbh->prepare($query); - warn Data::Dumper::Dumper( $query ); - warn Data::Dumper::Dumper( @where_args ); $sth->execute(@where_args); my $patrons = $sth->fetchall_arrayref({}); -- 2.1.4