|
Lines 31-36
use CGI;
Link Here
|
| 31 |
use C4::Members; |
31 |
use C4::Members; |
| 32 |
use C4::Branch; |
32 |
use C4::Branch; |
| 33 |
use C4::Category; |
33 |
use C4::Category; |
|
|
34 |
use Koha::DateUtils; |
| 34 |
use File::Basename; |
35 |
use File::Basename; |
| 35 |
|
36 |
|
| 36 |
my $input = new CGI; |
37 |
my $input = new CGI; |
|
Lines 95-119
else {
Link Here
|
| 95 |
@orderby = ({surname=>0},{firstname=>0}); |
96 |
@orderby = ({surname=>0},{firstname=>0}); |
| 96 |
} |
97 |
} |
| 97 |
|
98 |
|
| 98 |
my $searchfields = $input->param('searchfields'); |
|
|
| 99 |
my @searchfields = $searchfields ? split( ',', $searchfields ) : ( "firstname", "surname", "othernames", "cardnumber", "userid", "email" ); |
| 100 |
|
| 101 |
$member =~ s/,//g; #remove any commas from search string |
99 |
$member =~ s/,//g; #remove any commas from search string |
| 102 |
$member =~ s/\*/%/g; |
100 |
$member =~ s/\*/%/g; |
| 103 |
|
101 |
|
| 104 |
my $searchtype = $input->param('searchtype'); |
|
|
| 105 |
my %searchtype_ok = ( 'contain' => 1 ); |
| 106 |
if ( !defined($searchtype_ok{$searchtype}) ) { |
| 107 |
undef $searchtype; |
| 108 |
} |
| 109 |
|
| 110 |
my $from = ( $startfrom - 1 ) * $resultsperpage; |
102 |
my $from = ( $startfrom - 1 ) * $resultsperpage; |
| 111 |
my $to = $from + $resultsperpage; |
103 |
my $to = $from + $resultsperpage; |
| 112 |
|
104 |
|
| 113 |
my ($count,$results); |
105 |
my ($count,$results); |
| 114 |
if ($member || keys %$patron) { |
106 |
if ($member || keys %$patron) { |
| 115 |
#($results)=Search($member || $patron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"] ); |
107 |
my $searchfields = $input->param('searchfields'); |
| 116 |
my $search_scope = $searchtype || ( $quicksearch ? "field_start_with" : "start_with" ); |
108 |
my @searchfields = $searchfields ? split( ',', $searchfields ) : ( "firstname", "surname", "othernames", "cardnumber", "userid", "email" ); |
|
|
109 |
|
| 110 |
if ( $searchfields eq "dateofbirth" ) { |
| 111 |
$member = output_pref(dt_from_string($member), 'iso', 1); |
| 112 |
} |
| 113 |
|
| 114 |
my $search_scope = ( $quicksearch ? "field_start_with" : "start_with" ); |
| 117 |
($results) = Search( $member || $patron, \@orderby, undef, undef, \@searchfields, $search_scope ); |
115 |
($results) = Search( $member || $patron, \@orderby, undef, undef, \@searchfields, $search_scope ); |
| 118 |
} |
116 |
} |
| 119 |
|
117 |
|
| 120 |
- |
|
|