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 <kyle@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2017-06-01 13:57:12 -03:00
parent d8b8799355
commit a723bbaf1b
17 changed files with 2 additions and 35 deletions

View File

@ -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

View File

@ -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") %]
<a id="addchild" class="btn btn-default btn-sm" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% patron.borrowernumber %]"><i class="fa fa-plus"></i> Add child</a>
[% END %]
[% IF CAN_user_borrowers_edit_borrowers %]

View File

@ -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(

View File

@ -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,
);

View File

@ -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(),

View File

@ -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,

View File

@ -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(

View File

@ -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(

View File

@ -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(

View File

@ -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(

View File

@ -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;

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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';
}

View File

@ -72,8 +72,6 @@ $template->param(
routinglistview => 1
);
$template->param( adultborrower => 1 ) if ( $category->category_type =~ /^(A|I)$/ );
$template->param(
patron => $patron,
findborrower => $findborrower,

View File

@ -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,