$patron = Koha::Patrons->find( $c->validation->param('patron_id') );
# check if loans, reservations, debarrment, etc. before deletion!
$patron->delete;
try {
return $c->render(
status => 204,
openapi => q{}
);
} catch {
if ( $_->isa('Koha::Exceptions::Patron::FailedDeleteAnonymousPatron') ) {
status => 403,
openapi => { error => "Anonymous patron cannot be deleted" }
}
else {
$c->unhandled_exception($_);
};
catch {
unless ($patron) {
use Modern::Perl;
use CGI qw ( -utf8 );
use Try::Tiny;
use C4::Context;
use C4::Output;
use C4::Auth;
});
my $patron = Koha::Patrons->find( $member );
$patron->move_to_deleted;
print $input->redirect("/cgi-bin/koha/members/members-home.pl");
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_ANONYMOUS_PATRON");
# TODO Tell the user everything went ok
exit 0; # Exit without error
-