From b69a7977d8285f6bb659c07c8480756b8e4b9044 Mon Sep 17 00:00:00 2001 From: Maryse Simard Date: Tue, 20 Oct 2020 20:39:51 -0400 Subject: [PATCH] Bug 12446: Limit available categories when using "Add guarantee" button Test plan: 1) Have some patron categories that can and cannot be guarantee 2) Visit a patron's account and click the "Add guarantee" button 3) In the "category" dropdown, note that all categories are available 4) Apply this patch 5) Repeat step 2 and 3; the dropdown now only contains the categories for which "can be guarantee" is set to "Yes". Signed-off-by: Kyle M Hall Signed-off-by: David Nind Signed-off-by: Owen Leonard Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- members/memberentry.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index 637146174a..6f4c429288 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -673,7 +673,9 @@ my @typeloop; my $no_categories = 1; my $no_add; foreach my $category_type (qw(C A S P I X)) { - my $patron_categories = Koha::Patron::Categories->search_with_library_limits({ category_type => $category_type }, {order_by => ['categorycode']}); + my $categories_limits = { category_type => $category_type }; + $categories_limits->{canbeguarantee} = 1 if ($guarantor_id); + my $patron_categories = Koha::Patron::Categories->search_with_library_limits( $categories_limits, {order_by => ['categorycode']} ); $no_categories = 0 if $patron_categories->count > 0; my @categoryloop; -- 2.39.5