mirror of https://github.com/MISP/MISP
Fix to an issue with the quickfilters not working, fixes comment by ztormhouse
- invalid search on the org field, a remnant from 2.3 - didn't cause exceptions on migrated issues as the field isn't removed post upgrade - throws an exception on fresh installations - fix now correctly looks up organisation names matching the entered string and uses the result set to filter the eventspull/854/head
parent
f04fbe3109
commit
1d089acc5b
|
@ -217,16 +217,18 @@ class EventsController extends AppController {
|
|||
}
|
||||
|
||||
// Finally, let's search on the event metadata!
|
||||
|
||||
$conditions = array();
|
||||
$orgs = $this->Event->Org->find('list', array(
|
||||
'conditions' => array('lower(name) LIKE' => '%' . strtolower($value) . '%'),
|
||||
'recursive' => -1,
|
||||
'fields' => array('id')
|
||||
));
|
||||
if (!empty($orgs)) $conditions['OR']['orgc_id'] = array_values($orgs);
|
||||
$conditions['OR']['lower(info) LIKE'] = '%' . strtolower($value) .'%';
|
||||
$otherEvents = $this->Event->find('all', array(
|
||||
'recursive' => -1,
|
||||
'fields' => array('id', 'orgc_id', 'info'),
|
||||
'conditions' => array(
|
||||
'OR' => array(
|
||||
'lower(orgc) LIKE' => '%' . strtolower($value) .'%',
|
||||
'lower(info) LIKE' => '%' . strtolower($value) .'%',
|
||||
),
|
||||
),
|
||||
'conditions' => $conditions,
|
||||
));
|
||||
foreach ($otherEvents as $oE) {
|
||||
if (!in_array($oE['Event']['id'], $result)) $result[] = $oE['Event']['id'];
|
||||
|
|
Loading…
Reference in New Issue