From e49e7d483a3020ca6e55ee06d5972a9d14ff187f Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 7 Nov 2022 12:38:33 +0000 Subject: [PATCH] Bug 32119: (bug 31422 follow-up) Fix add guarantee To test: 1 - go to a patron detail view, click "add guarantee" 2 - Confirm form loads 3 - Confirm categories lsited are eligible to have a guarantor 4 - Fill out required fields and confirm patron saved correctly Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- members/memberentry.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index ca43a1eede..2ebf3b4335 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -659,7 +659,8 @@ my $patron_categories = Koha::Patron::Categories->search_with_library_limits( my $no_categories = ! $patron_categories->count; my $categories = {}; my @patron_categories = $patron_categories->as_list; -unless ( $patron_categories->find( $category->id ) ){ +# When adding a guarantor we don't have a category yet, and only want to choose from the eligible categories +unless ( !$category || $patron_categories->find( $category->id ) ){ $template->param( limited_category => 1 ); push @patron_categories, $category; } -- 2.39.5