From 23d423cbf8db91f43730e5d37c413c3b4e038e08 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Followed test plan, works as expected. Signed-off-by: Marc Véron --- 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 57bd588..15a0509 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -227,6 +227,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 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