Fixed where contitions. Handle name parameter

This commit is contained in:
kidinov 2023-06-21 13:37:38 +02:00
parent 0e1f78318e
commit 08b08e5619
2 changed files with 7 additions and 3 deletions

View File

@ -536,7 +536,7 @@ class Controller extends GenericController implements ExportableInterface {
'name',
'country',
'city',
'region',
'state',
'postcode',
),
),

View File

@ -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
);