From 2cc3d05d267bae41ba30473f23fe59950da6aeb3 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Fri, 2 Nov 2018 08:13:35 +0000 Subject: [PATCH] Bug 15400: Display date of birth and age more consistantly MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Kyle M Hall Signed-off-by: Séverine QUEUNE Signed-off-by: Katrin Fischer Signed-off-by: Michal Denar Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- C4/Utils/DataTables/Members.pm | 1 + koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc | 10 ++++++++++ .../prog/en/includes/circ-patron-search-results.inc | 2 +- .../intranet-tmpl/prog/en/includes/patron-age.inc | 8 ++++++++ .../prog/en/modules/members/moremember.tt | 2 +- .../prog/en/modules/members/tables/guarantor_search.tt | 2 +- .../prog/en/modules/members/tables/members_results.tt | 2 +- members/moremember.pl | 1 - 8 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron-age.inc diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index 580a3eab49..a718a9633e 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -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); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 5e020f15f3..948a95c075 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -51,6 +51,12 @@ [% END %] [% END %] + [% IF ( patron.dateofbirth ) %] +
  • + Date of birth: + [% INCLUDE 'patron-age.inc' %] +
  • + [% END %] [% UNLESS ( patron.address or patron.address2 ) %]
  • No address stored.
  • @@ -64,6 +70,10 @@ [% UNLESS ( patron.email or patron.emailpro) %]
  • No email stored.
  • [% END %] + [% UNLESS ( patron.dateofbirth ) %] +
  • No date of birth stored.
  • + [% END %] + [% END %] [% IF Koha.Preference('ExtendedPatronAttributes') %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc index 50821d14a8..0c31cbf291 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-patron-search-results.inc @@ -26,7 +26,7 @@ [% borrower.surname | html %], [% borrower.firstname | html %] [% END %] [% borrower.cardnumber | html %] - [% borrower.dateofbirth | $KohaDates %] + [% INCLUDE 'patron-age.inc' patron = borrower %] [% Categories.GetName( borrower.categorycode ) | html %] [% Branches.GetName( borrower.branchcode ) | html %] [% borrower.address | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-age.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-age.inc new file mode 100644 index 0000000000..c89382b641 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-age.inc @@ -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 -%] 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 0757ae74fd..b4351f4afa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -249,7 +249,7 @@ [% IF ( patron.dateofbirth ) %]
  • Date of birth: - [% patron.dateofbirth | $KohaDates %] ([% patron.get_age | html %] years) + [% INCLUDE 'patron-age.inc' %]
  • [% END %] [% IF ( patron.sex ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt index a82f0e8dcb..38ec5aa9e0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/guarantor_search.tt @@ -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": diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt index ae6364dedf..6bfeb08b9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt @@ -19,7 +19,7 @@ "dt_name": "[% 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 %]
    [% INCLUDE escape_address data = data %][% IF data.email %]
    Email: [% data.email | html | $To %][% 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": diff --git a/members/moremember.pl b/members/moremember.pl index 656ee35a93..93efa7a4b5 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -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( -- 2.39.5