-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1491 from MTES-MCT/fix/esabora-sish
[ESABORA] Ajustement arrêté préfectoral et visite de contrôle
- Loading branch information
Showing
14 changed files
with
348 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/Service/Intervention/InterventionDescriptionGenerator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace App\Service\Intervention; | ||
|
||
use App\Entity\Enum\InterventionType; | ||
use App\Entity\Intervention; | ||
use App\Event\InterventionCreatedEvent; | ||
use App\Service\Esabora\Response\Model\DossierArreteSISH; | ||
|
||
class InterventionDescriptionGenerator | ||
{ | ||
public static function generate(Intervention $intervention, string $eventName): ?string | ||
{ | ||
if (InterventionCreatedEvent::NAME === $eventName) { | ||
if (InterventionType::ARRETE_PREFECTORAL === $intervention->getType()) { | ||
return $intervention->getDetails(); | ||
} | ||
|
||
return self::buildDescriptionVisiteCreated($intervention); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public static function buildDescriptionVisiteCreated(Intervention $intervention): string | ||
{ | ||
$labelVisite = strtolower($intervention->getType()->label()); | ||
$partnerName = $intervention->getPartner() ? $intervention->getPartner()->getNom() : 'Non renseigné'; | ||
|
||
return sprintf( | ||
'%s programmée : une %s du logement situé %s est prévue le %s.<br>La %s sera effectuée par %s.', | ||
ucfirst($labelVisite), | ||
$labelVisite, | ||
$intervention->getSignalement()->getAdresseOccupant(), | ||
$intervention->getScheduledAt()->format('d/m/Y'), | ||
$labelVisite, | ||
$partnerName | ||
); | ||
} | ||
|
||
public static function buildDescriptionArreteCreated(DossierArreteSISH $dossierArreteSISH): string | ||
{ | ||
$description = sprintf( | ||
'Il existe 1 arrêté de type %s de n°%s daté du %s dans le dossier de n°%s.'.\PHP_EOL, | ||
$dossierArreteSISH->getArreteType(), | ||
$dossierArreteSISH->getArreteNumero(), | ||
$dossierArreteSISH->getArreteDate(), | ||
$dossierArreteSISH->getDossNum() | ||
); | ||
|
||
if ($dossierArreteSISH->getArreteMLNumero()) { | ||
$description .= sprintf( | ||
'Pour cet arrêté, il a également été pris un arrêté de mainlevée n°%s en date du %s.', | ||
$dossierArreteSISH->getArreteMLNumero(), | ||
$dossierArreteSISH->getArreteMLDate() | ||
); | ||
} | ||
|
||
return $description; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
templates/back/signalement/view/visites/visite-item.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.