From 2649d20f155691e52b9b63a2595a937e6c756d2c Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Thu, 24 Oct 2019 09:18:36 +0100
Subject: [PATCH] FEAT #12070 TIME 0:10 return action categories

---
 src/app/resource/controllers/IndexingController.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/app/resource/controllers/IndexingController.php b/src/app/resource/controllers/IndexingController.php
index 0fa97efb438..c2f68fd3825 100755
--- a/src/app/resource/controllers/IndexingController.php
+++ b/src/app/resource/controllers/IndexingController.php
@@ -123,9 +123,11 @@ class IndexingController
 
         $actions = [];
         foreach ($indexingParameters['indexingParameters']['actions'] as $value) {
-            $action = ActionModel::getById(['id' => $value, 'select' => ['id', 'label_action', 'component', 'id_status']]);
+            $action         = ActionModel::getById(['id' => $value, 'select' => ['id', 'label_action', 'component', 'id_status']]);
+            $categoriesList = ActionModel::getCategoriesById(['id' => $value]);
 
-            $action['enabled'] = !empty($action['id_status']) && $action['id_status'] != '_NOSTATUS_';
+            $action['enabled']    = !empty($action['id_status']) && $action['id_status'] != '_NOSTATUS_';
+            $action['categories'] = array_column($categoriesList, 'category_id');
             $actions[] = $action;
         }
 
@@ -163,8 +165,8 @@ class IndexingController
         $allowedEntities = array_unique($allowedEntities);
 
         $entitiesTmp = EntityModel::get([
-            'select'   => ['id', 'entity_label', 'entity_id'], 
-            'where'    => ['enabled = ?', '(parent_entity_id is null OR parent_entity_id = \'\')'], 
+            'select'   => ['id', 'entity_label', 'entity_id'],
+            'where'    => ['enabled = ?', '(parent_entity_id is null OR parent_entity_id = \'\')'],
             'data'     => ['Y'],
             'orderBy'  => ['entity_label']
         ]);
-- 
GitLab