[Koha-bugs] [Bug 15206] Show patron's age when filling date of birth in memberentry.pl

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 27 11:27:06 CET 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15206

Alex Arnaud <alex.arnaud at biblibre.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Needs Signoff               |In Discussion

--- Comment #7 from Alex Arnaud <alex.arnaud at biblibre.com> ---
(In reply to Frédéric Demians from comment #6)
> Code review:
> 
> You have:
> 
>     function CalculateAge(dateofbirth) {
> 
> Then, you don't use "dateofbirth".
> 
> You have:
> 
>   <input type="text" id="dateofbirth" name="dateofbirth" size="20"
>    onchange="CalculateAge(document.form.dateofbirth);"
>    value="[% UNLESS opduplicate %][% dateofbirth %][% END %]" />
> 
> You rather should use jQuery:
> 
>   $( "#dateofbirth" ).change(CalculateAge);
You are right. I forgot to remove the function parameter. Using
"$("#dateofbirth").datepicker( 'getDate' )" is bettre because it gives me the
correct date format
> 
> From an UI point of view, it seems awkward to have displayed firstly
> "DD/MM/YYYY" under the Date of birth text box, and then having this info
> replaced by the age. This way, it's not possible to see the age without
> modifying the date of birth. Wouldn't it be better/simpler to display the age
> on the detail page (moremember.pl), rather than on the editing page
> (memberentry.pl)?
The main goal is to have directly the age under the datepiker while typing the
date of birth. This allows librarian, for example, to change the category
consequently
> 
> Have you seen that there is already a Perl function calculating age in Koha?
> C4::Members::GetAge(). There is a risk that your javascript code and Perl
> GetAge() produce a different age.
So, i should make an Ajax call to a perl script to use this existing sub. But
why not

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list