diff --git a/app/Controller/EventReportsController.php b/app/Controller/EventReportsController.php index 3d9bf0343..1b6a45f6e 100644 --- a/app/Controller/EventReportsController.php +++ b/app/Controller/EventReportsController.php @@ -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); diff --git a/app/Lib/EventReport/ReportFromEvent.php b/app/Lib/EventReport/ReportFromEvent.php index b223c788a..67508b7f8 100644 --- a/app/Lib/EventReport/ReportFromEvent.php +++ b/app/Lib/EventReport/ReportFromEvent.php @@ -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); }