chg: [events:index] Minimal searches returns events having event reports

and no attributes
pull/6412/head
mokaddem 2020-09-29 08:05:13 +02:00
parent 6aab30c871
commit 8087004922
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 8 additions and 1 deletions

View File

@ -627,7 +627,14 @@ class EventsController extends AppController
$v = $filterString;
break;
case 'minimal':
$this->paginate['conditions']['AND'][] = array('NOT' => array('Event.attribute_count' => 0));
$tableName = $this->Event->EventReport->table;
$eventReportQuery = sprintf('EXISTS (SELECT id, deleted FROM %s WHERE %s.event_id = Event.id and %s.deleted = 0)', $tableName, $tableName, $tableName);
$this->paginate['conditions']['AND'][] = [
'OR' => [
['NOT' => [ 'Event.attribute_count' => 0]],
[$eventReportQuery]
]
];
break;
default:
continue 2;