From 51933c7753f04cdc7baa745037919e601ec3d798 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 14 Aug 2018 16:26:39 -0300 Subject: [PATCH] Bug 21221: Shortcut memberentry scripts if patron does not exist If borrowernumber is passed and that it does not refer to a valid patron in DB, we should not continue the script and display an error instead. Test plan: Create a patron Edit a patron => Both should work ok You can also test the other action memberentry.pl manage. Edit it again but modify the borrowernumber parameter => You should see a friendly user message saying that the patron does not exist. Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens --- members/memberentry.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/members/memberentry.pl b/members/memberentry.pl index 3618c4ffbe..2bf1a02f19 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -78,6 +78,10 @@ my ($template, $loggedinuser, $cookie) my $borrowernumber = $input->param('borrowernumber'); my $patron = Koha::Patrons->find($borrowernumber); +if ( $borrowernumber and not $patron ) { + output_and_exit( $input, $cookie, $template, 'unknown_patron' ); +} + if ( C4::Context->preference('SMSSendDriver') eq 'Email' ) { my @providers = Koha::SMS::Providers->search(); $template->param( sms_providers => \@providers ); -- 2.39.5