Fixed where contitions. Handle name parameter
This commit is contained in:
parent
0e1f78318e
commit
08b08e5619
|
@ -536,7 +536,7 @@ class Controller extends GenericController implements ExportableInterface {
|
||||||
'name',
|
'name',
|
||||||
'country',
|
'country',
|
||||||
'city',
|
'city',
|
||||||
'region',
|
'state',
|
||||||
'postcode',
|
'postcode',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -316,15 +316,19 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
|
||||||
'name',
|
'name',
|
||||||
'country',
|
'country',
|
||||||
'city',
|
'city',
|
||||||
'region',
|
'state',
|
||||||
'postcode',
|
'postcode',
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( ! empty( $query_args['filter_empty'] ) ) {
|
if ( ! empty( $query_args['filter_empty'] ) ) {
|
||||||
$fields_to_filter_by = array_intersect( $query_args['filter_empty'], $filter_empty_params );
|
$fields_to_filter_by = array_intersect( $query_args['filter_empty'], $filter_empty_params );
|
||||||
|
if ( in_array( 'name', $fields_to_filter_by, true ) ) {
|
||||||
|
$fields_to_filter_by = array_diff( $fields_to_filter_by, array( 'name' ) );
|
||||||
|
$fields_to_filter_by[] = "CONCAT_WS( ' ', first_name, last_name )";
|
||||||
|
}
|
||||||
$fields_with_not_condition = array_map(
|
$fields_with_not_condition = array_map(
|
||||||
function ( $field ) {
|
function ( $field ) {
|
||||||
return $field . ' IS NOT NULL';
|
return $field . ' <> \'\'';
|
||||||
},
|
},
|
||||||
$fields_to_filter_by
|
$fields_to_filter_by
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue