diff --git a/.env b/.env index eeaaf67d4..b4fc74ddf 100755 --- a/.env +++ b/.env @@ -36,7 +36,6 @@ WIDGET_SIGNALEMENT_TERRITOIRE_CACHE_EXPIRED_AFTER=30 #second WIDGET_ESABORA_EVENTS_CACHE_EXPIRED_AFTER=3600 #second FEATURE_ASK_VISITE_ENABLE=1 FEATURE_OILHI_ENABLE=1 -FEATURE_DOCUMENTS_ENABLE=1 CRON_ENABLE=1 MAIL_ENABLE=1 ESABORA_CRON_CLOCK_SLEEP_INTERVAL=60 #second diff --git a/.env.sample b/.env.sample index 7f8a1ce38..b23e14451 100755 --- a/.env.sample +++ b/.env.sample @@ -25,7 +25,6 @@ WIREMOCK_HOSTNAME=histologe_wiremock WIREMOCK_PORT=8080 FEATURE_OILHI_ENABLE=1 FEATURE_ASK_VISITE_ENABLE=1 -FEATURE_DOCUMENTS_ENABLE=1 CRON_ENABLE=1 MAIL_ENABLE=1 ESABORA_CRON_CLOCK_SLEEP_INTERVAL=60 #second diff --git a/config/services.yaml b/config/services.yaml index dea6e4b44..0fca805e4 100755 --- a/config/services.yaml +++ b/config/services.yaml @@ -31,7 +31,6 @@ parameters: mail_enable: '%env(bool:MAIL_ENABLE)%' feature_ask_visite: '%env(FEATURE_ASK_VISITE_ENABLE)%' feature_oilhi_enable: '%env(bool:FEATURE_OILHI_ENABLE)%' - feature_documents_enable: '%env(bool:FEATURE_DOCUMENTS_ENABLE)%' feature_signalement_liste_enable: '%env(bool:FEATURE_LIST_FILTER_ENABLE)%' platform_name: 'Histologe' matomo_enable: '%env(bool:MATOMO_ENABLE)%' diff --git a/src/Controller/Back/SignalementController.php b/src/Controller/Back/SignalementController.php index 26e860658..ee074af0a 100755 --- a/src/Controller/Back/SignalementController.php +++ b/src/Controller/Back/SignalementController.php @@ -209,7 +209,6 @@ public function viewSignalement( 'listConcludeProcedures' => $listConcludeProcedures, 'partnersCanVisite' => $partnerVisite, 'pendingVisites' => $interventionRepository->getPendingVisitesForSignalement($signalement), - 'isDocumentsEnabled' => $parameterBag->get('feature_documents_enable'), 'allPhotosOrdered' => $allPhotosOrdered, ]); } @@ -248,7 +247,8 @@ public function newDeleteSignalement( $this->denyAccessUnlessGranted('SIGN_DELETE', $signalement); if ($this->isCsrfTokenValid( 'signalement_delete_'.$signalement->getId(), - $request->getPayload()->get('_token')) + $request->getPayload()->get('_token') + ) ) { $signalement->setStatut(Signalement::STATUS_ARCHIVED); $doctrine->getManager()->persist($signalement); diff --git a/src/Controller/Back/SignalementFileController.php b/src/Controller/Back/SignalementFileController.php index ef377e8cf..d601ff9a7 100755 --- a/src/Controller/Back/SignalementFileController.php +++ b/src/Controller/Back/SignalementFileController.php @@ -17,7 +17,6 @@ use Doctrine\ORM\EntityManagerInterface; use League\Flysystem\FilesystemException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -57,10 +56,7 @@ public function addFileSignalement( Signalement $signalement, Request $request, EntityManagerInterface $entityManager, - SuiviManager $suiviManager, - SignalementFileProcessor $signalementFileProcessor, - #[Autowire(env: 'FEATURE_DOCUMENTS_ENABLE')] - bool $featureDocumentsEnable + SignalementFileProcessor $signalementFileProcessor ): Response { $this->denyAccessUnlessGranted('FILE_CREATE', $signalement); if (!$this->isCsrfTokenValid('signalement_add_file_'.$signalement->getId(), $request->get('_token')) || !$files = $request->files->get('signalement-add-file')) { @@ -89,18 +85,12 @@ public function addFileSignalement( return $this->redirect($this->generateUrl('back_signalement_view', ['uuid' => $signalement->getUuid()])); } - if ($featureDocumentsEnable) { - $signalementFileProcessor->addFilesToSignalement( - fileList: $fileList, - signalement: $signalement, - user: $this->getUser(), - isWaitingSuivi: true - ); - } else { - $filesList = $signalementFileProcessor->addFilesToSignalement($fileList, $signalement, $this->getUser()); - $suivi = $suiviManager->createInstanceForFilesSignalement($this->getUser(), $signalement, $filesList); - $entityManager->persist($suivi); - } + $signalementFileProcessor->addFilesToSignalement( + fileList: $fileList, + signalement: $signalement, + user: $this->getUser(), + isWaitingSuivi: true + ); $entityManager->persist($signalement); $entityManager->flush(); if ($request->isXmlHttpRequest()) { diff --git a/src/Security/Voter/FileVoter.php b/src/Security/Voter/FileVoter.php index 7bc71a33d..daa96b5c7 100755 --- a/src/Security/Voter/FileVoter.php +++ b/src/Security/Voter/FileVoter.php @@ -64,7 +64,6 @@ private function canView(Signalement $subject, User $user = null): bool private function canEdit(File $file, User $user): bool { return $this->canCreate($file->getSignalement(), $user) - && $this->parameterBag->get('feature_documents_enable') && ( $this->isFileUploadedByUser($file, $user) || diff --git a/templates/back/signalement/view.html.twig b/templates/back/signalement/view.html.twig index d143e2b63..565203115 100755 --- a/templates/back/signalement/view.html.twig +++ b/templates/back/signalement/view.html.twig @@ -12,7 +12,7 @@ {% if canEditNDE %} {% include '_partials/_modal_edit_nde.html.twig' %} {% endif %} - {% if (is_granted('FILE_CREATE', signalement) and isDocumentsEnabled) %} + {% if is_granted('FILE_CREATE', signalement) %} {% include '_partials/_modal_upload_files.html.twig' %} {% endif %} {% if is_granted('ROLE_ADMIN') %} diff --git a/templates/back/signalement/view/photos-documents.html.twig b/templates/back/signalement/view/photos-documents.html.twig index dde77510e..1f6425fa6 100755 --- a/templates/back/signalement/view/photos-documents.html.twig +++ b/templates/back/signalement/view/photos-documents.html.twig @@ -6,53 +6,32 @@