Bug 13931 - Date of birth in patron search result and in autocomplete
authorJosef Moravec <josef.moravec@gmail.com>
Thu, 12 Nov 2015 19:45:01 +0000 (20:45 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 31 Dec 2015 13:40:29 +0000 (13:40 +0000)
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 <f.demians@tamil.fr>
  Works as described. Syspref dateformat respected. Column dateofbirth
  configurable, but mandatory on autocompletion search result.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
admin/columns_settings.yml
circ/ysearch.pl
koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt

index 3849245..a412986 100644 (file)
@@ -165,6 +165,8 @@ modules:
           columnname: cardnumber
         -
           columnname: name
+        -
+          columnname: dateofbirth
         -
           columnname: category
         -
index 74e14ee..c9557a4 100755 (executable)
@@ -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    // '',
index a7e9061..01a0d70 100644 (file)
@@ -14,7 +14,7 @@ $(document).ready(function(){
     .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
         return $( "<li></li>" )
         .data( "ui-autocomplete-item", item )
-        .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
+        .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.dateofbirth + " " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
         .appendTo( ul );
     };
 
index 411e8d2..074555b 100644 (file)
@@ -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 %]
                   <th>Card</th>
                   <th>Name</th>
+                  <th>Date of birth</>
                   <th>Category</th>
                   <th>Library</th>
                   <th>Expires on</th>
index 7d5e962..159a816 100644 (file)
@@ -1,5 +1,6 @@
 [% USE To %]
 [% USE AuthorisedValues %]
+[% USE KohaDates %]
 {
     "sEcho": [% sEcho %],
     "iTotalRecords": [% iTotalRecords %],
@@ -15,6 +16,8 @@
                     "[% data.cardnumber | html %]",
                 "dt_name":
                     "<span style='white-space:nowrap'><a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.borrowernumber %]'>[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames invert_name = 1 %]</a><br />[% INCLUDE escape_address data = data %]</span>",
+               "dt_dateofbirth":
+                   "[% data.dateofbirth | $KohaDates %]",
                 "dt_category":
                     "[% data.category_description |html %] ([% data.category_type |html %])",
                 "dt_branch":