Merge branch 'translation' of git://git.workbuffer.org/git/koha into master
[srvgit] / members / member.pl
index aaa3c0e..755a051 100755 (executable)
@@ -31,7 +31,6 @@ use C4::Members;
 use C4::Branch;
 use C4::Category;
 use File::Basename;
-use YAML;
 
 my $input = new CGI;
 my $quicksearch = $input->param('quicksearch');
@@ -80,7 +79,7 @@ if ($orderbyparams){
        push @orderby, {$orderbyelt[0]=>$orderbyelt[1]||0};
 }
 else {
-       @orderby = ({firstname=>1},{surname=>1});
+       @orderby = ({surname=>0},{firstname=>0});
 }
 
 $member =~ s/,//g;   #remove any commas from search string
@@ -94,13 +93,13 @@ 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");
+ my $search_scope=($quicksearch?"field_start_with":"contain");
  ($results)=Search(\@searchpatron,\@orderby,undef,undef,["firstname","surname","email","othernames","cardnumber","userid"],$search_scope  ) if (@searchpatron);
 if ($results){
        $count =scalar(@$results);
 }
 my @resultsdata;
-my $to=($count>$to?$to:$count);
+$to=($count>$to?$to:$count);
 my $index=$from;
 foreach my $borrower(@$results[$from..$to-1]){
   #find out stats
@@ -147,7 +146,8 @@ $template->param( letters => \@letters );
 
 $template->param(
     paginationbar => pagination_bar(
-        $base_url,  int( $count / $resultsperpage ) + 1,
+        $base_url,
+        int( $count / $resultsperpage ) + ($count % $resultsperpage ? 1 : 0),
         $startfrom, 'startfrom'
     ),
     startfrom => $startfrom,
@@ -157,7 +157,7 @@ $template->param(
 );
 $template->param(
     branchloop=>$branches,
-       categoryloop=>\@categories,
+    categories=>\@categories,
 );