3 # script to find a guarantor
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.
23 #use warnings; FIXME - Bug 2505
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_owner_search.tmpl",
39 flagsrequired
=> { acquisition
=> 'budget_modify' },
44 my $theme = $input->param('theme') || "default";
46 # only used if allowthemeoverride is set
47 my $member = $input->param('member');
48 my $orderby = $input->param('orderby');
50 my $op = $input->param('op');
51 $template->param( $op || else => 1, );
53 $orderby = "surname,firstname" unless $orderby;
54 $member =~ s/,//g; #remove any commas from search string
56 if ( $member eq '' ) {
57 $template->param( results
=> 0 );
59 $template->param( results
=> 1 );
62 my ( $count, $count2, $results );
67 my $results= SearchMember
($member,"surname",undef,undef,undef);
69 foreach my $res (@
$results) {
71 my $perms = haspermission
( $res->{'userid'} );
72 my $subperms = get_user_subpermissions
($res->{'userid'} );
75 # if the member has 'acqui' permission set, then display to table.
76 if ( $perms->{superlibrarian
} == 1 ||
77 $perms->{acquisition
} == 1 ||
78 $subperms->{acquisition
}->{'budget_manage'} ||
79 $subperms->{acquisition
}->{'budget_modify'} ||
80 $subperms->{acquisition
}->{'budget_add_del'} ) {
84 # my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $res->{'borrowerid'} );
85 #This looks unused and very unuseful
86 my $guarantorinfo = uc( $res->{'surname'} ) . " , " . ucfirst( $res->{'firstname'} );
87 my $budget_owner_name = $res->{'firstname'} . ' ' . $res->{'surname'}, my $budget_owner_id = $res->{'borrowernumber'};
90 borrowernumber
=> $res->{'borrowernumber'},
91 cardnumber
=> $res->{'cardnumber'},
92 surname
=> $res->{'surname'},
93 firstname
=> $res->{'firstname'},
94 categorycode
=> $res->{'categorycode'},
95 branchcode
=> $res->{'branchcode'},
96 guarantorinfo
=> $guarantorinfo,
97 budget_owner_id
=> $budget_owner_id,
98 budget_owner_name
=> $budget_owner_name,
99 # odissue => "$od/$issue",
101 # borrowernotes => $res->{'borrowernotes'}
103 push( @resultsdata, \
%row );
111 resultsloop
=> \
@resultsdata
114 output_html_with_http_headers
$input, $cookie, $template->output;