From 5e1f0085d0f41cf50b738bc40807c21cfdbc9b3b Mon Sep 17 00:00:00 2001 From: Pierre LEMEE Date: Tue, 14 Jan 2025 10:19:55 +0100 Subject: [PATCH] =?UTF-8?q?Correctifs=20et=20lien=20PJ=20dans=20le=20courr?= =?UTF-8?q?iel=20de=20synth=C3=A8se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Entity/Agent.php | 2 +- src/Entity/BrisPorte.php | 14 +------------- src/Entity/Document.php | 9 +++++++-- src/Event/PrejudiceListener.php | 11 +++++++---- .../agent_nouveau_dossier_constitue.html.twig | 4 +--- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/Entity/Agent.php b/src/Entity/Agent.php index 1f37c5b..90e757a 100644 --- a/src/Entity/Agent.php +++ b/src/Entity/Agent.php @@ -190,7 +190,7 @@ public function setPassword(string $motDePasse): self */ public function eraseCredentials(): void { - $this->password = null; + $this->motDePasse = null; } public function getUsername(): ?string diff --git a/src/Entity/BrisPorte.php b/src/Entity/BrisPorte.php index 32a5251..dc0f175 100644 --- a/src/Entity/BrisPorte.php +++ b/src/Entity/BrisPorte.php @@ -168,7 +168,6 @@ public function changerStatut(EtatDossierType $type, bool $requerant = false, ?A return $this; } - #[Groups(['prejudice:read'])] public function getLastStatut(): EtatDossier { return $this->getEtatDossier(); @@ -199,6 +198,7 @@ public function getDateCreation(): \DateTimeInterface return $this->dateCreation; } + #[Groups('dossier:lecture')] public function getDateDeclaration(): ?\DateTimeInterface { return $this->historiqueEtats @@ -403,16 +403,4 @@ public function setQualiteRequerant(?QualiteRequerant $qualiteRequerant): BrisPo return $this; } - - public function getReceveurAttestation(): ?PersonnePhysique - { - return $this->receveurAttestation; - } - - public function setReceveurAttestation(?PersonnePhysique $receveurAttestation): self - { - $this->receveurAttestation = $receveurAttestation; - - return $this; - } } diff --git a/src/Entity/Document.php b/src/Entity/Document.php index fce9674..96f5b74 100644 --- a/src/Entity/Document.php +++ b/src/Entity/Document.php @@ -21,8 +21,8 @@ class Document const TYPE_SIGNATURE_DECISION="signature_decision"; public static $types = [ - self::TYPE_ATTESTATION_INFORMATION => "Attestation informatique", // Dossier - self::TYPE_PHOTO_PREJUDICE => "Photos de la porte endommagée", // Dossier + self::TYPE_ATTESTATION_INFORMATION => "Attestation à remettre en cas d'erreur de porte", // Dossier + self::TYPE_PHOTO_PREJUDICE => "Photo de la porte endommagée", // Dossier self::TYPE_CARTE_IDENTITE => "Pièce d'identité", // Personne morale OU physique self::TYPE_FACTURE => "Facture", // Dossier self::TYPE_RIB => "RIB", // Personne morale OU physique @@ -83,6 +83,11 @@ public function getType(): ?string return $this->type; } + public function getTypeLibelle(): ?string + { + return self::$types[$this->type] ?? null; + } + public function setType(string $type): static { $this->type = $type; diff --git a/src/Event/PrejudiceListener.php b/src/Event/PrejudiceListener.php index 3082a3c..df0e23a 100644 --- a/src/Event/PrejudiceListener.php +++ b/src/Event/PrejudiceListener.php @@ -2,10 +2,10 @@ namespace MonIndemnisationJustice\Event; -use MonIndemnisationJustice\Entity\BrisPorte; use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener; use Doctrine\ORM\Event\PreUpdateEventArgs; use Doctrine\ORM\Events; +use MonIndemnisationJustice\Entity\BrisPorte; #[AsDoctrineListener(event: Events::preUpdate, priority: 500, connection: 'default')] class PrejudiceListener @@ -19,7 +19,6 @@ public function preUpdate(PreUpdateEventArgs $args): void { $entity = $args->getObject(); if ($entity instanceof BrisPorte) { - if (null !== $entity->getDateDeclaration() && null === $entity->getReference()) { $entityManager = $args->getObjectManager(); $conn = $entityManager->getConnection(); @@ -27,8 +26,12 @@ public function preUpdate(PreUpdateEventArgs $args): void $req = $conn->executeQuery(<< 'DOSSIER_INITIE' -SQL); + INNER JOIN public.dossier_etats ed ON ed.id = p.etat_actuel_id AND ed.etat <> 'DOSSIER_INITIE' AND to_char(ed.date, 'yyyymmdd') = :date +SQL, + [ + 'date' => (new \DateTime())->format('Ymd'), + ] + ); $cpt = $req->fetchOne() ?? 1; diff --git a/templates/email/agent_nouveau_dossier_constitue.html.twig b/templates/email/agent_nouveau_dossier_constitue.html.twig index c027d4b..ca692e1 100644 --- a/templates/email/agent_nouveau_dossier_constitue.html.twig +++ b/templates/email/agent_nouveau_dossier_constitue.html.twig @@ -98,10 +98,8 @@ déposé, avec les détails suivants :

Documents transmis (bientôt consultables depuis l'espace rédacteur)