From bbeeb6d0157bd3c21d4d2f2c525b0c18fb9f754e Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Thu, 10 Dec 2015 17:00:54 +0100 Subject: [PATCH] Bug 15206 - Show patron's age in moremenber page near date of birth --- koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt | 2 +- members/moremember.pl | 6 ++++++ 2 files changed, 7 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 97e547d..1eca2d7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -225,7 +225,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 %])
  • [% 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..9066993 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -139,6 +139,12 @@ foreach (qw(dateenrolled dateexpiry dateofbirth)) { } $data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' ); +my @age; +my ($years, $months) = GetAge($data->{dateofbirth}); +push @age, "$years year(s)" if $years; +push @age, "$months month(s)" if $months; +$template->param( age => join(', ', @age) ); + for (qw(gonenoaddress lost borrowernotes)) { $data->{$_} and $template->param(flagged => 1) and last; } -- 1.7.10.4