Maori updated for 3.2.x
[koha_fer] / circ / ysearch.pl
index ee383aa..c7a9b67 100755 (executable)
@@ -32,6 +32,7 @@ use C4::Auth qw/check_cookie_auth/;
 my $input   = new CGI;
 my $query   = $input->param('query');
 
+binmode STDOUT, ":utf8";
 print $input->header(-type => 'text/plain', -charset => 'UTF-8');
 
 my ($auth_status, $sessionID) = check_cookie_auth($input->cookie('CGISESSID'), { circulate => '*' });
@@ -40,19 +41,21 @@ if ($auth_status ne "ok") {
 }
 
 my $dbh = C4::Context->dbh;
-my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode 
+my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode, country 
              FROM borrowers 
              WHERE surname LIKE ?
              OR firstname LIKE ?
+             OR cardnumber LIKE ?
              ORDER BY surname, firstname);
-            #"OR cardnumber LIKE '" . $query . "%' " . 
 my $sth = $dbh->prepare( $sql );
-$sth->execute("$query%", "$query%");
+$sth->execute("$query%", "$query%", "$query%");
+
 while ( my $rec = $sth->fetchrow_hashref ) {
     print $rec->{surname} . ", " . $rec->{firstname} . "\t" .
           $rec->{cardnumber} . "\t" .
           $rec->{address} . "\t" .
           $rec->{city} . "\t" .
-          $rec->{zip} .
+          $rec->{zip} . "\t" .
+          $rec->{country} .
           "\n";
 }