✨ feat(TwigOrderExtensions): Ajoute filtre Twig pour compter les emails d'un client.
🐛 fix(CustomerController): Corrige la redirection après mise à jour de commande. ♻️ refactor(customer.twig): Utilise le nouveau filtre Twig pour afficher le nombre d'emails.
This commit is contained in:
@@ -449,7 +449,7 @@ class CustomerController extends AbstractController
|
||||
if ($formNdd->isSubmitted() && $formNdd->isValid()) {
|
||||
$entityManager->persist($customerNdd);
|
||||
$entityManager->flush();
|
||||
if ($request->query->has('idNdd')) {
|
||||
if ($request->query->has('idNdd') && $request->query->has('current') == "ndd") {
|
||||
$loggerService->log('UPDATE', "Mise à jour du nom de domaine " . $customerNdd->getNdd(), $this->getUser());
|
||||
$this->addFlash('success', 'Mise à jour effectuée');
|
||||
} else {
|
||||
@@ -621,8 +621,6 @@ class CustomerController extends AbstractController
|
||||
|
||||
$entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Mise à jour effectuée');
|
||||
|
||||
return $this->redirectToRoute('artemis_intranet_customer_orderEdit', [
|
||||
'id' => $customer?->getId(),
|
||||
'current' => 'order',
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
namespace App\Twig;
|
||||
|
||||
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\CustomerAdvertPayment;
|
||||
use App\Entity\CustomerDevis;
|
||||
use App\Entity\CustomerDns;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
|
||||
@@ -14,10 +16,21 @@ class TwigOrderExtensions extends AbstractExtension
|
||||
{
|
||||
return [
|
||||
new TwigFilter('totalOrder',[$this,'totalOrder']),
|
||||
new TwigFilter('countEmail',[$this,'countEmail']),
|
||||
new TwigFilter('skFormat',[$this,'skFormat']),
|
||||
];
|
||||
}
|
||||
|
||||
public function countEmail(Customer $customer): int
|
||||
{
|
||||
return array_sum(
|
||||
$customer->getCustomerDns()
|
||||
->map(fn($dns) => $dns->getCustomerDnsEmails()->count())
|
||||
->toArray()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function skFormat(string $bytes)
|
||||
{
|
||||
$units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
</td>
|
||||
<td class="px-6 py-4 text-center text-sm">0</td>
|
||||
<td class="px-6 py-4 text-center text-sm">{{ customer.customerDns.count }}</td>
|
||||
<td class="px-6 py-4 text-center text-sm">0</td>
|
||||
<td class="px-6 py-4 text-center text-sm">{{ customer|countEmail }}</td>
|
||||
<td class="px-6 py-4 text-center text-sm">0</td>
|
||||
<td class="px-6 py-4 text-center text-sm text-green-500 font-bold">Non</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-center">
|
||||
|
||||
Reference in New Issue
Block a user