From dad848a0a7154980d393c595361bde1bafcad9d5 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Thu, 12 Nov 2015 20:45:01 +0100 Subject: [PATCH] Bug 13931 - Date of birth in patron search result and in autocomplete Test plan: 1) Apply the patch 2) Type into search form patron's name & check his date of birth in autocompletion 3) Go to intranet/cgi-bin/koha/members/member.pl & submit a search with more than one result .. now should in the table appear patron's date of birth 4) Try show/hide columns section if it works correctly for date of birth 5) Go to intranet/cgi-bin/koha/admin/columns_settings.pl -> go to patrons section & check there is dateofbirth & it's functionality Signed-off-by: Frederic Demians Works as described. Syspref dateformat respected. Column dateofbirth configurable, but mandatory on autocompletion search result. Signed-off-by: Kyle M Hall Signed-off-by: Kyle M Hall --- admin/columns_settings.yml | 2 ++ circ/ysearch.pl | 2 ++ .../intranet-tmpl/prog/en/includes/patron-search-box.inc | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt | 5 +++++ .../prog/en/modules/members/tables/members_results.tt | 3 +++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 3849245263..a4129868fc 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -165,6 +165,8 @@ modules: columnname: cardnumber - columnname: name + - + columnname: dateofbirth - columnname: category - diff --git a/circ/ysearch.pl b/circ/ysearch.pl index 74e14ee503..c9557a4ad4 100755 --- a/circ/ysearch.pl +++ b/circ/ysearch.pl @@ -29,6 +29,7 @@ use CGI qw ( -utf8 ); use C4::Context; use C4::Auth qw/check_cookie_auth/; use Koha::Borrowers; +use Koha::DateUtils qw/format_sqldatetime/; use JSON qw( to_json ); @@ -83,6 +84,7 @@ while ( my $b = $borrowers_rs->next ) { surname => $b->surname // '', firstname => $b->firstname // '', cardnumber => $b->cardnumber // '', + dateofbirth => format_sqldatetime($b->dateofbirth, undef, undef, 1) // '', address => $b->address // '', city => $b->city // '', zipcode => $b->zipcode // '', diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc index a7e9061ed7..01a0d709f5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc @@ -14,7 +14,7 @@ $(document).ready(function(){ .data( "ui-autocomplete" )._renderItem = function( ul, item ) { return $( "
  • " ) .data( "ui-autocomplete-item", item ) - .append( "" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "" ) + .append( "" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") " + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "" ) .appendTo( ul ); }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index 411e8d24fe..074555b5e1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -173,6 +173,9 @@ $(document).ready(function() { },{ 'name': 'name_sorton', 'value': 'borrowers.surname borrowers.firstname' + },{ + 'name': 'dateofbirth', + 'value': 'borrowers.dateofbirth', },{ 'name': 'category_sorton', 'value': 'categories.description', @@ -205,6 +208,7 @@ $(document).ready(function() { [% END %] { 'mDataProp': 'dt_cardnumber' }, { 'mDataProp': 'dt_name' }, + { 'mDataProp': 'dt_dateofbirth' }, { 'mDataProp': 'dt_category' }, { 'mDataProp': 'dt_branch' }, { 'mDataProp': 'dt_dateexpiry' }, @@ -381,6 +385,7 @@ function filterByFirstLetterSurname(letter) { [% END %] Card Name + Date of birth Category Library Expires on 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 7d5e9622e1..159a816c81 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 @@ -1,5 +1,6 @@ [% USE To %] [% USE AuthorisedValues %] +[% USE KohaDates %] { "sEcho": [% sEcho %], "iTotalRecords": [% iTotalRecords %], @@ -15,6 +16,8 @@ "[% data.cardnumber | html %]", "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 %]
    [% INCLUDE escape_address data = data %]
    ", + "dt_dateofbirth": + "[% data.dateofbirth | $KohaDates %]", "dt_category": "[% data.category_description |html %] ([% data.category_type |html %])", "dt_branch": -- 2.39.5