5 #script to delete items
10 # Copyright 2000-2002 Katipo Communications
12 # This file is part of Koha.
14 # Koha is free software; you can redistribute it and/or modify it under the
15 # terms of the GNU General Public License as published by the Free Software
16 # Foundation; either version 2 of the License, or (at your option) any later
19 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
21 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License along with
24 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
25 # Suite 330, Boston, MA 02111-1307 USA
33 use C4::Circulation::Circ2;
34 #use C4::Acquisitions;
41 $flagsrequired->{borrower}=1;
42 my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
46 #print $input->header;
47 my $member=$input->param('member');
49 $env{'nottodayissues'}=1;
51 $member2{'borrowernumber'}=$member;
52 my $issues=currentissues(\%env,\%member2);
54 foreach (sort keys %$issues) {
57 my ($bor,$flags)=getpatroninformation(\%env, $member,'');
58 my $dbh = C4::Context->dbh;
59 my $sth=$dbh->prepare("Select * from borrowers where guarantor=?");
60 $sth->execute($member);
61 my $data=$sth->fetchrow_hashref;
65 if ($i > 0 || $flags->{'CHARGES'} ne '' || $data ne ''){
67 print "<table border=1>";
69 print "<TR><TD>Items on Issue</td><td align=right>$i</td></tr>";
71 if ($flags->{'CHARGES'} ne ''){
72 print "<TR><TD>Charges</td><td>$flags->{'CHARGES'}->{'message'}</tr>";
75 print "<TR><TD>Guarantees</td></tr>";
81 print $input->redirect("/cgi-bin/koha/members-home.pl");
86 my $dbh = C4::Context->dbh;
87 my $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
88 $sth->execute($member);
89 my @data=$sth->fetchrow_array;
91 $sth=$dbh->prepare("Insert into deletedborrowers values (".("?,"x(scalar(@data)-1))."?)");
94 $sth=$dbh->prepare("Delete from borrowers where borrowernumber=?");
95 $sth->execute($member);
97 $sth=$dbh->prepare("Delete from reserves where borrowernumber=?");
98 $sth->execute($member);