From 75b4e93965f0f232fdc0c5556dc4171792da8348 Mon Sep 17 00:00:00 2001 From: The Minh Luong Date: Mon, 21 Mar 2022 09:21:50 -0400 Subject: [PATCH] Bug 12446: Any patron categories can have guarantors Rebase of previous patches This patch allows adult patrons to have guarantors. It adds the field "Can be guarantee" to patron categories, so it becomes possible for any category type to have a guarantor. NOTE: Attachment "Bug 12446: Adult can now have guarantors" created a sha1 error. I marked it as obsolete and put it's content into a new commit. To test: 1) Create an Adult AND Child category in Administration/Patron categories 2) Create a child AND adult patron. 3) Go in your child patron's page. 4) Click on "Edit". 5) Notice that you can add a guarantor with "Add guarantor" button. 6) Go in your adult patron's page. 7) Click on "Edit". 8) Notice that there is no "Add guarantor" button. Therefore, you can't add a guarantor for this patron. 9) Apply patch and run updatedatabase.pl 10) Go in Administration/Patron categories and edit one of them. 12) Notice that you can see the new "Can be guarantee" field. 13) Set "Yes" gor the "Can be guarantee" field for your Child AND Adult category. 14) Repeat steps 6 to 7. 15) Notice that your adult patron can now add guarantors with the "Add guarantor" button. 16) prove t/db_dependent/Patrons.t => All tests should still pass Signed-off-by: Owen Leonard --- members/memberentry.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index 683d1da73d..5fbb46818d 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -676,7 +676,7 @@ 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']} ); + $patron_categories = Koha::Patron::Categories->search_with_library_limits( $categories_limits, {order_by => ['categorycode']} ); $no_categories = 0 if $patron_categories->count > 0; my @categoryloop; @@ -824,7 +824,7 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { $template->param( borrower_data => \%data ); $template->param( "show_guarantor" => $categorycode ? Koha::Patron::Categories->find($categorycode)->canbeguarantee : 1); # associate with step to know where you are -$debug and warn "memberentry step: $step"; +my $debug and warn "memberentry step: $step"; $template->param( "step_$step" => 1) if $step; # associate with step to know where u are $template->param( step => $step ) if $step; # associate with step to know where u are -- 2.25.1