From 9d5a64155232e2742a0feacc4e02582eab273f32 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Mon, 11 Sep 2017 10:58:27 +0000 Subject: [PATCH] Bug 17492: Followup - adapt the code to current master --- circ/circulation.pl | 7 +++---- members/moremember.pl | 8 +++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index c921fd4..1f22bed 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -304,11 +304,10 @@ if ($patron) { } # Calculate and display patron's age - my $dateofbirth = $borrower->{ 'dateofbirth' }; - my $age = GetAge($dateofbirth); + my $age = $patron->get_age; - my $borrowercategory = Koha::Patron::Categories->find($borrower->{ 'categorycode' }); - my ($low,$high) = ($borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit); + my $patroncategory = $patron->category; + my ($low,$high) = ($patroncategory->dateofbirthrequired, $patroncategory->upperagelimit); if (($high && ($age > $high)) or ($age < $low)) { $template->param( age_limitations => 1 ); $template->param( age_low => $low ); diff --git a/members/moremember.pl b/members/moremember.pl index 64c994b..fcf51f7 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -246,13 +246,15 @@ my $overdues_exist = 0; my $totalprice = 0; # Calculate and display patron's age +my $age; if ( $data->{dateofbirth} ) { - $template->param( age => Koha::Patron->new({ dateofbirth => $data->{dateofbirth} })->get_age ); + $age = Koha::Patron->new({ dateofbirth => $data->{dateofbirth} })->get_age; + $template->param( age => $age ); } # Check patron's category against age -my $borrowercategory = Koha::Patron::Categories->find($data->{ 'categorycode' }); -my ($low,$high) = ($borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit); +my $patroncategory = Koha::Patron::Categories->find($data->{ 'categorycode' }); +my ($low,$high) = ($patroncategory->dateofbirthrequired, $patroncategory->upperagelimit); if (($high && ($age > $high)) or ($age < $low)) { $template->param( age_limitations => 1 ); $template->param( age_low => $low ); -- 2.1.4