From b588babdb23bfdc1163864a26c36a61bf8a39ae5 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 5 Oct 2016 15:43:29 +0200 Subject: [PATCH] Bug 17403: Internal Server Error while deleting patron This patch fixes a Internal Server Error while deleting patrons. To reproduce: - Go to a patron's detail page - Toolbar : More : Delete - Confirm "Are you sure you want to delete..." Result: Internal Server Error Plack error log: exited nonzero: 1 at /home/marc/koha/members/deletemem.pl Note: Patron is deleted Additional tests: Try to delete yourself, to delete a staff member without having superlibrarian permission etc. To test: - Apply patch - Re-start plack - Try to reproduce steps above (with other patron) Expected result: No Internal Server Error, Redirect to Home > Patrons Amended to include all occurences of 'exit 1' Signed-off-by: Chris Cormack Good catch Marc Signed-off-by: Katrin Fischer Signed-off-by: Brendan Gallagher --- members/deletemem.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/members/deletemem.pl b/members/deletemem.pl index 60de8c0cd7..1f901e5add 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -55,7 +55,7 @@ my $member = $input->param('member'); #Do not delete yourself... if ($borrowernumber == $member ) { print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_YOURSELF"); - exit 1; + exit 0; # Exit without error } # Handle deletion from the Norwegian national patron database, if it is enabled @@ -84,12 +84,12 @@ my $userenv = C4::Context->userenv; if ($bor->{category_type} eq "S") { unless(C4::Auth::haspermission($userenv->{'id'},{'staffaccess'=>1})) { print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_STAFF"); - exit 1; + exit 0; # Exit without error } } else { unless(C4::Auth::haspermission($userenv->{'id'},{'borrowers'=>1})) { print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE"); - exit 1; + exit 0; # Exit without error } } @@ -98,7 +98,7 @@ if (C4::Context->preference("IndependentBranches")) { if ( !C4::Context->IsSuperLibrarian() && $bor->{'branchcode'}){ unless ($userenv->{branch} eq $bor->{'branchcode'}){ print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_OTHERLIBRARY"); - exit; + exit 0; # Exit without error } } } @@ -165,7 +165,7 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_ DelMember($member); # TODO Tell the user everything went ok print $input->redirect("/cgi-bin/koha/members/members-home.pl"); - exit 1; + exit 0; # Exit without error } output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5