From 3db401197db8ed9650829231df40f2413c8b8087 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". --- members/memberentry.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index b6c405f5c1..73c4dfed26 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -674,7 +674,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_limited({ 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_limited( $categories_limits, {order_by => ['categorycode']} ); $no_categories = 0 if $patron_categories->count > 0; my @categoryloop; -- 2.17.1