3 # script to find owner and users for a budget
5 # Copyright 2008-2009 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.
27 use C4::Dates qw/format_date/;
32 my $dbh = C4::Context->dbh;
34 my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user(
35 { template_name => "admin/aqbudget_user_search.tt",
39 flagsrequired => { acquisition => 'budget_modify' },
44 # only used if allowthemeoverride is set
45 my $type = $input->param('type');
46 my $member = $input->param('member') // '';
48 $member =~ s/,//g; #remove any commas from search string
50 if ( $member eq '' ) {
51 $template->param( results => 0 );
53 $template->param( results => 1 );
59 my $results = Search($member, "surname");
61 foreach my $res (@$results) {
62 my $perms = haspermission( $res->{'userid'} );
63 my $subperms = get_user_subpermissions( $res->{'userid'} );
65 # if the member has 'acqui' permission set, then display to table.
66 if ( $perms->{superlibrarian} == 1 ||
67 $perms->{acquisition} == 1 ||
68 exists $subperms->{acquisition} )
71 borrowernumber => $res->{'borrowernumber'},
72 cardnumber => $res->{'cardnumber'},
73 surname => $res->{'surname'},
74 firstname => $res->{'firstname'},
75 categorycode => $res->{'categorycode'},
76 branchcode => $res->{'branchcode'},
78 push( @resultsdata, \%row );
86 resultsloop => \@resultsdata
89 output_html_with_http_headers $input, $cookie, $template->output;