diff --git a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php index 9a79bcf..3136b97 100644 --- a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php +++ b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php @@ -183,16 +183,18 @@ class InvoiceGroupPdfHandler extends FPDF $clientAddress = $this->factureData['client_real_adress']; $maxWidth = $this->GetPageWidth(); $availableWidhtForClientInfo = $maxWidth - 2 - $clientInfoXAxis; + $address = FileExportHelpers::FormatTextForExport(trim($clientAddress)); + $addressWidth = $this->GetStringWidth($address); + $addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo; + $addressIsMoreThanTwoLines = ($addressWidth/$availableWidhtForClientInfo) > 2; - $clientInfoYAxis = 40; - $this->SetXY($clientInfoXAxis, $clientInfoYAxis); + + $clientInfoYAxis =$addressIsMoreThanTwoLines ? 35 : 40; + $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); - $addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo; $isMultiline = false; $this->SetXY($clientInfoXAxis, $clientInfoYAxis); if ($addressWidthGreaterThanMaxWidth) { @@ -242,9 +244,14 @@ class InvoiceGroupPdfHandler extends FPDF $clientInfoYAxis += $this->interLigneHeader; } } - - $this->SetXY($clientInfoXAxis, $clientInfoYAxis + 1); + + $this->SetXY($clientInfoXAxis,$clientInfoYAxis); $this->Cell(0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city']))); + if($this->factureData['siret']){ + $clientInfoYAxis += $this->interLigneHeader; + $this->SetXY($clientInfoXAxis,$clientInfoYAxis); + $this->Cell(0, $this->interLigneHeader, 'Siret: ' . $this->factureData['siret']); + } }