From a5c7fcae4efa0a6a363b3a2524818e6c5c448c9f Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Fri, 20 Dec 2019 17:43:17 +0100 Subject: [PATCH] FEAT #12635 TIME 0:10 Add id for order by --- src/app/contact/controllers/ContactController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index c8853ecfeb7..e633252cce6 100755 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -17,7 +17,6 @@ use Contact\models\ContactCustomFieldListModel; use Contact\models\ContactFillingModel; use Contact\models\ContactModel; use Contact\models\ContactParameterModel; -use CustomField\models\CustomFieldModel; use Entity\models\EntityModel; use Group\controllers\PrivilegeController; use History\controllers\HistoryController; @@ -66,7 +65,7 @@ class ContactController $queryParams['offset'] = (empty($queryParams['offset']) || !is_numeric($queryParams['offset']) ? 0 : (int)$queryParams['offset']); $queryParams['limit'] = (empty($queryParams['limit']) || !is_numeric($queryParams['limit']) ? 25 : (int)$queryParams['limit']); $order = !in_array($queryParams['order'], ['asc', 'desc']) ? '' : $queryParams['order']; - $queryParams['orderBy'] = !in_array($queryParams['orderBy'], ['firstname', 'lastname', 'company']) ? null : ["{$queryParams['orderBy']} {$order}"]; + $queryParams['orderBy'] = !in_array($queryParams['orderBy'], ['firstname', 'lastname', 'company']) ? ['id'] : ["{$queryParams['orderBy']} {$order}", 'id']; if (!empty($queryParams['search'])) { $fields = ['firstname', 'lastname', 'company', 'address_number', 'address_street', 'address_additional1', 'address_additional2', 'address_postcode', 'address_town', 'address_country']; -- GitLab