From ebd8cd68da8fa0d0e46f30ccb9a8f645e43b9d70 Mon Sep 17 00:00:00 2001 From: Aleisha Date: Thu, 17 Dec 2015 22:42:08 +0000 Subject: [PATCH] Bug 14763: Calculate and display patron age This patch uses the GetAge function from C4::Members to calculate the patron's age and display it. To test: 1) Go to patron Details page (ie http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51) 2) Confirm that 'Age:' is showing under the Date of Birth and is correct according to DOB (ie if DOB: 30/11/1996, Age: 19 years) 3) Edit date of birth to be a month later (ie from 30 November to 30 December) so that, as of the date you are testing, the patron has not had their birthday yet 4) Confirm that Age changes to be one year younger 5) Edit date of birth to be a different year 6) Confirm that Age changes accordingly --- koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt | 1 + members/moremember.pl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 97e547d..037dc3c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -226,6 +226,7 @@ function validate1(date) { [% END %] [% IF ( initials ) %]
  • Initials: [% initials %]
  • [% END %] [% IF ( dateofbirth ) %]
  • Date of birth:[% dateofbirth | $KohaDates %]
  • [% END %] + [% IF ( age ) %]
  • Age:[% age %] years
  • [% END %] [% IF ( sex ) %]
  • Gender: [% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]
  • [% END %][% END %] diff --git a/members/moremember.pl b/members/moremember.pl index 688215b..3ff36de 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -256,6 +256,11 @@ my @borrowers_with_issues; my $overdues_exist = 0; my $totalprice = 0; +# Calculate and display patron's age +my $dateofbirth = $data->{ 'dateofbirth' }; +my $age = GetAge($dateofbirth); +$template->param( age => $age ); + ### ############################################################################### # BUILD HTML # show all reserves of this borrower, and the position of the reservation .... -- 1.7.10.4