diff --git a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php index 3ed38a5..3807e49 100644 --- a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php +++ b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php @@ -181,6 +181,7 @@ class InvoiceGroupPdfHandler extends FPDF { $this->SetXY($clientInfoXAxis,$clientInfoYAxis); $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($clientName)); $clientInfoYAxis += $this->interLigneHeader; + $gapBetweenAddressLines = 0; if ( $this->factureData['group_type'] == 'single' ) { $address = FileExportHelpers::FormatTextForExport(trim($clientAddress)); $addressWidth = $this->GetStringWidth($address); @@ -191,7 +192,8 @@ class InvoiceGroupPdfHandler extends FPDF { $yBefore = $this->GetY(); $this->MultiCell($availableWidhtForClientInfo, $this->interLigneHeader, $address,0,'L'); $yAfter = $this->GetY(); - $isMultiline = ($yAfter - $yBefore) > $this->interLigneHeader; + $gapBetweenAddressLines = $yAfter - $yBefore; + $isMultiline = ($gapBetweenAddressLines) > $this->interLigneHeader; if($isMultiline){ $this->SetXY($this->GetX(),$yBefore); } @@ -199,9 +201,14 @@ class InvoiceGroupPdfHandler extends FPDF { $this->Cell($availableWidhtForClientInfo, $this->interLigneHeader, $address); } if($isMultiline){ + if($gapBetweenAddressLines > 0){ + $modulo = (int) round($gapBetweenAddressLines/$this->interLigneHeader); + $clientInfoYAxis += $modulo*$this->interLigneHeader; + } + } + else{ $clientInfoYAxis += $this->interLigneHeader; } - $clientInfoYAxis += $this->interLigneHeader; }else{ $clientAddresses = explode(",",$clientAddress); diff --git a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceOgfPdfHandler.php b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceOgfPdfHandler.php index fc0baa9..4820d48 100644 --- a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceOgfPdfHandler.php +++ b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceOgfPdfHandler.php @@ -49,8 +49,12 @@ class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler { $clientInfoYAxis += $this->interLigneHeader; $this->SetXY($clientInfoXAxis,$clientInfoYAxis); $this->MultiCell( 0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($clientAddress))); - if($clientAdressIsMultiline){ - $clientInfoYAxis += $this->interLigneHeader; + if ($clientAdressIsMultiline) { + $clientAdressIsMoreThanTwoLines = $clientAdressWidth > ($availableWidhtForClientInfo * 2); + if($clientAdressIsMoreThanTwoLines){ + $clientInfoYAxis += $this->interLigneHeader; + } + $clientInfoYAxis += $this->interLigneHeader; } $clientInfoYAxis += $this->interLigneHeader; $this->SetXY($clientInfoXAxis,$clientInfoYAxis); diff --git a/gestion/lib/Service/InvoicePdfHandler.php b/gestion/lib/Service/InvoicePdfHandler.php index 2574326..6e0dd0d 100644 --- a/gestion/lib/Service/InvoicePdfHandler.php +++ b/gestion/lib/Service/InvoicePdfHandler.php @@ -178,6 +178,10 @@ class InvoicePdfHandler extends FPDF $this->SetXY($clientInfoXAxis, $clientInfoYAxis); $this->MultiCell(0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($clientAddress))); if ($clientAdressIsMultiline) { + $clientAdressIsMoreThanTwoLines = $clientAdressWidth > ($availableWidhtForClientInfo * 2); + if($clientAdressIsMoreThanTwoLines){ + $clientInfoYAxis += $this->interLigneHeader; + } $clientInfoYAxis += $this->interLigneHeader; } $clientInfoYAxis += $this->interLigneHeader;