diff --git a/src/Ushahidi/Modules/V5/DTO/PostSearchFields.php b/src/Ushahidi/Modules/V5/DTO/PostSearchFields.php index fa2ff73dbe..a75dc41833 100644 --- a/src/Ushahidi/Modules/V5/DTO/PostSearchFields.php +++ b/src/Ushahidi/Modules/V5/DTO/PostSearchFields.php @@ -105,23 +105,24 @@ public function __construct(Request $request) $this->parent = $this->getParameterAsArray($request->get('parent')); } + $this->include_unstructured_posts = $request->has('include_unstructured_posts') + ? filter_var($request->query('include_unstructured_posts'), FILTER_VALIDATE_BOOLEAN) + : true; // defaulte include unstructured posts $this->form_condition = "all"; $this->form = []; // no conditions if (!$request->has('form')) { - if ($request->has('include_unstructured_posts') && !$request->get('include_unstructured_posts')) { + if (!$this->include_unstructured_posts) { $this->form_condition = "not_null"; - $this->form = []; // no conditions } } else { if ($request->get('form') == 'none') { - $this->form = []; // no conditions $this->form_condition = "null"; } else { $this->form_condition = "include"; $this->form = $this->getParameterAsArray($request->get('form')); } } - + if ($request->get('status') == 'all') { $this->status = []; // no conditions @@ -155,7 +156,6 @@ public function __construct(Request $request) $this->set = $this->getParameterAsArray($request->get('set')); $this->tags = $this->getParameterAsArray($request->get('tags')); - $this->include_unstructured_posts = $request->query('include_unstructured_posts'); }