diff --git a/rest/index.php b/rest/index.php index ebcc482cdf200bcd4a08617b8c649ee95d2f8e6f..4397f71049112798e168041857f6caedd66152e6 100755 --- a/rest/index.php +++ b/rest/index.php @@ -493,8 +493,10 @@ $app->post('/saveNumericPackage', \Sendmail\Controllers\ReceiveMessageExchangeCo $app->post('/saveMessageExchangeReturn', \Sendmail\Controllers\ReceiveMessageExchangeController::class . ':saveMessageExchangeReturn'); $app->post('/saveMessageExchangeReview', \Sendmail\Controllers\MessageExchangeReviewController::class . ':saveMessageExchangeReview'); +//ExternalSignatoryBooks $app->get('/maarchParapheur/user/{id}/picture', \ExternalSignatoryBook\controllers\MaarchParapheurController::class . ':getUserPicture'); - +$app->get('/externalSignatureBooks/enabled', \ExternalSignatoryBook\controllers\ExternalSignatureBookController::class . ':getEnabledSignatureBook'); $app->get('/externalSummary/{resId}', \ExternalSummary\controllers\SummaryController::class . ':getByResId'); + $app->run(); diff --git a/src/app/external/externalSignatoryBook/controllers/ExternalSignatureBookController.php b/src/app/external/externalSignatoryBook/controllers/ExternalSignatureBookController.php new file mode 100644 index 0000000000000000000000000000000000000000..18c345f152c8e746a281450a06f776bef3f91234 --- /dev/null +++ b/src/app/external/externalSignatoryBook/controllers/ExternalSignatureBookController.php @@ -0,0 +1,42 @@ +<?php + +/** +* Copyright Maarch since 2008 under licence GPLv3. +* See LICENCE.txt file at the root folder for more details. +* This file is part of Maarch software. +* +*/ + +/** +* @brief External Signature Book Controller +* @author dev@maarch.org +*/ + +namespace ExternalSignatoryBook\controllers; + +use Slim\Http\Request; +use Slim\Http\Response; +use SrcCore\models\CoreConfigModel; + +class ExternalSignatureBookController +{ + public function getEnabledSignatureBook(Request $request, Response $response) + { + $enabledSignatureBook = null; + + $loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'modules/visa/xml/remoteSignatoryBooks.xml']); + if (!empty($loadedXml)) { + $enabledOne = (string)$loadedXml->signatoryBookEnabled; + foreach ($loadedXml->signatoryBook as $value) { + if ((string)$value->id == $enabledOne) { + if (!empty($value->url) && !empty($value->userId) && !empty($value->password)) { + $enabledSignatureBook = $enabledOne; + } + break; + } + } + } + + return $response->withJson(['enabledSignatureBook' => $enabledSignatureBook]); + } +} diff --git a/src/app/signatureBook/controllers/SignatureBookController.php b/src/app/signatureBook/controllers/SignatureBookController.php index 969f11003e9622cd948410f151d6958ae63aaf77..7a18f6220f032381f934d6dcda837e112a6daa5a 100755 --- a/src/app/signatureBook/controllers/SignatureBookController.php +++ b/src/app/signatureBook/controllers/SignatureBookController.php @@ -187,7 +187,6 @@ class SignatureBookController continue; } - $realId = 0; $realId = $value['res_id']; $convertedAttachment = ConvertPdfController::getConvertedPdfById(['select' => ['docserver_id', 'path', 'filename'], 'resId' => $realId, 'collId' => 'attachments_coll']);