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',
|
||||
'country',
|
||||
'city',
|
||||
'region',
|
||||
'state',
|
||||
'postcode',
|
||||
),
|
||||
),
|
||||
|
|
|
@ -316,15 +316,19 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
|
|||
'name',
|
||||
'country',
|
||||
'city',
|
||||
'region',
|
||||
'state',
|
||||
'postcode',
|
||||
);
|
||||
|
||||
if ( ! empty( $query_args['filter_empty'] ) ) {
|
||||
$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(
|
||||
function ( $field ) {
|
||||
return $field . ' IS NOT NULL';
|
||||
return $field . ' <> \'\'';
|
||||
},
|
||||
$fields_to_filter_by
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue