4 #script to delete items
9 # Copyright 2000-2002 Katipo Communications
11 # This file is part of Koha.
13 # Koha is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at your option) any later
18 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License along with
23 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA 02111-1307 USA
38 $flagsrequired->{borrowers}=1;
39 my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
43 #print $input->header;
44 my $member=$input->param('member');
46 $member2{'borrowernumber'}=$member;
47 my ($countissues,$issues)=GetPendingIssues($member);
49 my ($bor)=GetMemberDetails($member,'');
50 my $flags=$bor->{flags};
52 my $userenv = C4::Context->userenv;
53 if(C4::Auth::haspermission(undef,$userenv->{'id'},{'staffaccess'=>1})) {
54 print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE");
58 if (C4::Context->preference("IndependantBranches")) {
59 unless ($userenv->{flags} == 1){
60 unless ($userenv->{'branch'} eq $bor->{'branchcode'}){
61 # warn "user ".$userenv->{'branch'} ."borrower :". $bor->{'branchcode'};
62 print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE");
67 my $dbh = C4::Context->dbh;
68 my $sth=$dbh->prepare("Select * from borrowers where guarantorid=?");
69 $sth->execute($member);
70 my $data=$sth->fetchrow_hashref;
72 if ($countissues > 0 or $flags->{'CHARGES'} or $data->{'borrowernumber'}){
74 my ($template, $borrowernumber, $cookie)
75 = get_template_and_user({template_name => "members/deletemem.tmpl",
79 flagsrequired => {borrowers => 1},
82 # print $input->header;
83 $template->param(borrowernumber => $member);
84 if ($countissues >0) {
85 $template->param(ItemsOnIssues => $countissues);
87 if ($flags->{'CHARGES'} ne '') {
88 $template->param(charges => $flags->{'CHARGES'}->{'amount'});
91 $template->param(guarantees => 1);
93 output_html_with_http_headers $input, $cookie, $template->output;
96 MoveMemberToDeleted($member);
98 print $input->redirect("/cgi-bin/koha/members/members-home.pl");