diff --git a/rest/index.php b/rest/index.php index c9273d695edcc9687883e411e4826fbe7fbbdf89..d5096b871e14f080d4a5fd2569c0012f2db5d706 100755 --- a/rest/index.php +++ b/rest/index.php @@ -312,9 +312,6 @@ $app->get('/roles', \Entity\controllers\ListTemplateController::class . ':getRol $app->get('/availableCircuits', \Entity\controllers\ListTemplateController::class . ':getAvailableCircuits'); $app->put('/circuits/{type}', \Entity\controllers\ListInstanceController::class . ':updateCircuits'); -//MessageExchanges -$app->get('/messageExchanges/{id}', \MessageExchange\controllers\MessageExchangeController::class . ':getById'); - //Notes $app->post('/notes', \Note\controllers\NoteController::class . ':create'); $app->get('/notes/{id}', \Note\controllers\NoteController::class . ':getById'); @@ -538,10 +535,13 @@ $app->get('/administration/notifications/new', \Notification\controllers\Notific $app->get('/notifications/{id}', \Notification\controllers\NotificationController::class . ':getBySid'); $app->post('/scriptNotification', \Notification\controllers\NotificationScheduleController::class . ':createScriptNotification'); +//External MessageExchanges +$app->get('/messageExchanges/{id}', \MessageExchange\controllers\MessageExchangeController::class . ':getById'); $app->post('/saveNumericPackage', \MessageExchange\controllers\ReceiveMessageExchangeController::class . ':saveMessageExchange'); $app->post('/saveMessageExchangeReturn', \MessageExchange\controllers\ReceiveMessageExchangeController::class . ':saveMessageExchangeReturn'); $app->post('/saveMessageExchangeReview', \MessageExchange\controllers\MessageExchangeReviewController::class . ':saveMessageExchangeReview'); $app->post('/resources/{resId}/messageExchange', \MessageExchange\controllers\SendMessageExchangeController::class . ':createMessageExchange'); +$app->get('/messageExchangesInitialization', \MessageExchange\controllers\SendMessageExchangeController::class . ':getInitialization'); //ExternalSignatoryBooks $app->get('/maarchParapheur/user/{id}/picture', \ExternalSignatoryBook\controllers\MaarchParapheurController::class . ':getUserPicture'); diff --git a/src/app/email/controllers/EmailController.php b/src/app/email/controllers/EmailController.php index 1069dd3862e3b6581b0f4c4edbfb7ec720d1dad2..8f318c6d6af001103212b3f7b5d5c38cc5fa90aa 100644 --- a/src/app/email/controllers/EmailController.php +++ b/src/app/email/controllers/EmailController.php @@ -351,7 +351,7 @@ class EmailController return $response->withJson(['emails' => $availableEmails]); } - public static function getInitializationByResId(Request $request, Response $response, array $args) + public function getInitializationByResId(Request $request, Response $response, array $args) { if (!Validator::intVal()->validate($args['resId']) || !ResController::hasRightByResId(['resId' => [$args['resId']], 'userId' => $GLOBALS['id']])) { return $response->withStatus(403)->withJson(['errors' => 'Document out of perimeter']); diff --git a/src/app/external/messageExchange/controllers/SendMessageExchangeController.php b/src/app/external/messageExchange/controllers/SendMessageExchangeController.php index 00971c4b45bdf037363abfed057ad6988089970e..afff1d8bf884e62615d0ce5efa0ca3eaee7e18df 100755 --- a/src/app/external/messageExchange/controllers/SendMessageExchangeController.php +++ b/src/app/external/messageExchange/controllers/SendMessageExchangeController.php @@ -22,7 +22,6 @@ use Entity\models\EntityModel; use ExportSeda\controllers\SendMessageController; use Group\controllers\PrivilegeController; use History\controllers\HistoryController; -use MessageExchange\controllers\ReceiveMessageExchangeController; use MessageExchange\models\MessageExchangeModel; use Note\models\NoteModel; use Resource\controllers\ResController; @@ -36,6 +35,25 @@ use Slim\Http\Response; class SendMessageExchangeController { + public function getInitialization(Request $request, Response $response) + { + $rawEntities = EntityModel::getWithUserEntities([ + 'select' => ['entities.entity_label', 'entities.business_id'], + 'where' => ['users_entities.user_id = ?', 'business_id is not null', 'business_id != ?'], + 'data' => [$GLOBALS['userId'], ''] + ]); + + $entities = []; + foreach ($rawEntities as $key => $entity) { + $entities[] = [ + 'label' => $entity['entity_label'], + 'm2m' => $entity['business_id'] + ]; + } + + return $response->withJson(['entities' => $entities]); + } + public static function saveMessageExchange($aArgs = []) { $dataObject = $aArgs['dataObject'];