Bugzilla – Attachment 45597 Details for
Bug 15206
Show patron's age when filling date of birth in memberentry.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15206 - Show patron's age under date of birth in memberentry.pl
Bug-15206---Show-patrons-age-under-date-of-birth-i.patch (text/plain), 3.02 KB, created by
Marc Véron
on 2015-12-11 10:32:46 UTC
(
hide
)
Description:
Bug 15206 - Show patron's age under date of birth in memberentry.pl
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-12-11 10:32:46 UTC
Size:
3.02 KB
patch
obsolete
>From 5ac4596803d6d6b92ea8d82013ad3d4e6567c5f4 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Wed, 18 Nov 2015 10:31:29 +0100 >Subject: [PATCH] Bug 15206 - Show patron's age under date of birth in > memberentry.pl >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Test plan: > >Create a new patron (members/memberentry.pl), >enter a date of birth, >patron'a age should be shown under > >Tested all patches together, works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > .../prog/en/modules/members/memberentrygen.tt | 35 ++++++++++++++++++-- > 1 file changed, 33 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index a3b7a9d..290bebe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -145,6 +145,37 @@ > return 0; > } > >+ function CalculateAge(dateofbirth) { >+ var today = new Date(); >+ var dob = new Date($("#dateofbirth").datepicker( 'getDate' )); >+ >+ var nowyear = today.getFullYear(); >+ var nowmonth = today.getMonth(); >+ var nowday = today.getDate(); >+ >+ var birthyear = dob.getFullYear(); >+ var birthmonth = dob.getMonth(); >+ var birthday = dob.getDate(); >+ >+ var year = nowyear - birthyear; >+ var month = nowmonth - birthmonth; >+ var day = nowday - birthday; >+ >+ if(day < 0) { >+ month = parseInt(month) -1; >+ } >+ >+ if(month < 0) { >+ year = parseInt(year) -1; >+ month = 12 + month; >+ } >+ >+ var age_string = "Age: "; >+ if (year) { age_string += year + " year(s) "; } >+ if (month) { age_string += month + " month(s) "; } >+ >+ var elem = $("#dateofbirth").siblings(".hint").first().html(age_string); >+ } > > > var MSG_SEPARATOR = _("Separator must be / in field %s"); >@@ -344,9 +375,9 @@ > Date of birth: </label> > > [% IF ( dateformat == "metric" ) %] >- <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="CheckDate(document.form.dateofbirth);" value="[% UNLESS opduplicate %][% dateofbirth %][% END %]" /> >+ <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="CheckDate(document.form.dateofbirth); CalculateAge(document.form.dateofbirth);" value="[% UNLESS opduplicate %][% dateofbirth %][% END %]" /> > [% ELSE %] >- <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="[% UNLESS opduplicate %][% dateofbirth %][% END %]" /> >+ <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="CalculateAge(document.form.dateofbirth);" value="[% UNLESS opduplicate %][% dateofbirth %][% END %]" /> > [% END %] > > [% IF ( mandatorydateofbirth ) %]<span class="required">Required</span>[% END %] >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15206
:
44953
|
44978
|
45579
|
45580
|
45581
|
45589
|
45590
|
45591
|
45592
|
45593
|
45597
|
45598
|
45599
|
45600
|
45601
|
46228
|
46245
|
46396
|
47301
|
47505
|
47506
|
47540
|
47541
|
47542
|
49032
|
49033
|
49034