Bugzilla – Attachment 70490 Details for
Bug 19967
Search patrons with non-Latin languages is broken if DefaultPatronSearchFields includes date or datetime field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19967: Search patrons with non-Latin languages is brocken.
Bug-19967-Search-patrons-with-non-Latin-languages-.patch (text/plain), 1.88 KB, created by
Ulrich Kleiber
on 2018-01-15 15:30:42 UTC
(
hide
)
Description:
Bug 19967: Search patrons with non-Latin languages is brocken.
Filename:
MIME Type:
Creator:
Ulrich Kleiber
Created:
2018-01-15 15:30:42 UTC
Size:
1.88 KB
patch
obsolete
>From 862c2b7c3e08fe4ee6abdb9fd38b2814616e11b8 Mon Sep 17 00:00:00 2001 >From: Ulrich Kleiber <ulrich.kleiber@bsz-bw.de> >Date: Mon, 15 Jan 2018 16:26:00 +0100 >Subject: [PATCH] Bug 19967: Search patrons with non-Latin languages is > brocken. > >If DefaultPatronSearchFields includes a column with type >date, datetime or timestamp, search patrons with non-Latin >languages hangis on 'Processing...'. >Converting columns with type date, datetime or timestamp to >type string eliminates this bug. >--- > C4/Utils/DataTables/Members.pm | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index fd00664..4786c3f 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -7,6 +7,11 @@ use C4::Utils::DataTables; > use Koha::DateUtils; > use C4::Members::Attributes qw(SearchIdMatchingAttribute ); > >+my $dbh = C4::Context->dbh; >+ >+my $datatime_type_query = "SELECT DISTINCT column_name FROM information_schema.columns WHERE table_name = 'borrowers' AND data_type in ('date', 'datetime', 'timestamp')"; >+my @columns_with_datetime_type = @{ $dbh->selectcol_arrayref($datatime_type_query) }; >+ > sub search { > my ( $params ) = @_; > my $searchmember = $params->{searchmember}; >@@ -118,7 +123,12 @@ sub search { > > my @where_strs_or; > for my $searchfield ( split /,/, $searchfields->{$searchfieldstype} ) { >- push @where_strs_or, "borrowers." . $dbh->quote_identifier($searchfield) . " LIKE ?"; >+ if ( grep /^$searchfield$/, @columns_with_datetime_type ) { >+ 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; > } > >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19967
: 70490