X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=members%2Fmember.pl;h=d25dba9d181fd0763b8f5d03b78868f374618834;hb=b4e255e4d76600f2580706f71651a02a5608300e;hp=d759c31c9b619a48d869857494f2583bdd028e01;hpb=c0234dd9b9649063acf2617fecf5c6efda38a532;p=koha_fer diff --git a/members/member.pl b/members/member.pl index d759c31c9b..d25dba9d18 100755 --- a/members/member.pl +++ b/members/member.pl @@ -58,7 +58,8 @@ my $branches = GetBranches; my @branchloop; foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { - my $selected = 1 if $branches->{$_}->{branchcode} eq $$patron{branchcode}; + my $selected; + $selected = 1 if $branches->{$_}->{branchcode} eq $$patron{branchcode}; my %row = ( value => $_, selected => $selected, branchname => $branches->{$_}->{branchname}, @@ -94,6 +95,9 @@ 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; @@ -104,7 +108,7 @@ my ($count,$results); if ($member || keys %$patron) { #($results)=Search($member || $patron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"] ); my $search_scope = ( $quicksearch ? "field_start_with" : "start_with" ); - ($results) = Search( $member || $patron, \@orderby, undef, undef, [ "firstname", "surname", "othernames", "cardnumber", "userid", "email" ], $search_scope ); + ($results) = Search( $member || $patron, \@orderby, undef, undef, \@searchfields, $search_scope ); } if ($results) { @@ -131,12 +135,13 @@ foreach my $borrower(@$results[$from..$to-1]){ my %row = ( count => $index++, - %$borrower, - %{$categories_dislay{$$borrower{categorycode}}}, + %$borrower, + (defined $categories_dislay{ $borrower->{categorycode} }? %{ $categories_dislay{ $borrower->{categorycode} } }:()), overdues => $od, issues => $issue, odissue => "$od/$issue", fines => sprintf("%.2f",$fines), + branchname => $branches->{$borrower->{branchcode}}->{branchname}, ); push(@resultsdata, \%row); }