fix: [Component:CRUD] Make set quickfilter works again

Call the function with correct number of argument
pull/93/head
Sami Mokaddem 2021-11-04 15:21:03 +01:00
parent 9f7f39ec85
commit bb9ca6e69d
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 9 additions and 8 deletions

View File

@ -363,12 +363,6 @@ class CRUDComponent extends Component
if (isset($params['beforeSave'])) {
$data = $params['beforeSave']($data);
}
/*
- Update meta_field table:
- Add created and modified
- Update meta_template_field_table:
- Add counter column
*/
$savedData = $this->Table->save($data);
if ($savedData !== false) {
if (isset($params['afterSave'])) {
@ -506,6 +500,13 @@ class CRUDComponent extends Component
$params['contain'][] = 'Tags';
$this->setAllTags();
}
if ($this->Table->hasBehavior('MetaFields')) { // TODO: check if has meta field behavior
if (!empty($this->request->getQuery('full'))) {
$params['contain']['MetaFields'] = ['MetaTemplateFields' => 'MetaTemplates'];
} else {
$params['contain'][] = 'MetaFields';
}
}
$data = $this->Table->get($id, $params);
$data = $this->attachMetaData($id, $data);
@ -804,7 +805,7 @@ class CRUDComponent extends Component
$this->Controller->set('quickFilter', empty($quickFilterFields) ? [] : $quickFilterFields);
if (!empty($params['quickFilter']) && !empty($quickFilterFields)) {
$this->Controller->set('quickFilterValue', $params['quickFilter']);
$queryConditions = $this->genQuickFilterConditions($params, $query, $quickFilterFields);
$queryConditions = $this->genQuickFilterConditions($params, $quickFilterFields);
$query->where(['OR' => $queryConditions]);
} else {
$this->Controller->set('quickFilterValue', '');

View File

@ -109,7 +109,7 @@ class MailingListsController extends AppController
'Individuals' => function (Query $q) use ($queryParams, $quickFilter, $matchingMetaFieldParentIDs) {
$conditions = [];
if (!empty($queryParams)) {
$conditions = $this->CRUD->genQuickFilterConditions($queryParams, $q, $quickFilter);
$conditions = $this->CRUD->genQuickFilterConditions($queryParams, $quickFilter);
}
if (!empty($matchingMetaFieldParentIDs)) {
$conditions[] = function (QueryExpression $exp) use ($matchingMetaFieldParentIDs) {