From 73beea96eea963d50a43d5508b3ccd3f0aa797cd Mon Sep 17 00:00:00 2001 From: Aleisha Date: Wed, 13 Jan 2016 23:36:21 +0000 Subject: [PATCH] Bug 14763: Calculate and display patron age To test: 1) Go to patron Details page (ie http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51) 2) Confirm that '(x years)' is showing next to 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 | 2 +- members/moremember.pl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 57bd588..afae749 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -226,7 +226,7 @@ function validate1(date) { [% IF ( emailpro ) %]
  • Secondary email: [% emailpro %]
  • [% END %] [% END %] [% IF ( initials ) %]
  • Initials: [% initials %]
  • [% END %] - [% IF ( dateofbirth ) %]
  • Date of birth:[% dateofbirth | $KohaDates %]
  • [% END %] + [% IF ( dateofbirth ) %]
  • Date of birth:[% dateofbirth | $KohaDates %] ([% 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 482f2a2..46c7d45 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -254,6 +254,11 @@ $today->truncate(to => 'day'); 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