X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=members%2Fmember.pl;h=bef33234573912818b9517c032cd2304c77e8f78;hb=d78c28db7b50dbda53f758390cdcf46b2f8c58e0;hp=724c99655b70aa8d5f0ba37466d8b57b9920c7e9;hpb=75a4efa7042a8d15ba7832d67b8670282da3abbc;p=koha_fer diff --git a/members/member.pl b/members/member.pl index 724c99655b..bef3323457 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}, @@ -75,10 +76,11 @@ foreach my $category (@categories){ }; $categories_dislay{$$category{categorycode}} = $hash; } +my $AddPatronLists = C4::Context->preference("AddPatronLists") || ''; $template->param( - "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1", + "AddPatronLists_$AddPatronLists" => "1", ); -if (C4::Context->preference("AddPatronLists")=~/code/){ +if ($AddPatronLists=~/code/){ $categories[0]->{'first'}=1; } @@ -93,20 +95,21 @@ 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 ($count,$results); - -my @searchpatron; -push @searchpatron, $member if ($member); -push @searchpatron, $patron if ( keys %$patron ); my $from = ( $startfrom - 1 ) * $resultsperpage; my $to = $from + $resultsperpage; -#($results)=Search(\@searchpatron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"] ) if (@searchpatron); -my $search_scope = ( $quicksearch ? "field_start_with" : "start_with" ); -($results) = Search( \@searchpatron, \@orderby, undef, undef, [ "firstname", "surname", "othernames", "cardnumber", "userid" ], $search_scope ) if (@searchpatron); +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, \@searchfields, $search_scope ); +} if ($results) { for my $field ('categorycode','branchcode'){