Bugzilla – Attachment 45580 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 - CalculateAge in memberentry use C4::Members::GetAge()
Bug-15206---CalculateAge-in-memberentry-use-C4Memb.patch (text/plain), 2.60 KB, created by
Alex Arnaud
on 2015-12-10 16:01:49 UTC
(
hide
)
Description:
Bug 15206 - CalculateAge in memberentry use C4::Members::GetAge()
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2015-12-10 16:01:49 UTC
Size:
2.60 KB
patch
obsolete
>From 81a17654b0649188218dc7e7d9ab1d01be522c81 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Thu, 10 Dec 2015 16:33:53 +0100 >Subject: [PATCH] Bug 15206 - CalculateAge in memberentry use > C4::Members::GetAge() > >--- > .../prog/en/modules/members/memberentrygen.tt | 44 ++++++++++---------- > 1 file changed, 21 insertions(+), 23 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 290bebe..6ca7570 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -145,36 +145,34 @@ > 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(); >+ function CalculateAge() { >+ if (!$("#dateofbirth").datepicker( 'getDate' )) { >+ var elem = $("#dateofbirth").siblings(".hint").first().html(''); >+ return 1; >+ } > >- var birthyear = dob.getFullYear(); >- var birthmonth = dob.getMonth(); >- var birthday = dob.getDate(); >+ var dob = new Date($("#dateofbirth").datepicker( 'getDate' )); > >- var year = nowyear - birthyear; >- var month = nowmonth - birthmonth; >- var day = nowday - birthday; >+ var year = dob.getFullYear(); >+ var month = dob.getMonth(); >+ var day = dob.getDate(); > >- if(day < 0) { >- month = parseInt(month) -1; >- } >+ $.ajax({ >+ url : '/cgi-bin/koha/svc/members/age', >+ type : 'GET', >+ data: 'dateofbirth=' + year + '-' + month + '-' + day, >+ dataType: 'json', >+ success : function(json, statut){ >+ var age_string = "Age: "; >+ if (json.years) { age_string += json.years + " year(s) "; } >+ if (json.months) { age_string += json.months + " month(s) "; } >+ var elem = $("#dateofbirth").siblings(".hint").first().html(age_string); >+ }, >+ }); > >- 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); > } > > >-- >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