From 821ef64cf10128295af5442ea197ca5cae0812d8 Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Sun, 3 Nov 2019 18:57:34 +0100 Subject: [PATCH] FIX data_fr and empty action categories list --- sql/data_fr.sql | 12 ++++++------ .../resource/controllers/IndexingController.php | 15 ++++++++++++--- src/frontend/app/process/process.component.ts | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/sql/data_fr.sql b/sql/data_fr.sql index 5725a38dbec..22613fd79f0 100755 --- a/sql/data_fr.sql +++ b/sql/data_fr.sql @@ -1682,8 +1682,8 @@ INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_val INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'initiator', TRUE, null, 'process'); INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'destination', TRUE, null, 'process'); INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'processLimitDate', TRUE, null, 'process'); -INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'folder', FALSE, null, 'classement'); -INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'tags', FALSE, null, 'classement'); +INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'folder', FALSE, null, 'classifying'); +INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'tags', FALSE, null, 'classifying'); /* Départ */ INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'doctype', TRUE, null, 'mail'); @@ -1697,8 +1697,8 @@ INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_val INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'initiator', TRUE, null, 'process'); INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'destination', TRUE, null, 'process'); INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'processLimitDate', TRUE, null, 'process'); -INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'folder', FALSE, null, 'classement'); -INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'tags', FALSE, null, 'classement'); +INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'folder', FALSE, null, 'classifying'); +INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'tags', FALSE, null, 'classifying'); /* Interne */ INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (3, 'doctype', TRUE, null, 'mail'); @@ -1711,8 +1711,8 @@ INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_val INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (3, 'initiator', TRUE, null, 'process'); INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (3, 'destination', TRUE, null, 'process'); INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (3, 'processLimitDate', TRUE, null, 'process'); -INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (3, 'folder', FALSE, null, 'classement'); -INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (3, 'tags', FALSE, null, 'classement'); +INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (3, 'folder', FALSE, null, 'classifying'); +INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (3, 'tags', FALSE, null, 'classifying'); /* GED */ INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (4, 'doctype', TRUE, null, 'mail'); diff --git a/src/app/resource/controllers/IndexingController.php b/src/app/resource/controllers/IndexingController.php index 52b45441307..09302c9cb4c 100755 --- a/src/app/resource/controllers/IndexingController.php +++ b/src/app/resource/controllers/IndexingController.php @@ -122,13 +122,22 @@ class IndexingController } $actions = []; + $categories = ResModel::getCategories(); + foreach ($indexingParameters['indexingParameters']['actions'] as $value) { $action = ActionModel::getById(['id' => $value, 'select' => ['id', 'label_action', 'component', 'id_status']]); $categoriesList = ActionModel::getCategoriesById(['id' => $value]); - $action['label'] = $action['label_action']; - $action['enabled'] = !empty($action['id_status']) && $action['id_status'] != '_NOSTATUS_'; - $action['categories'] = array_column($categoriesList, 'category_id'); + $action['label'] = $action['label_action']; + $action['enabled'] = !empty($action['id_status']) && $action['id_status'] != '_NOSTATUS_'; + + if (!empty($categoriesList)) { + $action['categories'] = array_column($categoriesList, 'category_id'); + } else { + foreach ($categories as $category) { + $action['categories'][] = $category['id']; + } + } unset($action['label_action'], $action['id_status']); $actions[] = $action; } diff --git a/src/frontend/app/process/process.component.ts b/src/frontend/app/process/process.component.ts index b4142351c88..05a744779cf 100644 --- a/src/frontend/app/process/process.component.ts +++ b/src/frontend/app/process/process.component.ts @@ -20,7 +20,7 @@ import { DocumentViewerComponent } from '../viewer/document-viewer.component'; templateUrl: "process.component.html", styleUrls: [ 'process.component.scss', - '/../indexation/indexing-form/indexing-form.component.scss' + '../indexation/indexing-form/indexing-form.component.scss' ], providers: [NotificationService, AppService, ActionsService], }) -- GitLab