From a90502043f12055b7e6b61f9c23d924d2e02b999 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Sat, 27 Oct 2018 09:22:00 -0300 Subject: [PATCH] Bug 21702: (follow-up) Simplify checks and use standard fallback behaviour This patch acknowledges the fact that some checks here are done in a way that is not standard these days. This checks are originally done multiple times in different ways. output_and_exit_if_error should be used. This implies a minor behaviour change: if the passed (in the URL) borrowernumber doesn't exist, it sends the user to a 'Patron doesn't exist page' instead of the circulation page for the borrowernumber. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Andrew Isherwood Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens --- members/mancredit.pl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/members/mancredit.pl b/members/mancredit.pl index 49ab8a4213..5000fb2f85 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -55,10 +55,9 @@ my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in"; my $borrowernumber = $input->param('borrowernumber'); my $patron = Koha::Patrons->find($borrowernumber); -unless ( $patron ) { - print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); - exit; -} +output_and_exit_if_error( $input, $cookie, $template, + { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); + my $add = $input->param('add'); if ($add){ @@ -94,7 +93,6 @@ if ($add){ print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); } else { - output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($borrowernumber); -- 2.39.5