- Adds global filter to search custom fields
- Updates tests
This commit is contained in:
@@ -123,15 +123,14 @@ class Subscriber extends Model {
|
||||
return $orm->where('status', $group);
|
||||
}
|
||||
|
||||
static function withCustomFields($orm) {
|
||||
static function filterWithCustomFields($orm) {
|
||||
$orm = $orm->select(MP_SUBSCRIBERS_TABLE.'.*');
|
||||
$customFields = CustomField::findArray();
|
||||
foreach ($customFields as $customField) {
|
||||
$orm = $orm->select_expr(
|
||||
'IFNULL(GROUP_CONCAT(CASE WHEN ' .
|
||||
MP_CUSTOM_FIELDS_TABLE . '.id=' . $customField['id'] . ' THEN ' .
|
||||
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.value END), NULL) as ' .
|
||||
$customField['name']);
|
||||
MP_SUBSCRIBER_CUSTOM_FIELD_TABLE . '.value END), NULL) as "' . $customField['name'].'"');
|
||||
}
|
||||
$orm = $orm
|
||||
->left_outer_join(
|
||||
@@ -253,4 +252,4 @@ class Subscriber extends Model {
|
||||
|
||||
return $listing->getSelection()->deleteMany();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user