diff --git a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php index 3807e49..c04a987 100644 --- a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php +++ b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php @@ -176,16 +176,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; + $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) { @@ -236,8 +238,13 @@ class InvoiceGroupPdfHandler extends FPDF { } } - $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']); + } }