Bug 20805: Update child to adult patron process broken on several patron-related...
[koha.git] / members / housebound.pl
index 9d65f4f..69bdc1a 100755 (executable)
@@ -62,7 +62,7 @@ my $patron = Koha::Patrons->find($borrowernumber);
 output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
 
 # Get supporting cast
-my ( $branch, $houseboundprofile, $visit );
+my ( $houseboundprofile, $visit );
 if ( $patron ) { # FIXME This test is not needed - output_and_exit_if_error handles it
     $houseboundprofile = $patron->housebound_profile;
 }
@@ -166,6 +166,12 @@ if ( C4::Context->preference('ExtendedPatronAttributes') and $patron ) {
     );
 }
 
+if ( $patron->is_child ) {
+    my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
+    $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
+    $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
+}
+
 $template->param(
     housebound_profile => $houseboundprofile,
     visit              => $houseboundvisit,