Bug 15400: Display date of birth and age more consistantly

Test plan:
0) Apply the patch
1) Go to all of these pages
    Patron detail
    Other patron pages - look on the left side (circ-menu)
    Patron search
    Guarantor search ( go to child patron -> edit -> in guarantor
        section click "Set to patron"
    Search through "Check out" (in the header)

2) Confirm that does show date of birth and date consistantly,
    try it on patrons with and without date of birth set to find
    possible reggressions

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Josef Moravec 2018-11-02 08:13:35 +00:00 committed by Jonathan Druart
parent 029f41a667
commit 2cc3d05d26
8 changed files with 23 additions and 5 deletions

View File

@ -214,6 +214,7 @@ sub search {
my $patron_object = Koha::Patrons->find( $patron->{borrowernumber} );
$patron->{overdues} = $patron_object->get_overdues->count;
$patron->{issues} = $patron_object->checkouts->count;
$patron->{age} = $patron_object->get_age;
my $balance = $patron_object->account->balance;
# FIXME Should be formatted from the template
$patron->{fines} = sprintf("%.2f", $balance);

View File

@ -51,6 +51,12 @@
<li class="email"> <a href="mailto:[% patron.emailpro | url %]" title="[% patron.emailpro | html %]">[% patron.emailpro | html %]</a></li>
[% END %]
[% END %]
[% IF ( patron.dateofbirth ) %]
<li>
<span class="label">Date of birth:</span>
[% INCLUDE 'patron-age.inc' %]
</li>
[% END %]
[% UNLESS ( patron.address or patron.address2 ) %]
<li><span class="empty" id="noaddressstored">No address stored.</span></li>
@ -64,6 +70,10 @@
[% UNLESS ( patron.email or patron.emailpro) %]
<li> <span class="empty">No email stored.</span></li>
[% END %]
[% UNLESS ( patron.dateofbirth ) %]
<li> <span class="empty">No date of birth stored.</span></li>
[% END %]
[% END %]
[% IF Koha.Preference('ExtendedPatronAttributes') %]

View File

@ -26,7 +26,7 @@
<td><a href="[% data_url | url %]">[% borrower.surname | html %], [% borrower.firstname | html %]</a></td>
[% END %]
<td>[% borrower.cardnumber | html %]</td>
<td>[% borrower.dateofbirth | $KohaDates %]</td>
<td>[% INCLUDE 'patron-age.inc' patron = borrower %]</td>
<td>[% Categories.GetName( borrower.categorycode ) | html %]</td>
<td>[% Branches.GetName( borrower.branchcode ) | html %]</td>
<td>[% borrower.address | html %]</td>

View File

@ -0,0 +1,8 @@
[%- USE KohaDates -%]
[%- IF ( patron ) -%]
[%- IF ( patron.dateofbirth ) -%]
[% patron.dateofbirth | $KohaDates -%]
[%- IF ( patron.get_age ) %] ([% patron.get_age | html %] years)
[%- ELSIF ( patron.age ) %] ([% patron.age | html %] years)[% END -%]
[%- END -%]
[%- END -%]

View File

@ -249,7 +249,7 @@
[% IF ( patron.dateofbirth ) %]
<li>
<span class="label">Date of birth:</span>
[% patron.dateofbirth | $KohaDates %] ([% patron.get_age | html %] years)
[% INCLUDE 'patron-age.inc' %]
</li>
[% END %]
[% IF ( patron.sex ) %]

View File

@ -14,7 +14,7 @@
"dt_name":
"[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames cardnumber = data.cardnumber invert_name = 1%]",
"dt_dateofbirth":
"[% data.dateofbirth | $KohaDates %]",
"[% INCLUDE 'patron-age.inc' patron = data %]",
"dt_address":
"[% INCLUDE escape_address data=data %]",
"dt_action":

View File

@ -19,7 +19,7 @@
"dt_name":
"<a href=\"/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.borrowernumber | html %]\" class=\"patron_preview\" data-borrowernumber=\"[% data.borrowernumber | html %]\" style='white-space:nowrap'>[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames invert_name = 1 | $To %]</a><br />[% INCLUDE escape_address data = data %][% IF data.email %]<br/>Email: <a href='mailto:[% data.email | html | $To %]'>[% data.email | html | $To %]</a>[% END %]",
"dt_dateofbirth":
"[% data.dateofbirth | $KohaDates %]",
"[% INCLUDE 'patron-age.inc' patron = data %]",
"dt_category":
"[% data.category_description | html | $To %] ([% data.category_type | html | $To %])",
"dt_branch":

View File

@ -122,7 +122,6 @@ if ( !$patron->is_valid_age ) {
$template->param( age_low => $patron->category->dateofbirthrequired );
$template->param( age_high => $patron->category->upperagelimit );
}
$template->param( age => $patron->get_age );
# Generate CSRF token for upload and delete image buttons
$template->param(