3 # script to find a basket user
5 # Copyright 2012 BibLibre SARL
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along
19 # with Koha; if not, write to the Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 my $dbh = C4
::Context
->dbh;
33 my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user
(
34 { template_name
=> "acqui/aqbasketuser_search.tt",
38 flagsrequired
=> { acquisition
=> 'order_manage' },
42 my $q = $input->param('q') || '';
43 my $op = $input->param('op') || '';
45 if( $op eq "do_search" ) {
46 my $results = C4
::Members
::Search
( $q, "surname");
50 foreach my $res (@
$results) {
51 my $perms = haspermission
( $res->{userid
} );
52 my $subperms = get_user_subpermissions
( $res->{userid
} );
54 if( $perms->{superlibrarian
} == 1
55 || $perms->{acquisition
} == 1
56 || $subperms->{acquisition
}->{'order_manage'} ) {
58 borrowernumber
=> $res->{borrowernumber
},
59 cardnumber
=> $res->{cardnumber
},
60 surname
=> $res->{surname
},
61 firstname
=> $res->{firstname
},
62 categorycode
=> $res->{categorycode
},
63 branchcode
=> $res->{branchcode
},
65 push( @users_loop, \
%row );
72 nresults
=> $nresults,
73 users_loop
=> \
@users_loop,
77 output_html_with_http_headers
( $input, $cookie, $template->output );