diff --git a/assets/app.js b/assets/app.js
index c02c0b20..4f4646b9 100644
--- a/assets/app.js
+++ b/assets/app.js
@@ -24,5 +24,6 @@ import './controllers/component_file_auto_submit';
import './controllers/list_signalement';
import './controllers/list_entreprises';
import './controllers/list_employes';
+import './controllers/list_entreprises_publiques';
import './controllers/weekly_slider';
\ No newline at end of file
diff --git a/assets/controllers/form_signalement_front.js b/assets/controllers/form_signalement_front.js
index a96aafbc..97d1fa7f 100644
--- a/assets/controllers/form_signalement_front.js
+++ b/assets/controllers/form_signalement_front.js
@@ -34,8 +34,6 @@ class PunaisesFrontSignalementController {
CLOSED_STEP_LIST = [
'home',
'info_usager',
- 'autotraitement_info',
- 'autotraitement_sent',
];
SOCIAL_STEP_LIST = [
'home',
@@ -59,6 +57,11 @@ class PunaisesFrontSignalementController {
init() {
self = this;
$('.btn-next').on('click', function(){
+ if (!self.isTerritoryOpen && self.stepStr === 'info_usager') {
+ self.submitAdd();
+ return;
+ }
+
self.refreshStep(1);
});
$('.btn-next-next').on('click', function(){
@@ -588,6 +591,7 @@ class PunaisesFrontSignalementController {
}
submitAdd() {
+ $('.front-signalement #step-info_usager .btn-next').attr('disabled', 'disabled');
$('.front-signalement #step-professionnel_info .btn-next-next').attr('disabled', 'disabled');
$('.front-signalement #step-autotraitement_info .btn-next-next').attr('disabled', 'disabled');
if (self.isLogementSocial) {
@@ -603,8 +607,14 @@ class PunaisesFrontSignalementController {
processData:false,
success: function() {
+ if (!self.isTerritoryOpen) {
+ let codePostal = $('input#code-postal').val();
+ window.location.href = $('input#url-entreprises-publiques').val() + codePostal;
+ return;
+ }
+
let nbStep = 2;
- if (!self.isTerritoryOpen || self.isLogementSocial) {
+ if (self.isLogementSocial) {
nbStep = 1;
}
self.refreshStep(nbStep);
diff --git a/assets/controllers/list_entreprises_publiques.js b/assets/controllers/list_entreprises_publiques.js
new file mode 100644
index 00000000..37987102
--- /dev/null
+++ b/assets/controllers/list_entreprises_publiques.js
@@ -0,0 +1,13 @@
+import $ from 'jquery';
+
+$(function() {
+ if ($('select#select-entreprises-order').length > 0) {
+ startListeEntreprisesPubliquesApp();
+ }
+});
+
+function startListeEntreprisesPubliquesApp() {
+ $('select#select-entreprises-order').on('change', function() {
+ window.location.href = $('select#select-entreprises-order').data('redirect') + '&order=' + $('select#select-entreprises-order').val()
+ });
+}
\ No newline at end of file
diff --git a/assets/styles/app.scss b/assets/styles/app.scss
index 286119bb..ed28d308 100644
--- a/assets/styles/app.scss
+++ b/assets/styles/app.scss
@@ -929,4 +929,8 @@ span.image-caption {
.leaflet-control-zoom a {
background-image: none !important;
+}
+
+.fr-links-group.display-list-block > li {
+ display: block;
}
\ No newline at end of file
diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml
index e38f6f0a..1cc174fa 100644
--- a/config/packages/doctrine.yaml
+++ b/config/packages/doctrine.yaml
@@ -19,6 +19,8 @@ doctrine:
string_functions:
YEAR: DoctrineExtensions\Query\Mysql\Year
DATEDIFF: DoctrineExtensions\Query\Mysql\DateDiff
+ numeric_functions:
+ rand: DoctrineExtensions\Query\Mysql\Rand
when@test:
doctrine:
diff --git a/migrations/Version20231002145606.php b/migrations/Version20231002145606.php
new file mode 100644
index 00000000..7b9a8dae
--- /dev/null
+++ b/migrations/Version20231002145606.php
@@ -0,0 +1,26 @@
+addSql('CREATE TABLE entreprise_publique (id INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, adresse VARCHAR(255) NOT NULL, url VARCHAR(255) DEFAULT NULL, telephone VARCHAR(255) DEFAULT NULL, zip VARCHAR(3) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
+ }
+
+ public function down(Schema $schema): void
+ {
+ $this->addSql('DROP TABLE entreprise_publique');
+ }
+}
diff --git a/scripts/upload-s3.sh b/scripts/upload-s3.sh
index f8a824ad..91cb0e26 100755
--- a/scripts/upload-s3.sh
+++ b/scripts/upload-s3.sh
@@ -39,6 +39,11 @@ else
aws s3 cp data/signalement/signalements_${uuid}.csv s3://${BUCKET_URL}/csv/ ${debug}
aws s3 ls s3://${BUCKET_URL}/csv/signalements_${uuid}.csv
;;
+ "entreprisespubliques")
+ echo "Upload entreprises.csv to cloud..."
+ aws s3 cp data/entreprises.csv s3://${BUCKET_URL}/csv/ ${debug}
+ aws s3 ls s3://${BUCKET_URL}/csv/entreprises.csv
+ ;;
*)
echo "Invalid argument. Please use 'grid' or 'signalement' or 'image' or 'mapping-doc' or 'process-all'"
;;
diff --git a/src/Command/GetEntreprisePubliqueCommand.php b/src/Command/GetEntreprisePubliqueCommand.php
new file mode 100644
index 00000000..56820523
--- /dev/null
+++ b/src/Command/GetEntreprisePubliqueCommand.php
@@ -0,0 +1,217 @@
+ '01-ain',
+ '02' => '02-aisne',
+ '03' => '03-allier',
+ '04' => '04-alpes-de-haute-provence',
+ '05' => '05-hautes-alpes',
+ '06' => '06-alpes-maritimes',
+ '07' => '07-ardeche',
+ '08' => '08-ardennes',
+ '09' => '09-ariege',
+ '10' => '10-aube',
+ '11' => '11-aude',
+ '12' => '12-aveyron',
+ '13' => '13-bouches-du-rhone',
+ '14' => '14-calvados',
+ '15' => '15-cantal',
+ '16' => '16-charente',
+ '17' => '17-charente-maritime',
+ '18' => '18-cher',
+ '19' => '19-correze',
+ '21' => '21-cote-dor',
+ '22' => '22-cotes-darmor',
+ '23' => '23-creuse',
+ '24' => '24-dordogne',
+ '25' => '25-doubs',
+ '26' => '26-drome',
+ '27' => '27-eure',
+ '28' => '28-eure-et-loir',
+ '29' => '29-finistere',
+ '2A' => '2a-corse-du-sud',
+ '2B' => '2b-haute-corse',
+ '30' => '30-gard',
+ '31' => '31-haute-garonne',
+ '32' => '32-gers',
+ '33' => '33-gironde',
+ '34' => '34-herault',
+ '35' => '35-ille-et-vilaine',
+ '36' => '36-indre',
+ '37' => '37-indre-et-loire',
+ '38' => '38-isere',
+ '39' => '39-jura',
+ '40' => '40-landes',
+ '41' => '41-loir-et-cher',
+ '42' => '42-loire',
+ '43' => '43-haute-loire',
+ '44' => '44-loire-atlantique',
+ '45' => '45-loiret',
+ '46' => '46-lot',
+ '47' => '47-lot-et-garonne',
+ '48' => '48-lozere',
+ '49' => '49-maine-et-loire',
+ '50' => '50-manche',
+ '51' => '51-marne',
+ '52' => '52-haute-marne',
+ '53' => '53-mayenne',
+ '54' => '54-meurthe-et-moselle',
+ '55' => '55-meuse',
+ '56' => '56-morbihan',
+ '57' => '57-moselle',
+ '58' => '58-nievre',
+ '59' => '59-nord',
+ '60' => '60-oise',
+ '61' => '61-orne',
+ '62' => '62-pas-de-calais',
+ '63' => '63-puy-de-dome',
+ '64' => '64-pyrenees-atlantiques',
+ '65' => '65-hautes-pyrenees',
+ '66' => '66-pyrenees-orientales',
+ '67' => '67-bas-rhin',
+ '68' => '68-haut-rhin',
+ '69' => '69-rhone',
+ '70' => '70-haute-saone',
+ '71' => '71-saone-et-loire',
+ '72' => '72-sarthe',
+ '73' => '73-savoie',
+ '74' => '74-haute-savoie',
+ '75' => '75-paris',
+ '76' => '76-seine-maritime',
+ '77' => '77-seine-et-marne',
+ '78' => '78-yvelines',
+ '79' => '79-deux-sevres',
+ '80' => '80-somme',
+ '81' => '81-tarn',
+ '82' => '82-tarn-et-garonne',
+ '83' => '83-var',
+ '84' => '84-vaucluse',
+ '85' => '85-vendee',
+ '86' => '86-vienne',
+ '87' => '87-haute-vienne',
+ '88' => '88-vosges',
+ '89' => '89-yonne',
+ '90' => '90-territoire-de-belfort',
+ '91' => '91-essonne',
+ '92' => '92-hauts-de-seine',
+ '93' => '93-seine-st-denis',
+ '94' => '94-val-de-marne',
+ '95' => '95-val-doise',
+ '971' => '971-guadeloupe',
+ '972' => '972-martinique',
+ '973' => '973-guyane',
+ '974' => '974-la-reunion',
+ '976' => '976-mayotte',
+ ];
+
+ public function __construct(
+ private CsvParser $csvParser,
+ private ParameterBagInterface $parameterBag,
+ private EntityManagerInterface $entityManager,
+ private FilesystemOperator $fileStorage,
+ private UploadHandlerService $uploadHandlerService,
+ private EntreprisePubliqueImportLoader $entreprisePubliqueImportLoader,
+ ) {
+ parent::__construct();
+ }
+
+ /**
+ * @throws FilesystemException
+ * @throws NonUniqueResultException
+ */
+ protected function execute(InputInterface $input, OutputInterface $output): int
+ {
+ $io = new SymfonyStyle($input, $output);
+
+ $dataToSave = [];
+ foreach (self::SLUGS as $zip => $slug) {
+ $this->parseUrl($dataToSave, $zip, $slug);
+ }
+
+ $csvFileName = $this->parameterBag->get('uploads_tmp_dir').'entreprises.csv';
+ $file = fopen($csvFileName, 'w');
+ $entete = ['zip', 'nom', 'adresse', 'url', 'telephone'];
+ fputcsv($file, $entete);
+ foreach ($dataToSave as $row) {
+ fputcsv($file, $row);
+ }
+ fclose($file);
+
+ return Command::SUCCESS;
+ }
+
+ private function parseUrl(array &$dataToSave, $zip, $slug)
+ {
+ $htmlContent = file_get_contents(self::DISTANT_URL.$slug.'/');
+
+ libxml_use_internal_errors(true);
+ $dom = new DOMDocument();
+ $dom->loadHTML($htmlContent);
+ $xpath = new DOMXPath($dom);
+ $postsDiv = $xpath->query('//div[@id="posts"]')->item(0);
+ if ($postsDiv) {
+ $childDivs = $xpath->query('./div', $postsDiv);
+
+ foreach ($childDivs as $childDiv) {
+ $h1Query = $xpath->query('.//h1', $childDiv);
+ if ($h1Query->item(0)) {
+ $entrepriseItem = [
+ 'zip' => $zip,
+ 'nom' => '',
+ 'adresse' => '',
+ 'url' => '',
+ 'telephone' => '',
+ ];
+
+ $name = $h1Query->item(0)->textContent;
+ $entrepriseItem['nom'] = $name;
+
+ $locationQuery = $xpath->query('.//li[@class="location"]//a', $childDiv);
+ if ($locationQuery->item(0)) {
+ $location = $locationQuery->item(0)->textContent;
+ $entrepriseItem['adresse'] = $location;
+ }
+
+ $websiteQuery = $xpath->query('.//li[@class="website"]/a', $childDiv);
+ if ($websiteQuery->item(0)) {
+ $websiteLink = $websiteQuery->item(0)->getAttribute('href');
+ $entrepriseItem['url'] = $websiteLink;
+ }
+
+ $telephoneQuery = $xpath->query('.//li[@class="telephone"]', $childDiv);
+ if ($telephoneQuery->item(0)) {
+ $telephone = $telephoneQuery->item(0)->getAttribute('data-tel');
+ $entrepriseItem['telephone'] = $telephone;
+ }
+
+ $dataToSave[] = $entrepriseItem;
+ }
+ }
+ }
+ }
+}
diff --git a/src/Command/ImportEntreprisePubliqueCommand.php b/src/Command/ImportEntreprisePubliqueCommand.php
new file mode 100644
index 00000000..bb01041c
--- /dev/null
+++ b/src/Command/ImportEntreprisePubliqueCommand.php
@@ -0,0 +1,66 @@
+parameterBag->get('uploads_tmp_dir').'entreprises.csv';
+ if (!$this->fileStorage->fileExists($fromFile)) {
+ $io->error('CSV File does not exist');
+
+ return Command::FAILURE;
+ }
+
+ $this->uploadHandlerService->createTmpFileFromBucket($fromFile, $toFile);
+
+ $this->entreprisePubliqueImportLoader->load(
+ $this->csvParser->parseAsDict($toFile),
+ $this->csvParser->getHeaders($toFile),
+ $output
+ );
+
+ $countEntreprises = $this->entreprisePubliqueImportLoader->countEntreprises();
+
+ $io->success(sprintf('%s entreprises publiques importées', $countEntreprises));
+
+ return Command::SUCCESS;
+ }
+}
diff --git a/src/Controller/Front/EntreprisesPubliquesController.php b/src/Controller/Front/EntreprisesPubliquesController.php
new file mode 100644
index 00000000..0ad2ae39
--- /dev/null
+++ b/src/Controller/Front/EntreprisesPubliquesController.php
@@ -0,0 +1,40 @@
+get('code-postal');
+ if (empty($codePostal)) {
+ return $this->redirectToRoute('home');
+ }
+
+ $order = $request->get('order');
+ if (empty($order)) {
+ $order = 'random';
+ }
+
+ $codePostal = str_pad($codePostal, 5, '0', \STR_PAD_LEFT);
+ $zipCode = substr($codePostal, 0, 2);
+
+ $listEntreprisesPubliquesByZipCode = $entreprisePubliqueRepository->findByZipCode($zipCode, $order);
+
+ return $this->render('front/entreprises-labelisees.html.twig', [
+ 'code_postal' => $request->get('code-postal'),
+ 'order' => $request->get('order'),
+ 'code_departement' => $zipCode,
+ 'entreprises_publiques' => $listEntreprisesPubliquesByZipCode,
+ ]);
+ }
+}
diff --git a/src/Controller/Front/SignalementController.php b/src/Controller/Front/SignalementController.php
index b0c05d34..17e7362e 100644
--- a/src/Controller/Front/SignalementController.php
+++ b/src/Controller/Front/SignalementController.php
@@ -67,8 +67,11 @@ public function save(
$signalementManager->save($signalement);
if ($signalement->isAutotraitement()) {
- $linkToPdf = $this->getParameter('base_url').'/build/'.$this->getParameter('doc_autotraitement');
- $mailerProvider->sendSignalementValidationWithAutotraitement($signalement, $linkToPdf);
+ if ($signalement->getTerritoire()->isActive()) {
+ $mailerProvider->sendSignalementValidationWithAutotraitement($signalement);
+ } else {
+ $mailerProvider->sendSignalementValidationWithEntreprisesPubliques($signalement);
+ }
} else {
$mailerProvider->sendSignalementValidationWithPro($signalement);
diff --git a/src/Controller/Front/SuiviUsagerViewController.php b/src/Controller/Front/SuiviUsagerViewController.php
index a90dc428..87490373 100644
--- a/src/Controller/Front/SuiviUsagerViewController.php
+++ b/src/Controller/Front/SuiviUsagerViewController.php
@@ -111,8 +111,7 @@ public function signalement_bascule_autotraitement(
$signalement->setSwitchedTraitementAt(new \DateTimeImmutable());
$signalementManager->save($signalement);
- $linkToPdf = $this->getParameter('base_url').'/build/'.$this->getParameter('doc_autotraitement');
- $mailerProvider->sendSignalementValidationWithAutotraitement($signalement, $linkToPdf);
+ $mailerProvider->sendSignalementValidationWithAutotraitement($signalement);
$eventDispatcher->dispatch(
new SignalementSwitchedEvent(
diff --git a/src/Entity/EntreprisePublique.php b/src/Entity/EntreprisePublique.php
new file mode 100644
index 00000000..effe5d8c
--- /dev/null
+++ b/src/Entity/EntreprisePublique.php
@@ -0,0 +1,95 @@
+id;
+ }
+
+ public function getNom(): ?string
+ {
+ return $this->nom;
+ }
+
+ public function setNom(string $nom): self
+ {
+ $this->nom = $nom;
+
+ return $this;
+ }
+
+ public function getAdresse(): ?string
+ {
+ return $this->adresse;
+ }
+
+ public function setAdresse(string $adresse): self
+ {
+ $this->adresse = $adresse;
+
+ return $this;
+ }
+
+ public function getUrl(): ?string
+ {
+ return $this->url;
+ }
+
+ public function setUrl(?string $url): self
+ {
+ $this->url = $url;
+
+ return $this;
+ }
+
+ public function getTelephone(): ?string
+ {
+ return $this->telephone;
+ }
+
+ public function setTelephone(?string $telephone): self
+ {
+ $this->telephone = $telephone;
+
+ return $this;
+ }
+
+ public function getZip(): ?string
+ {
+ return $this->zip;
+ }
+
+ public function setZip(string $zip): self
+ {
+ $this->zip = $zip;
+
+ return $this;
+ }
+}
diff --git a/src/Factory/EntreprisePubliqueFactory.php b/src/Factory/EntreprisePubliqueFactory.php
new file mode 100644
index 00000000..efc44b85
--- /dev/null
+++ b/src/Factory/EntreprisePubliqueFactory.php
@@ -0,0 +1,18 @@
+setNom($data['nom'])
+ ->setAdresse($data['adresse'])
+ ->setUrl($data['url'])
+ ->setTelephone($data['telephone'])
+ ->setZip($data['zip']);
+ }
+}
diff --git a/src/Manager/EntreprisePubliqueManager.php b/src/Manager/EntreprisePubliqueManager.php
new file mode 100644
index 00000000..49c4b45e
--- /dev/null
+++ b/src/Manager/EntreprisePubliqueManager.php
@@ -0,0 +1,45 @@
+getRepository()->findOneBy([
+ 'nom' => $data['nom'],
+ 'zip' => $data['zip'],
+ ]);
+
+ if ($entreprisePublique instanceof EntreprisePublique) {
+ return $this->update($entreprisePublique, $data);
+ }
+
+ return $this->entreprisePubliqueFactory->createInstanceFrom($data);
+ }
+
+ public function update(EntreprisePublique $entreprisePublique, array $data): EntreprisePublique
+ {
+ return $entreprisePublique
+ ->setNom($data['nom'])
+ ->setAdresse($data['adresse'])
+ ->setUrl($data['url'])
+ ->setTelephone($data['telephone'])
+ ->setZip($data['zip']);
+ }
+}
diff --git a/src/Repository/EntreprisePubliqueRepository.php b/src/Repository/EntreprisePubliqueRepository.php
new file mode 100644
index 00000000..32262f4f
--- /dev/null
+++ b/src/Repository/EntreprisePubliqueRepository.php
@@ -0,0 +1,56 @@
+
+ *
+ * @method EntreprisePublique|null find($id, $lockMode = null, $lockVersion = null)
+ * @method EntreprisePublique|null findOneBy(array $criteria, array $orderBy = null)
+ * @method EntreprisePublique[] findAll()
+ * @method EntreprisePublique[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
+ */
+class EntreprisePubliqueRepository extends ServiceEntityRepository
+{
+ public function __construct(ManagerRegistry $registry)
+ {
+ parent::__construct($registry, EntreprisePublique::class);
+ }
+
+ public function save(EntreprisePublique $entity, bool $flush = false): void
+ {
+ $this->getEntityManager()->persist($entity);
+
+ if ($flush) {
+ $this->getEntityManager()->flush();
+ }
+ }
+
+ public function remove(EntreprisePublique $entity, bool $flush = false): void
+ {
+ $this->getEntityManager()->remove($entity);
+
+ if ($flush) {
+ $this->getEntityManager()->flush();
+ }
+ }
+
+ public function findByZipCode(string $zipCode, string $order): array
+ {
+ $qb = $this->createQueryBuilder('ep');
+ $qb->where('ep.zip LIKE :zipCode')
+ ->setParameter('zipCode', $zipCode);
+
+ if ('ASC' === $order || 'DESC' === $order) {
+ $qb->orderBy('ep.nom', $order);
+ } else {
+ $qb->orderBy('RAND()');
+ }
+
+ return $qb->getQuery()->getResult();
+ }
+}
diff --git a/src/Service/Import/EntreprisePublique/EntreprisePubliqueImportLoader.php b/src/Service/Import/EntreprisePublique/EntreprisePubliqueImportLoader.php
new file mode 100644
index 00000000..33a982e6
--- /dev/null
+++ b/src/Service/Import/EntreprisePublique/EntreprisePubliqueImportLoader.php
@@ -0,0 +1,63 @@
+count = 0;
+ if ($output) {
+ $progressBar = new ProgressBar($output);
+ $progressBar->start(\count($data));
+ }
+
+ foreach ($data as $item) {
+ $dataMapped = $this->entreprisePubliqueImportMapper->map($headers, $item);
+ if (!empty($dataMapped)) {
+ ++$this->count;
+ if ($output) {
+ $progressBar->advance();
+ }
+
+ $entreprisePublique = $this->entreprisePubliqueManager->createOrUpdate($dataMapped, true);
+ $this->entreprisePubliqueManager->save($entreprisePublique);
+ }
+ }
+
+ $this->entreprisePubliqueManager->flush();
+ if ($output) {
+ $progressBar->finish();
+ }
+ }
+
+ public function countEntreprises(): int
+ {
+ return $this->count;
+ }
+}
diff --git a/src/Service/Import/EntreprisePublique/EntreprisePubliqueImportMapper.php b/src/Service/Import/EntreprisePublique/EntreprisePubliqueImportMapper.php
new file mode 100644
index 00000000..c47a394e
--- /dev/null
+++ b/src/Service/Import/EntreprisePublique/EntreprisePubliqueImportMapper.php
@@ -0,0 +1,39 @@
+ 'zip',
+ 'nom' => 'nom',
+ 'adresse' => 'adresse',
+ 'url' => 'url',
+ 'telephone' => 'telephone',
+ ];
+ }
+
+ public function map(array $columns, array $data): array
+ {
+ $dataMapped = [];
+ if (1 === \count($data)) {
+ return $dataMapped;
+ }
+ foreach ($this->getMapping() as $fileColumn => $fieldColumn) {
+ if (\in_array($fileColumn, $columns)) {
+ $fieldValue = 'NSP' !== $data[$fileColumn] ? $data[$fileColumn] : '';
+ $fieldValue = trim($fieldValue, '"');
+ if ('zip' === $fieldColumn) {
+ $fieldValue = str_pad($fieldValue, 2, '0', \STR_PAD_LEFT);
+ }
+ $dataMapped[$fieldColumn] = $fieldValue;
+ } else {
+ $dataMapped[$fieldColumn] = null;
+ }
+ }
+
+ return $dataMapped;
+ }
+}
diff --git a/src/Service/Mailer/MailerProvider.php b/src/Service/Mailer/MailerProvider.php
index 0c0cb88a..a7bdbaf4 100644
--- a/src/Service/Mailer/MailerProvider.php
+++ b/src/Service/Mailer/MailerProvider.php
@@ -111,6 +111,24 @@ public function sendSignalementValidationWithAutotraitement(Signalement $signale
$this->send($message);
}
+ public function sendSignalementValidationWithEntreprisesPubliques(Signalement $signalement): void
+ {
+ $emailOccupant = $signalement->getEmailOccupant();
+ $link = $this->urlGenerator->generate('app_suivi_usager_view', ['uuidPublic' => $signalement->getUuidPublic()]);
+ $linkEntreprisesPubliques = $this->urlGenerator->generate('app_front_entreprises_labellisees');
+ $linkEntreprisesPubliques .= '?code-postal='.$signalement->getCodePostal();
+ $message = $this
+ ->messageFactory
+ ->createInstanceFrom(Template::SIGNALEMENT_ENTREPRISES_LABELLISEES, [
+ 'nom_usager' => $signalement->getNomCompletOccupant(),
+ 'link' => $link,
+ 'link_2' => $linkEntreprisesPubliques,
+ ])
+ ->setTo([$emailOccupant]);
+
+ $this->send($message);
+ }
+
public function sendSignalementNewForPro(string $emailEntreprise, Signalement $signalement): void
{
$link = $this->urlGenerator->generate('app_signalement_view', ['uuid' => $signalement->getUuid()]);
diff --git a/src/Service/Mailer/MessageFactory.php b/src/Service/Mailer/MessageFactory.php
index 847941ca..ec8c71d4 100644
--- a/src/Service/Mailer/MessageFactory.php
+++ b/src/Service/Mailer/MessageFactory.php
@@ -13,6 +13,9 @@ public function createInstanceFrom(Template $template, array $parameters = [])
if (isset($parameters['link'])) {
$parameters['link'] = $this->baseUrl.$parameters['link'];
}
+ if (isset($parameters['link_2'])) {
+ $parameters['link_2'] = $this->baseUrl.$parameters['link_2'];
+ }
return (new Message())
->setFrom($this->from)
diff --git a/src/Service/Mailer/Template.php b/src/Service/Mailer/Template.php
index 734a600c..1c6f2ccf 100644
--- a/src/Service/Mailer/Template.php
+++ b/src/Service/Mailer/Template.php
@@ -12,6 +12,7 @@ enum Template: int
case RESET_PASSWORD = 2;
case SIGNALEMENT_PROFESSIONAL = 17;
case SIGNALEMENT_AUTO = 16;
+ case SIGNALEMENT_ENTREPRISES_LABELLISEES = 23;
case SIGNALEMENT_NEW_FOR_PRO = 7;
case SIGNALEMENT_NEW_ESTIMATION = 12;
case SIGNALEMENT_NEW_MESSAGE = 6;
diff --git a/templates/front/entreprises-labelisees.html.twig b/templates/front/entreprises-labelisees.html.twig
new file mode 100644
index 00000000..6e193626
--- /dev/null
+++ b/templates/front/entreprises-labelisees.html.twig
@@ -0,0 +1,70 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}Stop punaises - Les entreprises labellisées{% endblock %}
+
+{% block body %}
+
+ {{ entreprise_publique.adresse }}Entreprises labellisées - Département {{ code_departement }}
+
+ {{ entreprise_publique.nom }}
+
+
- Le service Stop Punaises n'est pas encore ouvert dans votre département. - Nous ne pouvons pas vous mettre en relation avec des entreprises locales. + Renseignez vos coordonnées pour accéder à la liste des entreprises labellisées de votre département + et recevoir le protocole de préparation et d'auto-traitement par e-mail. +
- Vous pouvez cependant contacter le service "Info logement indigne" au + Vous pouvez également contacter le service "Info logement indigne" au 0806 706 806 (prix d'un appel local).
- -- Vous pouvez également renseigner vos coordonnées pour - recevoir le protocole d'auto-traitement par mail. -