fix error send mail devis +add cancel auto contrat no payment + fix error payment
This commit is contained in:
@@ -49,8 +49,34 @@ class MailCommand extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!$contrat->isAccompte()) {
|
||||
if (!$contrat->isAccompte()) {
|
||||
$customer = $contrat->getCustomer();
|
||||
$diff = $contrat->getCreateAt() ? $contrat->getCreateAt()->diff($now)->days : 0;
|
||||
|
||||
// Annulation automatique après 3 jours sans acompte
|
||||
if ($diff >= 3) {
|
||||
if ($customer) {
|
||||
$this->mailer->send(
|
||||
$customer->getEmail(),
|
||||
$customer->getName() . " " . $customer->getSurname(),
|
||||
"[Ludikevent] Réservation N°" . $contrat->getNumReservation() . " annulée - Acompte non reçu",
|
||||
"mails/task/contrat-cancelled-noaccompte.twig",
|
||||
['contrat' => $contrat, 'customer' => $customer]
|
||||
);
|
||||
}
|
||||
foreach ($contrat->getContratsLines() as $line) {
|
||||
$this->entityManager->remove($line);
|
||||
}
|
||||
foreach ($contrat->getContratsOptions() as $option) {
|
||||
$this->entityManager->remove($option);
|
||||
}
|
||||
foreach ($contrat->getContratsPayments() as $payment) {
|
||||
$this->entityManager->remove($payment);
|
||||
}
|
||||
$io->warning("Annulation du contrat N°" . $contrat->getNumReservation() . " (Acompte non payé après 3 jours)");
|
||||
$this->entityManager->remove($contrat);
|
||||
} else {
|
||||
// Rappel simple
|
||||
if ($customer) {
|
||||
$this->mailer->send(
|
||||
$customer->getEmail(),
|
||||
@@ -63,6 +89,7 @@ class MailCommand extends Command
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- 5 & 6. RAPPELS LOGISTIQUES (J-3 et J-1) ---
|
||||
$this->sendEventReminders($io, 3, "Préparation de votre événement J-3");
|
||||
|
||||
@@ -236,9 +236,11 @@ class ContratsPayments
|
||||
/**
|
||||
* @param \DateTimeImmutable|null $updateAt
|
||||
*/
|
||||
public function setUpdateAt(?\DateTimeImmutable $updateAt): void
|
||||
public function setUpdateAt(?\DateTimeImmutable $updateAt): static
|
||||
{
|
||||
$this->updateAt = $updateAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
35
templates/mails/task/contrat-cancelled-noaccompte.twig
Normal file
35
templates/mails/task/contrat-cancelled-noaccompte.twig
Normal file
@@ -0,0 +1,35 @@
|
||||
{% extends 'mails/base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<mj-section background-color="#ffffff" padding="40px 20px" border-radius="20px">
|
||||
<mj-column>
|
||||
<mj-text font-size="20px" font-weight="bold" color="#e74c3c" align="center">
|
||||
Réservation annulée
|
||||
</mj-text>
|
||||
|
||||
<mj-divider border-width="2px" border-color="#e74c3c" width="50px" />
|
||||
|
||||
<mj-text font-size="14px" color="#555555" padding-top="20px">
|
||||
Bonjour {{ datas.customer.name }} {{ datas.customer.surname }},
|
||||
</mj-text>
|
||||
|
||||
<mj-text font-size="14px" color="#555555" line-height="22px">
|
||||
Nous sommes au regret de vous informer que votre réservation n°<strong>{{ datas.contrat.numReservation }}</strong> a été <strong>annulée automatiquement</strong> en raison du non-paiement de l'acompte dans le délai imparti de 3 jours.
|
||||
</mj-text>
|
||||
|
||||
<mj-text font-size="14px" color="#555555" line-height="22px" padding-top="10px">
|
||||
Les créneaux réservés ont été remis en disponibilité.
|
||||
</mj-text>
|
||||
|
||||
<mj-divider border-color="#f4f4f4" padding-top="20px" />
|
||||
|
||||
<mj-text font-size="14px" color="#555555" line-height="22px" padding-top="10px">
|
||||
Si vous souhaitez effectuer une nouvelle réservation ou si vous pensez qu'il s'agit d'une erreur, n'hésitez pas à nous contacter directement en répondant à cet email.
|
||||
</mj-text>
|
||||
|
||||
<mj-text font-size="12px" color="#999999" padding-top="30px" align="center">
|
||||
L'équipe Ludikevent
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
</mj-section>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user