[Koha-bugs] [Bug 19967] New: Search patrons with non-Latin languages is brocken if DefaultPatronSearchFields includes dateofbirth

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jan 12 17:21:41 CET 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19967

            Bug ID: 19967
           Summary: Search patrons with non-Latin languages is brocken if
                    DefaultPatronSearchFields includes dateofbirth
 Change sponsored?: ---
           Product: Koha
           Version: 16.11
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Patrons
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: ulrich.kleiber at bsz-bw.de
        QA Contact: testopia at bugs.koha-community.org
                CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com

In this particular case you get the mysql error message: 

Illegal mix of collations for operation 'like'

You can prevent this error by removing dateofbirth from
DefaultPatronSearchFields or by the following patch:

diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm
index 2446703..ba32a12 100644
--- a/C4/Utils/DataTables/Members.pm
+++ b/C4/Utils/DataTables/Members.pm
@@ -117,7 +117,12 @@ sub search {

         my @where_strs_or;
         for my $searchfield ( split /,/, $searchfields->{$searchfieldstype} )
{
-            push @where_strs_or, "borrowers." .
$dbh->quote_identifier($searchfield) . " LIKE ?";
+            if ( $searchfield eq 'dateofbirth' ) {
+                push @where_strs_or, "DATE_FORMAT(borrowers." .
$dbh->quote_identifier($searchfield) . ", '%Y-%m-%d') LIKE ?";
+            } else {
+                push @where_strs_or, "borrowers." .
$dbh->quote_identifier($searchfield) . " LIKE ?";
+            }
+
             push @where_args, $term;
         }

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


More information about the Koha-bugs mailing list