Skip to content

Commit

Permalink
Correctifs et lien PJ dans le courriel de synthèse
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrelemee committed Jan 14, 2025
1 parent 8a3d966 commit 5e1f008
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Entity/Agent.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function setPassword(string $motDePasse): self
*/
public function eraseCredentials(): void
{
$this->password = null;
$this->motDePasse = null;
}

public function getUsername(): ?string
Expand Down
14 changes: 1 addition & 13 deletions src/Entity/BrisPorte.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -199,6 +198,7 @@ public function getDateCreation(): \DateTimeInterface
return $this->dateCreation;
}

#[Groups('dossier:lecture')]
public function getDateDeclaration(): ?\DateTimeInterface
{
return $this->historiqueEtats
Expand Down Expand Up @@ -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;
}
}
9 changes: 7 additions & 2 deletions src/Entity/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 7 additions & 4 deletions src/Event/PrejudiceListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,16 +19,19 @@ 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();

$req = $conn->executeQuery(<<<SQL
SELECT count(p.id) + 1 cpt
FROM bris_porte p
INNER JOIN public.dossier_etats ed ON ed.id = p.etat_actuel_id AND ed.etat <> '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;

Expand Down
4 changes: 1 addition & 3 deletions templates/email/agent_nouveau_dossier_constitue.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ déposé, avec les détails suivants :
<h4>Documents transmis (<i>bientôt</i> consultables depuis l'espace rédacteur)</h4>
<ul>
{% for document in dossier.liasseDocumentaire.documents %}


<li>
Nom: <b>{{ document.originalFilename }}</b>
{{ document.typeLibelle }}: <a href="{{ absolute_url(path('agent_document_download', {'hash': document.filename|md5, 'id': document.id})) }}" target="_blank">{{ document.originalFilename }}</a>
</li>
{% else %}
<li>
Expand Down

0 comments on commit 5e1f008

Please sign in to comment.