From a723bbaf1b564bf18ec9f477a3269b8b17033639 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 Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart --- 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 4ce738c13a..a64844e852 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -466,9 +466,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 59d4c0d2ba..467997fd60 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -15,7 +15,7 @@ [% 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 d30dfe34fd..8643b901b1 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -96,8 +96,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 ec5abe167b..86ba249621 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -109,8 +109,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 4fc42fc1ac..7927eae1bf 100755 --- a/members/files.pl +++ b/members/files.pl @@ -114,10 +114,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 0e52085193..9d65f4f632 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 b1de0cc497..9dfd2e697b 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -85,8 +85,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 67001884a4..68a4850e1b 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -113,8 +113,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 66debb66af..63bb249e7a 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -187,8 +187,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 1a56dad41b..0e4db74567 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -101,8 +101,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 8550dee70e..ebbdcac0a3 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 0541fd834f..f307393b63 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -74,7 +74,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 da02121567..d6080fb6b3 100755 --- a/members/printfeercpt.pl +++ b/members/printfeercpt.pl @@ -114,8 +114,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 0a36d22c50..552e0cdca3 100755 --- a/members/printinvoice.pl +++ b/members/printinvoice.pl @@ -114,8 +114,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 a8eaffef2b..7a63201c05 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -99,7 +99,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 ff2de5189d..ca150ab5a8 100755 --- a/members/routing-lists.pl +++ b/members/routing-lists.pl @@ -72,8 +72,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 98c157e404..2e3087eddd 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.39.5