Bug 19532: (RM follow-up) More use of system preference
[srvgit] / circ / ysearch.pl
index 75f6f1d..efe1a62 100755 (executable)
@@ -30,6 +30,7 @@ use C4::Context;
 use C4::Auth qw( check_cookie_auth );
 use Koha::Patrons;
 use Koha::DateUtils qw( format_sqldatetime );
+use Koha::Libraries;
 
 use JSON qw( to_json );
 
@@ -39,7 +40,7 @@ my $query = $input->param('term');
 binmode STDOUT, ":encoding(UTF-8)";
 print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
 
-my ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => '1' } );
+my ( $auth_status ) = check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => '1' } );
 if ( $auth_status ne "ok" ) {
     exit 0;
 }
@@ -74,6 +75,7 @@ my $borrowers_rs = Koha::Patrons->search_limited(
         page     => 1,
         rows     => 10,
         order_by => [ 'surname', 'firstname' ],
+        prefetch => 'branchcode',
     },
 );
 
@@ -90,6 +92,8 @@ while ( my $b = $borrowers_rs->next ) {
         city           => $b->city       // '',
         zipcode        => $b->zipcode    // '',
         country        => $b->country    // '',
+        branchcode     => $b->branchcode // '',
+        branchname     => $b->library->branchname // '',
       };
 }