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
31 use C4::Interface::CGI::Output;
41 $flagsrequired->{borrowers}=1;
42 my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
46 #print $input->header;
47 my $member=$input->param('member');
49 $member2{'borrowernumber'}=$member;
50 my $issues=GetBorrowerIssues(\%member2);
52 foreach (sort keys %$issues) {
55 my ($bor,$flags)=GetMemberDetails($member,'');
56 if (C4::Context->preference("IndependantBranches")) {
57 my $userenv = C4::Context->userenv;
58 unless ($userenv->{flags} == 1){
59 unless ($userenv->{'branch'} eq $bor->{'branchcode'}){
60 # warn "user ".$userenv->{'branch'} ."borrower :". $bor->{'branchcode'};
61 print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
66 my $dbh = C4::Context->dbh;
67 my $sth=$dbh->prepare("Select * from borrowers where guarantorid=?");
68 $sth->execute($member);
69 my $data=$sth->fetchrow_hashref;
71 if ($i > 0 or $flags->{'CHARGES'} or $data->{'borrowernumber'}){
72 warn"je suis rentre dans la boucle";
73 my ($template, $borrowernumber, $cookie)
74 = get_template_and_user({template_name => "members/deletemem.tmpl",
78 flagsrequired => {borrowers => 1},
81 # print $input->header;
82 $template->param(borrowernumber => $member);
84 $template->param(ItemsOnIssues => $i);
86 if ($flags->{'CHARGES'} ne '') {
87 $template->param(charges => $flags->{'CHARGES'}->{'message'});
90 $template->param(guarantees => 1);
92 # print "<table border=1>";
94 # print "<TR><TD>Items on Issue</td><td align=right>$i</td></tr>";
96 # if ($flags->{'CHARGES'} ne ''){
97 # print "<TR><TD>Charges</td><td>$flags->{'CHARGES'}->{'message'}</tr>";
100 # print "<TR><TD>Guarantees</td></tr>";
103 $template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
104 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
105 IntranetNav => C4::Context->preference("IntranetNav"),
107 output_html_with_http_headers $input, $cookie, $template->output;
110 MoveMemberToDeleted($member);
112 print $input->redirect("/cgi-bin/koha/members/members-home.pl");