Bug 18789: Use Koha::Patron->is_child where needed
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 1 Jun 2017 16:52:30 +0000 (13:52 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 16 Feb 2018 16:03:58 +0000 (13:03 -0300)
Test plan:
When you are on a page related to a child you should see the "Update
child to adult patron" button

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
circ/circulation.pl
koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
members/boraccount.pl
members/mancredit.pl
members/maninvoice.pl
members/member-flags.pl
members/member-password.pl
members/moremember.pl
members/printfeercpt.pl
members/printinvoice.pl
members/readingrec.pl

index 5657bfb..4ce738c 100755 (executable)
@@ -618,7 +618,6 @@ if ( $patron ) {
         patron            => $patron,
         categoryname      => $patron->category->description,
         expiry            => $patron->dateexpiry,
-        is_child          => ( $patron->category->category_type eq 'C' ),
     );
 }
 
index be1682b..59d4c0d 100644 (file)
@@ -69,7 +69,7 @@
                 [% ELSE %]
                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to delete patrons" id="deletepatron" href="#">Delete</a></li>
                 [% END %]
-                [% IF ( is_child ) %]
+                [% IF ( patron.is_child ) %]
                     <li><a id="updatechild" href="#">Update child to adult patron</a></li>
                 [% ELSE %]
                     <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="Patron is an adult" id="updatechild" href="#">Update child to adult patron</a></li>
index f4bf63f..d30dfe3 100755 (executable)
@@ -111,7 +111,6 @@ $template->param(
     finesview           => 1,
     total               => sprintf("%.2f",$total),
     totalcredit         => $totalcredit,
-    is_child            => ($patron->category->category_type eq 'C'),
     reverse_col         => $reverse_col,
     accounts            => $accts,
 );
index fe7c24b..b1de0cc 100755 (executable)
@@ -99,7 +99,6 @@ if ($add){
 
     $template->param(
         finesview      => 1,
-        is_child       => ($patron->category->category_type eq 'C'), # FIXME is_child should be a Koha::Patron method
         );
     output_html_with_http_headers $input, $cookie, $template->output;
 }
index 2271164..6700188 100755 (executable)
@@ -126,7 +126,6 @@ if ($add){
     $template->param(
         patron         => $patron,
         finesview      => 1,
-        is_child       => ($patron->category->category_type eq 'C'),
     );
     output_html_with_http_headers $input, $cookie, $template->output;
 }
index bc6237e..66debb6 100755 (executable)
@@ -200,7 +200,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
 $template->param(
     patron         => $patron,
     loop           => \@loop,
-    is_child       => ( $category_type eq 'C' ),
     csrf_token =>
         Koha::Token->new->generate_csrf( { session_id => scalar $input->cookie('CGISESSID'), } ),
 );
index 6a07825..1a56dad 100755 (executable)
@@ -114,7 +114,6 @@ if ( C4::Context->preference('ExtendedPatronAttributes') ) {
 $template->param(
     patron                     => $patron,
     destination                => $destination,
-    is_child                   => ( $category_type eq 'C' ),
     csrf_token                 => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID'), }),
 );
 
index be981f9..8550dee 100755 (executable)
@@ -353,7 +353,6 @@ $template->param(
     totaldue_raw    => $total,
     overdues_exist  => $overdues_exist,
     StaffMember     => $category_type eq 'S',
-    is_child        => $category_type eq 'C',
     $category_type  => 1, # [% IF ( I ) %] = institutional/organisation
     samebranch      => $samebranch,
     quickslip       => $quickslip,
index 8979ae6..da02121 100755 (executable)
@@ -121,7 +121,6 @@ $template->param(
     finesview           => 1,
     total               => sprintf("%.2f",$total),
     totalcredit         => $totalcredit,
-    is_child            => ($category->category_type eq 'C'),
     accounts            => \@accountrows );
 
 output_html_with_http_headers $input, $cookie, $template->output;
index 7b110e9..0a36d22 100755 (executable)
@@ -121,7 +121,6 @@ $template->param(
     finesview      => 1,
     total          => sprintf( "%.2f", $total ),
     totalcredit    => $totalcredit,
-    is_child       => ( $category->category_type eq 'C' ),
     accounts       => \@accountrows
 );
 
index 327c573..a8eaffe 100755 (executable)
@@ -115,7 +115,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
 $template->param(
     patron            => $patron,
     readingrecordview => 1,
-    is_child          => ( $category->category_type eq 'C' ),
     loop_reading      => $issues,
 );
 output_html_with_http_headers $input, $cookie, $template->output;