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 <kyle@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Maryse Simard 2020-10-20 20:39:51 -04:00 committed by Tomas Cohen Arazi
parent b8f1b0e73d
commit b69a7977d8
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 3 additions and 1 deletions

View File

@ -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;