fix: [eventReport:reprotFromEvent] Make sure filtering condition are not empty

pull/7707/head
mokaddem 2021-08-31 08:13:56 +02:00
parent a7270cc7c8
commit 08986712e1
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 7 additions and 3 deletions

View File

@ -336,6 +336,9 @@ class EventReportsController extends AppController
if ($this->request->is('post') || $this->request->is('put')) {
$filters = $this->EventReport->jsonDecode($this->data['EventReport']['filters']);
$options['conditions'] = $filters;
$options['conditions'] = array_filter($filters, function($v) {
return $v !== '';
});
$options['event_id'] = $eventId;
App::uses('ReportFromEvent', 'EventReport');
$optionFields = array_keys((new ReportFromEvent())->acceptedOptions);

View File

@ -33,14 +33,15 @@
private function getAttributes()
{
$filterConditions = $this->__eventModel->Attribute->buildFilterConditions($this->__user, $this->__options['conditions']);
$options = [
'includeWarninglistHits' => true,
'includeSightings' => true,
'includeCorrelations' => true,
'conditions' => [
'Attribute.event_id' => $this->__options['event_id'],
'conditions' => array_merge(
['Attribute.event_id' => $this->__options['event_id']],
$filterConditions
]
)
];
$this->attributes = $this->__eventModel->Attribute->fetchAttributes($this->__user, $options);
}