From 4569c4e8c5b1bd96ff9757c8ddbfb57fae3f392a Mon Sep 17 00:00:00 2001 From: narindraezway Date: Fri, 8 Aug 2025 10:49:49 +0300 Subject: [PATCH] DV : add footer email to Vannessa and rectifie invoice simple template --- gestion/lib/Controller/InvoiceController.php | 7 ++++++- gestion/lib/Controller/PageController.php | 2 +- gestion/lib/Service/InvoicePdfHandler.php | 21 +++++++++++--------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/gestion/lib/Controller/InvoiceController.php b/gestion/lib/Controller/InvoiceController.php index 806b612..c3322a5 100644 --- a/gestion/lib/Controller/InvoiceController.php +++ b/gestion/lib/Controller/InvoiceController.php @@ -109,7 +109,7 @@ class InvoiceController extends Controller $message->attach($content); $message->setSubject("Facture"); - $signature = $this->mailerService->getFooterContent(); + $signature = $this->mailerService->getFooterContent( $this->getUserNameForEmailSignature()); $message->setHtmlBody( "

Bonjour.

". @@ -128,4 +128,9 @@ class InvoiceController extends Controller } return new DataResponse("E-mail envoyé avec succès à ".$email.".", 200, ['Content-Type' => 'application/json']); } + public function getUserNameForEmailSignature (){ + $configs = json_decode($this->gestionRepository->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD)); + $currentConfig = $configs[0]; + return $currentConfig->nom . " " . $currentConfig->prenom; + } } \ No newline at end of file diff --git a/gestion/lib/Controller/PageController.php b/gestion/lib/Controller/PageController.php index caf1d6a..793bfab 100644 --- a/gestion/lib/Controller/PageController.php +++ b/gestion/lib/Controller/PageController.php @@ -1635,7 +1635,7 @@ class PageController extends Controller { } } public function getUserNameForEmailSignature (){ - $configs = json_decode($this->myDb->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN)); + $configs = json_decode($this->myDb->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD)); $currentConfig = $configs[0]; return $currentConfig->nom . " " . $currentConfig->prenom; } diff --git a/gestion/lib/Service/InvoicePdfHandler.php b/gestion/lib/Service/InvoicePdfHandler.php index 9834a72..40baf90 100644 --- a/gestion/lib/Service/InvoicePdfHandler.php +++ b/gestion/lib/Service/InvoicePdfHandler.php @@ -328,28 +328,31 @@ class InvoicePdfHandler extends FPDF $totalTtc += $valueTtc; $productDescription = $product["produit_description"]; $dateValue = ""; - if ($product === end($products)) { + if ($product === reset($products)) { $dateValue = $devisDate; - $productDescription .= " de " . FileExportHelpers::GetSexeLabel($this->factureData['defunt_sexe']) . ' ' . $this->factureData["defunt_nom"]; + // $productDescription .= " de " . FileExportHelpers::GetSexeLabel($this->factureData['defunt_sexe']) . ' ' . $this->factureData["defunt_nom"]; + $this->SetXY(70, $yValue); + $this->Cell(5, 6, $this->factureData["defunt_nom"], 0, 0); } + $yValue += 3; $tvaAmount = $valueTtc - $valueHt; - $this->SetXY(5, $yValue); + $this->SetXY(5, $yValue + 5); $this->Cell(5, 6, $dateValue, 0, 0); - - $this->SetXY(30, $yValue); + + $this->SetXY(30, $yValue +5); $this->MultiAlignCell($maxDescriptionWidth, 6, utf8_decode(html_entity_decode($productDescription)), 0, '0', ); - $this->SetXY(144, $yValue); + $this->SetXY(144, $yValue +5); $this->Cell(20, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 0, 'C'); - $this->SetXY(165, $yValue); + $this->SetXY(165, $yValue + 5); $this->Cell(20, 6, number_format($tvaAmount, 2, '.', '') . chr(128), 0, 0, 'C'); - $this->SetXY(182, $yValue); + $this->SetXY(182, $yValue + 5); $this->Cell(25, 6, number_format($valueTtc, 2, '.', '') . chr(128), 0, 1, 'C'); - $yValue += 12; + $yValue += 6; $totalTva += $tvaAmount; }