Merge branch 'hotfixes/hotfix-update-client-on-agenda-and-group-adress' into staging

This commit is contained in:
Tiavina 2025-02-05 21:27:34 +03:00
commit 30318958e1
2 changed files with 76 additions and 27 deletions

View File

@ -105,7 +105,6 @@ class InvoicePdfHandler extends FPDF {
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->factureData['configuration']->telephone),0,1);
$this->Cell(0, 5, 'Mail : ' . $this->factureData['configuration']->mail, 0, 1);
}
private function DrawInvoiceClientInfo(){
$this->SetFont('ComicSans', '', 10);
$clientName = $this->factureData['client_nom'];
@ -113,12 +112,22 @@ class InvoicePdfHandler extends FPDF {
$clientName = $this->factureData['group_name'];
}
$clientInfoXAxis = 125;
$clientInfoYAxis = 40;
$clientAddress = FileExportHelpers::FormatTextForExport($this->factureData['client_real_adress']);
$clientAdressWidth = $this->GetStringWidth($clientAddress);
$maxWidth = $this->GetPageWidth();
$availableWidhtForClientInfo = $maxWidth - 10 - $clientInfoXAxis;
$clientAdressIsMultiline = $clientAdressWidth > $availableWidhtForClientInfo;
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 40;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 5;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_real_adress'])));
$this->MultiCell( 0, 5, trim($clientAddress));
if($clientAdressIsMultiline){
$clientInfoYAxis += 5;
}
$clientInfoYAxis += 5;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));

View File

