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 if( $bor->{'category_type'} eq 'S' ) {
40 $flagsrequired->{'staffaccess'} = 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 ($countissues,$issues)=GetPendingIssues($member);
52 my ($bor)=GetMemberDetails($member,'');
53 my $flags=$bor->{flags};
54 if (C4::Context->preference("IndependantBranches")) {
55 my $userenv = C4::Context->userenv;
56 unless ($userenv->{flags} == 1){
57 unless ($userenv->{'branch'} eq $bor->{'branchcode'}){
58 # warn "user ".$userenv->{'branch'} ."borrower :". $bor->{'branchcode'};
59 print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
64 my $dbh = C4::Context->dbh;
65 my $sth=$dbh->prepare("Select * from borrowers where guarantorid=?");
66 $sth->execute($member);
67 my $data=$sth->fetchrow_hashref;
69 if ($countissues > 0 or $flags->{'CHARGES'} or $data->{'borrowernumber'}){
71 my ($template, $borrowernumber, $cookie)
72 = get_template_and_user({template_name => "members/deletemem.tmpl",
76 flagsrequired => {borrowers => 1},
79 # print $input->header;
80 $template->param(borrowernumber => $member);
81 if ($countissues >0) {
82 $template->param(ItemsOnIssues => $countissues);
84 if ($flags->{'CHARGES'} ne '') {
85 $template->param(charges => $flags->{'CHARGES'}->{'amount'});
88 $template->param(guarantees => 1);
90 output_html_with_http_headers $input, $cookie, $template->output;
93 MoveMemberToDeleted($member);
95 print $input->redirect("/cgi-bin/koha/members/members-home.pl");