View | Details | Raw Unified | Return to bug 19967
Collapse All | Expand All

(-)a/C4/Utils/DataTables/Members.pm (-2 / +11 lines)
Lines 7-12 use C4::Utils::DataTables; Link Here
7
use Koha::DateUtils;
7
use Koha::DateUtils;
8
use C4::Members::Attributes qw(SearchIdMatchingAttribute );
8
use C4::Members::Attributes qw(SearchIdMatchingAttribute );
9
9
10
my $dbh = C4::Context->dbh;
11
12
my $datatime_type_query = "SELECT DISTINCT column_name FROM information_schema.columns WHERE table_name = 'borrowers' AND data_type  in ('date', 'datetime', 'timestamp')";
13
my @columns_with_datetime_type = @{ $dbh->selectcol_arrayref($datatime_type_query) };
14
10
sub search {
15
sub search {
11
    my ( $params ) = @_;
16
    my ( $params ) = @_;
12
    my $searchmember = $params->{searchmember};
17
    my $searchmember = $params->{searchmember};
Lines 118-124 sub search { Link Here
118
123
119
        my @where_strs_or;
124
        my @where_strs_or;
120
        for my $searchfield ( split /,/, $searchfields->{$searchfieldstype} ) {
125
        for my $searchfield ( split /,/, $searchfields->{$searchfieldstype} ) {
121
            push @where_strs_or, "borrowers." . $dbh->quote_identifier($searchfield) . " LIKE ?";
126
            if ( grep /^$searchfield$/, @columns_with_datetime_type ) {
127
                push @where_strs_or, "DATE_FORMAT(borrowers." . $dbh->quote_identifier($searchfield) . ", '%Y-%m-%d') LIKE ?";
128
            } else {
129
                push @where_strs_or, "borrowers." . $dbh->quote_identifier($searchfield) . " LIKE ?";
130
            }
131
122
            push @where_args, $term;
132
            push @where_args, $term;
123
        }
133
        }
124
134
125
- 

Return to bug 19967