@ -202,7 +202,17 @@ class InvoiceRecapService {
$pdf->Cell( 0, 7, utf8_decode($clientGroupFacturation["group_facturation_name"]));
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientGroupFacturation["address"]))));
$clientAdress = FileExportHelpers::FormatTextForExport($clientGroupFacturation["address"]);
$clientAdressWidth = $pdf->GetStringWidth($clientAdress);
$maxWidth = $pdf->GetPageWidth();
$availableWidhtForClientInfo = $maxWidth - 10 - $clientInfoXAxis;
$clientAdressIsMultiline = $clientAdressWidth > $availableWidhtForClientInfo;
$pdf->SetMargins(0,0,10);
$pdf->MultiCell( 0, 7, trim($clientAdress));
$pdf->SetMargins(0,0,0);
if($clientAdressIsMultiline){
$clientInfoYAxis += 7;
}
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientGroupFacturation["postal_code"]. ' ' .$clientGroupFacturation["city"]))));
@ -212,25 +222,30 @@ class InvoiceRecapService {
$pdf->Cell( 0, 7, "Saint Senoux, le ".utf8_decode($date_formated));
// observations
$pdf->SetFont( "ComicSans", "BU", 10 ); $pdf->SetXY( 10, 95 ) ; $pdf->Cell($pdf->GetStringWidth("Objet:"), 0, "Objet:", 0, "L");
$objetYAxis = 110;
$pdf->SetFont( "ComicSans", "BU", 10 ); $pdf->SetXY( 10, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth("Objet:"), 0, "Objet:", 0, "L");
$objet = utf8_decode("Récapitulatif Facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1]));
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 95 ) ; $pdf->Cell($pdf->GetStringWidth($objet), 0, $objet, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth($objet), 0, $objet, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 105 ); $pdf->Cell($pdf->GetStringWidth("Madame, Monsieur"), 0, "Madame, Monsieur", 0, "L");
$objetYAxis += 10;
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ); $pdf->Cell($pdf->GetStringWidth("Madame, Monsieur"), 0, "Madame, Monsieur", 0, "L");
$text1 = utf8_decode("Veuillez trouver ci-dessous le récapitulatif de la facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])).".";
$text2 = utf8_decode("Vous en souhaitant bonne réception.");
$text3 = utf8_decode("Veuillez agréer, Madame, Monsieur, mes salutations les meilleures.");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 115 ) ; $pdf->Cell($pdf->GetStringWidth($text1), 0, $text1, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 120 ) ; $pdf->Cell($pdf->GetStringWidth($text2), 0, $text2, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 125 ) ; $pdf->Cell($pdf->GetStringWidth($text3), 0, $text3, 0, "L");
$objetYAxis += 10;
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth($text1), 0, $text1, 0, "L");
$objetYAxis += 5;
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth($text2), 0, $text2, 0, "L");
$objetYAxis += 5;
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth($text3), 0, $text3, 0, "L");
// signature
$pdf->SetFont('ComicSans','',11); $pdf->SetXY( 145, 145 );
$pdf->SetFont('ComicSans','',11); $pdf->SetXY( 145, 170);
$pdf->Cell( $pdf->GetStringWidth($defaultConfig[0]->nom.' '.$defaultConfig[0]->prenom), 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom.' '.$defaultConfig[0]->prenom)), 0, 0, 'L');
if($doesSignatureExist){
$pdf->Image($this->defaultImagePath."sign.png", 135, 150, 60,40);
$pdf->Image($this->defaultImagePath."sign.png", 140, 175, 45,30);
}
$y0 = 260;
@ -290,13 +305,18 @@ class InvoiceRecapService {
// adresse du facture
$clientInfoXAxis = 125;
$clientInfoYAxis = 40;
$clientInfoYAxis = $clientAdressIsMultiline ? 33 : 40;
$pdf->SetFont('ComicSans','',size: 11);
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, utf8_decode('Groupe '.$clientGroupFacturation["group_facturation_name"]));
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientGroupFacturation["address"]))));
$pdf->SetMargins(0,0,10);
$pdf->MultiCell( 0, 7, trim($clientAdress));
$pdf->SetMargins(0,0,0);
if($clientAdressIsMultiline){
$clientInfoYAxis += 7;
}
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientGroupFacturation["postal_code"]. ' '.$clientGroupFacturation["city"]))));
@ -436,6 +456,7 @@ class InvoiceRecapService {
$data_factures = [];
$storage = $this->rootFolder->getUserFolder($idNextcloud);
$doesLogoExist = $this->doesLogoExist();
$doesSignatureExist = $this->doesSignatureImageExists();
$defaultConfig = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
$configurationAddresses = FileExportHelpers::GetAddressAndCityFromAddress($defaultConfig[0]->adresse);
$configurationAddress = $configurationAddresses["address"];
@ -584,7 +605,17 @@ class InvoiceRecapService {
$pdf->Cell( 0, 7, utf8_decode($clientHeaderLabel));
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientAddress))));
$clientAddress = FileExportHelpers::FormatTextForExport($clientAddress);
$clientAdressWidth = $pdf->GetStringWidth($clientAddress);
$maxWidth = $pdf->GetPageWidth();
$availableWidhtForClientInfo = $maxWidth - 10 - $clientInfoXAxis;
$clientAdressIsMultiline = $clientAdressWidth > $availableWidhtForClientInfo;
$pdf->SetMargins(0,0,10);
$pdf->MultiCell( 0, 7, trim($clientAddress));
$pdf->SetMargins(0,0,0);
if($clientAdressIsMultiline){
$clientInfoYAxis += 7;
}
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientCity))));
@ -594,26 +625,30 @@ class InvoiceRecapService {
$pdf->Cell( 0, 7, "Saint Senoux, le ".utf8_decode($date_formated));
// observations
$pdf->SetFont( "ComicSans", "BU", 10 ); $pdf->SetXY( 10, 95 ) ; $pdf->Cell($pdf->GetStringWidth("Objet:"), 0, "Objet:", 0, "L");
$objetYAxis = 110;
$pdf->SetFont( "ComicSans", "BU", 10 ); $pdf->SetXY( 10, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth("Objet:"), 0, "Objet:", 0, "L");
$objet = utf8_decode("Récapitulatif Facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1]));
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 95 ) ; $pdf->Cell($pdf->GetStringWidth($objet), 0, $objet, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth($objet), 0, $objet, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 105 ); $pdf->Cell($pdf->GetStringWidth("Madame, Monsieur"), 0, "Madame, Monsieur", 0, "L");
$objetYAxis += 10;
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ); $pdf->Cell($pdf->GetStringWidth("Madame, Monsieur"), 0, "Madame, Monsieur", 0, "L");
$text1 = utf8_decode("Veuillez trouver ci-dessous le récapitulatif de la facturation du mois de ").strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])).".";
$text2 = utf8_decode("Vous en souhaitant bonne réception.");
$text3 = utf8_decode("Veuillez agréer, Madame, Monsieur, mes salutations les meilleures.");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 115 ) ; $pdf->Cell($pdf->GetStringWidth($text1), 0, $text1, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 120 ) ; $pdf->Cell($pdf->GetStringWidth($text2), 0, $text2, 0, "L");
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, 125 ) ; $pdf->Cell($pdf->GetStringWidth($text3), 0, $text3, 0, "L");
$objetYAxis += 10;
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth($text1), 0, $text1, 0, "L");
$objetYAxis += 5;
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth($text2), 0, $text2, 0, "L");
$objetYAxis += 5;
$pdf->SetFont( "ComicSans", "", 10 ); $pdf->SetXY( $pdf->GetStringWidth("Objet")+15, $objetYAxis ) ; $pdf->Cell($pdf->GetStringWidth($text3), 0, $text3, 0, "L");
// signature
$pdf->SetFont('ComicSans','',11); $pdf->SetXY( 145, 145 );
$pdf->SetFont('ComicSans','',11); $pdf->SetXY( 145, 170);
$pdf->Cell( $pdf->GetStringWidth($defaultConfig[0]->nom.' '.$defaultConfig[0]->prenom), 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom.' '.$defaultConfig[0]->prenom)), 0, 0, 'L');
$signatureExists = $this->doesSignatureImageExists();
if($signatureExists){
$pdf->Image($this->defaultImagePath."sign.png", 135, 150, 60,40);
if($doesSignatureExist){
$pdf->Image($this->defaultImagePath."sign.png", 140, 175, 45,30);
}
$y0 = 260;
@ -672,13 +707,18 @@ class InvoiceRecapService {
// adresse du facture
$clientInfoXAxis = 125;
$clientInfoYAxis = 40;
$clientInfoYAxis = $clientAdressIsMultiline ? 33 : 40;
$pdf->SetFont('ComicSans','',size: 11);
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, utf8_decode($clientHeaderLabel));
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientAddress))));
$pdf->SetMargins(0,0,10);
$pdf->MultiCell( 0, 7, trim($clientAddress));
$pdf->SetMargins(0,0,0);
if($clientAdressIsMultiline){
$clientInfoYAxis += 7;
}
$clientInfoYAxis += 7;
$pdf->SetXY($clientInfoXAxis,$clientInfoYAxis);
$pdf->Cell( 0, 7, trim(utf8_decode(html_entity_decode($clientCity))));