diff --git a/apps/maarch_entreprise/xml/services.xml b/apps/maarch_entreprise/xml/services.xml index 562ef4fec161cfd97da869ab3c1fabfd8f9379fb..f0958ba837a57c9b6ff9c36ab956d6cba2312051 100755 --- a/apps/maarch_entreprise/xml/services.xml +++ b/apps/maarch_entreprise/xml/services.xml @@ -90,7 +90,7 @@ <id>view_history_batch</id> <name>_HISTORY_BATCH</name> <comment>_ADMIN_HISTORY_BATCH_DESC</comment> - <servicepage>/administration/historyBatch</servicepage> + <servicepage>/administration</servicepage> <servicetype>admin</servicetype> <category>supervision</category> <system_service>false</system_service> diff --git a/src/app/group/models/ServiceModelAbstract.php b/src/app/group/models/ServiceModelAbstract.php index cca49003ed095b290f1fdf961972e6cae76ea651..03dd8a34673f4c0671ab33a4684635742f9950e0 100755 --- a/src/app/group/models/ServiceModelAbstract.php +++ b/src/app/group/models/ServiceModelAbstract.php @@ -104,18 +104,29 @@ abstract class ServiceModelAbstract $applicationServices = []; if ($xmlfile) { + $hasHistory = false; foreach ($xmlfile->SERVICE as $value) { if ((string) $value->servicetype == 'admin' && (string) $value->enabled === 'true' && ((string) $value->system_service == 'true' || in_array((string) $value->id, $aArgs['userServices']))) { - $category = (string) $value->category; - $name = defined((string) $value->name) ? constant((string) $value->name) : (string) $value->name; - $comment = defined((string) $value->comment) ? constant((string) $value->comment) : (string) $value->comment; - $applicationServices[$category][] = [ - 'name' => $name, - 'comment' => $comment, - 'servicepage' => (string) $value->servicepage, - 'style' => (string) $value->style, - 'angular' => empty((string) $value->angular) ? 'false' : (string) $value->angular, - ]; + if ((string)$value->id == 'view_history' || (string)$value->id == 'view_history_batch') { + $hasHistory = true; + } + } + } + foreach ($xmlfile->SERVICE as $value) { + $historyByPass = (string)$value->id == 'view_history' && $hasHistory; + if ($historyByPass || ((string) $value->servicetype == 'admin' && (string) $value->enabled === 'true' && ((string) $value->system_service == 'true' || in_array((string) $value->id, $aArgs['userServices'])))) { + if ((string)$value->id != 'view_history_batch') { + $category = (string) $value->category; + $name = defined((string) $value->name) ? constant((string) $value->name) : (string) $value->name; + $comment = defined((string) $value->comment) ? constant((string) $value->comment) : (string) $value->comment; + $applicationServices[$category][] = [ + 'name' => $name, + 'comment' => $comment, + 'servicepage' => (string) $value->servicepage, + 'style' => (string) $value->style, + 'angular' => empty((string) $value->angular) ? 'false' : (string) $value->angular, + ]; + } } } } @@ -319,17 +330,7 @@ abstract class ServiceModelAbstract $administration = []; $administrationApplication = ServiceModel::getApplicationAdministrationServicesByUserServices(['userServices' => $servicesStoredInDB]); $administrationModule = ServiceModel::getModulesAdministrationServicesByUserServices(['userServices' => $servicesStoredInDB]); - - foreach ($administrationApplication['supervision'] as $key => $value) { - if ($value['name'] === _HISTORY_BATCH) { - array_splice($administrationApplication['supervision'], $key, 1); - } - } - unset($key); - $administration['administrations'] = array_merge_recursive($administrationApplication, $administrationModule); - - return $administration; } diff --git a/src/app/template/controllers/TemplateController.php b/src/app/template/controllers/TemplateController.php index 948202985c319b9e6fac1c9c4b04ff7808bafade..73753615cb0d24005ad8a402446d5288efc231c1 100644 --- a/src/app/template/controllers/TemplateController.php +++ b/src/app/template/controllers/TemplateController.php @@ -58,7 +58,7 @@ class TemplateController return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } - $template = TemplateModel::getById(['id' => $aArgs['id']]); + $template = TemplateModel::getById(['id' => $aArgs['id'], 'select' => [1]]); if (empty($template)) { return $response->withStatus(400)->withJson(['errors' => 'Template does not exist']); } @@ -225,8 +225,8 @@ class TemplateController $data['template_file_name'] = $storeResult['file_destination_name']; } + TemplateAssociationModel::delete(['where' => ['template_id = ?'], 'data' => [$aArgs['id']]]); if (!empty($data['entities']) && is_array($data['entities'])) { - TemplateAssociationModel::delete(['where' => ['template_id = ?'], 'data' => [$aArgs['id']]]); foreach ($data['entities'] as $entity) { TemplateAssociationModel::create(['templateId' => $aArgs['id'], 'entityId' => $entity]); }