From 0e953489908f8fb44bd6173620050054e0a66e71 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit b588babdb23bfdc1163864a26c36a61bf8a39ae5) Signed-off-by: Frédéric Demians --- members/deletemem.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/members/deletemem.pl b/members/deletemem.pl index fd53eccd70..b765db78e9 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -53,7 +53,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 @@ -82,12 +82,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 } } @@ -96,7 +96,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 } } } @@ -150,6 +150,7 @@ output_html_with_http_headers $input, $cookie, $template->output; C4::Members::HandleDelBorrower($member); DelMember($member); print $input->redirect("/cgi-bin/koha/members/members-home.pl"); + exit 0; # Exit without error } -- 2.39.5