From df02bd82c617b322baf1844a8466d5a989cd6c0f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 27 Dec 2012 14:18:34 +0100 Subject: [PATCH] Bug 8845: Followup Allow to give a date using the syspref format --- members/member.pl | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/members/member.pl b/members/member.pl index d25dba9..ebf1990 100755 --- a/members/member.pl +++ b/members/member.pl @@ -31,6 +31,7 @@ use CGI; use C4::Members; use C4::Branch; use C4::Category; +use Koha::DateUtils; use File::Basename; my $input = new CGI; @@ -95,20 +96,24 @@ else { @orderby = ({surname=>0},{firstname=>0}); } -my $searchfields = $input->param('searchfields'); -my @searchfields = $searchfields ? split( ',', $searchfields ) : ( "firstname", "surname", "othernames", "cardnumber", "userid", "email" ); - -$member =~ s/,//g; #remove any commas from search string -$member =~ s/\*/%/g; - my $from = ( $startfrom - 1 ) * $resultsperpage; my $to = $from + $resultsperpage; my ($count,$results); if ($member || keys %$patron) { - #($results)=Search($member || $patron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"] ); + my $searchfields = $input->param('searchfields'); + my @searchfields = $searchfields ? split( ',', $searchfields ) : ( "firstname", "surname", "othernames", "cardnumber", "userid", "email" ); + + $member =~ s/,//g; #remove any commas from search string + $member =~ s/\*/%/g; + my $search = $member || $patron; + + if ( $searchfields eq "dateofbirth" ) { + $search = output_pref(dt_from_string($search), 'iso', 1); + } + my $search_scope = ( $quicksearch ? "field_start_with" : "start_with" ); - ($results) = Search( $member || $patron, \@orderby, undef, undef, \@searchfields, $search_scope ); + ($results) = Search( $search, \@orderby, undef, undef, \@searchfields, $search_scope ); } if ($results) { -- 1.7.10.4