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 with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
26 use C4
::Dates qw
/format_date/;
31 my $dbh = C4
::Context
->dbh;
33 my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user
(
34 { template_name
=> "admin/aqbudget_owner_search.tmpl",
38 flagsrequired
=> { acquisition
=> 'budget_modify' },
43 my $theme = $input->param('theme') || "default";
45 # only used if allowthemeoverride is set
46 my $member = $input->param('member');
47 my $orderby = $input->param('orderby');
49 my $op = $input->param('op');
50 $template->param( $op || else => 1, );
52 $orderby = "surname,firstname" unless $orderby;
53 $member =~ s/,//g; #remove any commas from search string
55 if ( $member eq '' ) {
56 $template->param( results
=> 0 );
58 $template->param( results
=> 1 );
61 my ( $count, $count2, $results );
66 my $results= SearchMember
($member,"surname",undef,undef,undef);
68 foreach my $res (@
$results) {
70 my $perms = haspermission
( $res->{'userid'} );
71 my $subperms = get_user_subpermissions
($res->{'userid'} );
74 # if the member has 'acqui' permission set, then display to table.
75 if ( $perms->{superlibrarian
} == 1 ||
76 $perms->{acquisition
} == 1 ||
77 $subperms->{acquisition
}->{'budget_manage'} ||
78 $subperms->{acquisition
}->{'budget_modify'} ||
79 $subperms->{acquisition
}->{'budget_add_del'} ) {
83 # my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $res->{'borrowerid'} );
84 #This looks unused and very unuseful
85 my $guarantorinfo = uc( $res->{'surname'} ) . " , " . ucfirst( $res->{'firstname'} );
86 my $budget_owner_name = $res->{'firstname'} . ' ' . $res->{'surname'}, my $budget_owner_id = $res->{'borrowernumber'};
89 borrowernumber
=> $res->{'borrowernumber'},
90 cardnumber
=> $res->{'cardnumber'},
91 surname
=> $res->{'surname'},
92 firstname
=> $res->{'firstname'},
93 categorycode
=> $res->{'categorycode'},
94 branchcode
=> $res->{'branchcode'},
95 guarantorinfo
=> $guarantorinfo,
96 budget_owner_id
=> $budget_owner_id,
97 budget_owner_name
=> $budget_owner_name,
98 # odissue => "$od/$issue",
100 # borrowernotes => $res->{'borrowernotes'}
102 push( @resultsdata, \
%row );
110 resultsloop
=> \
@resultsdata
113 output_html_with_http_headers
$input, $cookie, $template->output;