From 636061c3341f08c29fb78671d7d0274ac67bb07b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 1 Jun 2017 13:57:12 -0300 Subject: [PATCH] Bug 18789: Use Koha::Patron->is_adult where needed Test plan: When editing adult's info you must see the "Add child" button Signed-off-by: Kyle M Hall --- circ/circulation.pl | 3 --- koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc | 2 +- members/boraccount.pl | 2 -- members/deletemem.pl | 2 -- members/files.pl | 4 ---- members/housebound.pl | 4 +--- members/mancredit.pl | 2 -- members/maninvoice.pl | 2 -- members/member-flags.pl | 2 -- members/member-password.pl | 2 -- members/moremember.pl | 2 -- members/notices.pl | 1 - members/printfeercpt.pl | 2 -- members/printinvoice.pl | 2 -- members/readingrec.pl | 1 - members/routing-lists.pl | 2 -- members/statistics.pl | 2 -- 17 files changed, 2 insertions(+), 35 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index bf76995..1f2de5d 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -456,9 +456,6 @@ if ($patron) { holds_count => $holds->count(), WaitingHolds => $waiting_holds, ); - - my $category_type = $patron->category->category_type; - $template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' ); } #title diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index 5ec0341..00a52ee 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -143,7 +143,7 @@ function searchToHold(){ [% END %] [% IF CAN_user_borrowers_edit_borrowers %] - [% IF adultborrower AND Koha.Preference("borrowerRelationship") %] + [% IF patron.is_adult AND Koha.Preference("borrowerRelationship") %] Add child [% END %] [% IF CAN_user_borrowers_edit_borrowers %] diff --git a/members/boraccount.pl b/members/boraccount.pl index 283f4ac..fca11b9 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -97,8 +97,6 @@ foreach my $accountline ( @{$accts}) { } } -$template->param( adultborrower => 1 ) if ( $patron->category->category_type =~ /^(A|I)$/ ); - if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($borrowernumber); $template->param( diff --git a/members/deletemem.pl b/members/deletemem.pl index d076470..d15f3f1 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -110,8 +110,6 @@ my $dbh = C4::Context->dbh; my $is_guarantor = $dbh->selectrow_array("SELECT COUNT(*) FROM borrowers WHERE guarantorid=?", undef, $member); if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_guarantor or $deletelocal == 0) { - $template->param( adultborrower => 1 ) if $patron->category->category_type =~ /^(A|I)$/; - $template->param( patron => $patron, ); diff --git a/members/files.pl b/members/files.pl index c2060aa..5f55448 100755 --- a/members/files.pl +++ b/members/files.pl @@ -115,10 +115,6 @@ else { ); } - - $template->param( adultborrower => 1 ) - if ( $patron_category->category_type eq 'A' || $patron_category->category_type eq 'I' ); - $template->param( files => Koha::Patron::Files->new( borrowernumber => $borrowernumber ) ->GetFilesInfo(), diff --git a/members/housebound.pl b/members/housebound.pl index 0e52085..9d65f4f 100755 --- a/members/housebound.pl +++ b/members/housebound.pl @@ -62,9 +62,8 @@ 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, $category, $houseboundprofile, $visit ); +my ( $branch, $houseboundprofile, $visit ); if ( $patron ) { # FIXME This test is not needed - output_and_exit_if_error handles it - $category = Koha::Patron::Categories->new->find($patron->categorycode); $houseboundprofile = $patron->housebound_profile; } if ( $visit_id ) { @@ -167,7 +166,6 @@ if ( C4::Context->preference('ExtendedPatronAttributes') and $patron ) { ); } -$template->param( adultborrower => 1 ) if ( $category->category_type eq 'A' || $category->category_type eq 'I' ); $template->param( housebound_profile => $houseboundprofile, visit => $houseboundvisit, diff --git a/members/mancredit.pl b/members/mancredit.pl index d48fa40..3536e22 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -86,8 +86,6 @@ if ($add){ $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; } - $template->param( adultborrower => 1 ) if ( $patron->category->category_type =~ /^(A|I)$/ ); - if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($borrowernumber); $template->param( diff --git a/members/maninvoice.pl b/members/maninvoice.pl index e63fefe..fefa036 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -114,8 +114,6 @@ if ($add){ $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; } - $template->param( adultborrower => 1 ) if ( $patron->category->category_type =~ /^(A|I)$/ ); - if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($borrowernumber); $template->param( diff --git a/members/member-flags.pl b/members/member-flags.pl index f057bcd..3c24ead 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -188,8 +188,6 @@ if ($input->param('newflags')) { $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; } -$template->param( adultborrower => 1 ) if ( $category_type =~ /^(A|I)$/ ); - if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'}); $template->param( diff --git a/members/member-password.pl b/members/member-password.pl index fd1223d..6884a14 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -102,8 +102,6 @@ if ( $category_type eq 'C') { $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; } -$template->param( adultborrower => 1 ) if ( $category_type =~ /^(A|I)$/ ); - if ( C4::Context->preference('ExtendedPatronAttributes') ) { my $attributes = GetBorrowerAttributes( $bor->{'borrowernumber'} ); $template->param( diff --git a/members/moremember.pl b/members/moremember.pl index 3beca9f..6a3ebd0 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -196,8 +196,6 @@ my $relatives_issues_count = Koha::Database->new()->schema()->resultset('Issue') ->count( { borrowernumber => \@relatives } ); -$template->param( adultborrower => 1 ) if ( $category_type eq 'A' || $category_type eq 'I' ); - my %bor; $bor{'borrowernumber'} = $borrowernumber; diff --git a/members/notices.pl b/members/notices.pl index 535dcb7..eb353c3 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -75,7 +75,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -$template->param( adultborrower => 1 ) if ( $borrower->{category_type} eq 'A' || $borrower->{category_type} eq 'I' ); $template->param( patron => $patron, QUEUED_MESSAGES => $queued_messages, diff --git a/members/printfeercpt.pl b/members/printfeercpt.pl index 4446fc2..4cdbbd7 100755 --- a/members/printfeercpt.pl +++ b/members/printfeercpt.pl @@ -115,8 +115,6 @@ for (my $i=0;$i<$numaccts;$i++){ push(@accountrows, \%row); } -$template->param( adultborrower => 1 ) if ( $category->category_type eq 'A' || $category->category_type eq 'I' ); - $template->param( patron => $patron, finesview => 1, diff --git a/members/printinvoice.pl b/members/printinvoice.pl index 34e93b0..49582f3 100755 --- a/members/printinvoice.pl +++ b/members/printinvoice.pl @@ -115,8 +115,6 @@ for ( my $i = 0 ; $i < $numaccts ; $i++ ) { push( @accountrows, \%row ); } -$template->param( adultborrower => 1 ) if ( $category->category_type eq 'A' || $category->category_type eq 'I' ); - $template->param( patron => $patron, finesview => 1, diff --git a/members/readingrec.pl b/members/readingrec.pl index 1fb8b00..7c7f008 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -100,7 +100,6 @@ if ( $category->category_type eq 'C') { $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; } -$template->param( adultborrower => 1 ) if ( $category->category_type eq 'A' || $category->category_type eq 'I' ); if (! $limit){ $limit = 'full'; } diff --git a/members/routing-lists.pl b/members/routing-lists.pl index 9605c37..a9f819d 100755 --- a/members/routing-lists.pl +++ b/members/routing-lists.pl @@ -73,8 +73,6 @@ $template->param( routinglistview => 1 ); -$template->param( adultborrower => 1 ) if ( $category->category_type =~ /^(A|I)$/ ); - $template->param( patron => $patron, findborrower => $findborrower, diff --git a/members/statistics.pl b/members/statistics.pl index 98c157e..2e3087e 100755 --- a/members/statistics.pl +++ b/members/statistics.pl @@ -84,8 +84,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } -$template->param( adultborrower => 1 ) if ( $category->category_type eq 'A' || $category->category_type eq 'I' ); - $template->param( patron => $patron, statisticsview => 1, -- 2.10.2