Skip to content
Snippets Groups Projects
Verified Commit de44a536 authored by Damien's avatar Damien
Browse files

FEAT #8956 Improve list : Filters and order again

parent 9df3cc1e
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,14 @@ class ResourceListController
if (!empty($data['delayed']) && $data['delayed'] == 'true') {
$where[] = 'process_limit_date < CURRENT_TIMESTAMP';
}
if (!empty($data['reference'])) {
$where[] = 'alt_identifier ilike ?';
$queryData[] = "%{$data['reference']}%";
}
if (!empty($data['subject']) && mb_strlen($data['subject']) >= 3) {
$where[] = 'subject ilike ?';
$queryData[] = "%{$data['subject']}%";
}
if (!empty($data['priorities'])) {
$where[] = 'priority in (?)';
$queryData[] = explode(',', $data['priorities']);
......@@ -96,6 +104,10 @@ class ResourceListController
$where[] = 'category_id in (?)';
$queryData[] = explode(',', $data['categories']);
}
if (!empty($data['statuses'])) {
$where[] = 'status in (?)';
$queryData[] = explode(',', $data['statuses']);
}
if (!empty($data['entities'])) {
$where[] = 'destination in (?)';
$queryData[] = explode(',', $data['entities']);
......@@ -113,6 +125,10 @@ class ResourceListController
}
}
if (!empty($data['order']) && strpos($data['order'], 'alt_identifier') !== false) {
$data['order'] = 'order_alphanum(alt_identifier) ' . explode(' ', $data['order'])[1];
}
$rawResources = ResModel::getOnView([
'select' => ['count(1) OVER()', 'res_id'],
'where' => $where,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment