From b124540ee9819c86fd82a8fd63214c5b56ea9e32 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Works as expected. Signed-off-by: Marc Véron Signed-off-by: Jonathan Druart Signed-off-by: Brendan A Gallagher --- .../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 4cf715fd7a..a44fb3c232 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -227,7 +227,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 0f36463aa6..796e19aff0 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -253,6 +253,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 .... -- 2.39.2