Merge branch 'staging' into production

This commit is contained in:
Tiavina 2025-06-02 15:08:10 +03:00
commit 416f4b030a

View File

@ -186,15 +186,15 @@ class InvoiceGroupPdfHandler extends FPDF
$address = FileExportHelpers::FormatTextForExport(trim($clientAddress)); $address = FileExportHelpers::FormatTextForExport(trim($clientAddress));
$addressWidth = $this->GetStringWidth($address); $addressWidth = $this->GetStringWidth($address);
$addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo; $addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo;
$addressIsMoreThanTwoLines = ($addressWidth/$availableWidhtForClientInfo) > 2; $addressIsMoreThanTwoLines = ($addressWidth / $availableWidhtForClientInfo) > 2;
$clientInfoYAxis =$addressIsMoreThanTwoLines ? 35 : 40; $clientInfoYAxis = $addressIsMoreThanTwoLines ? 35 : 40;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis); $this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($clientName)); $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += $this->interLigneHeader; $clientInfoYAxis += $this->interLigneHeader;
$gapBetweenAddressLines = 0; $gapBetweenAddressLines = 0;
if ( $this->factureData['group_type'] == 'single' ) { if ($this->factureData['group_type'] == 'single') {
$isMultiline = false; $isMultiline = false;
$this->SetXY($clientInfoXAxis, $clientInfoYAxis); $this->SetXY($clientInfoXAxis, $clientInfoYAxis);
if ($addressWidthGreaterThanMaxWidth) { if ($addressWidthGreaterThanMaxWidth) {
@ -202,25 +202,24 @@ class InvoiceGroupPdfHandler extends FPDF
$this->MultiCell($availableWidhtForClientInfo, $this->interLigneHeader, $address, 0, 'L'); $this->MultiCell($availableWidhtForClientInfo, $this->interLigneHeader, $address, 0, 'L');
$yAfter = $this->GetY(); $yAfter = $this->GetY();
$gapBetweenAddressLines = $yAfter - $yBefore; $gapBetweenAddressLines = $yAfter - $yBefore;
$isMultiline = ($gapBetweenAddressLines) > $this->interLigneHeader; $isMultiline = ($gapBetweenAddressLines) > $this->interLigneHeader;
if($isMultiline){ if ($isMultiline) {
$this->SetXY($this->GetX(),$yBefore); $this->SetXY($this->GetX(), $yBefore);
} }
} else { } else {
$this->Cell($availableWidhtForClientInfo, $this->interLigneHeader, $address); $this->Cell($availableWidhtForClientInfo, $this->interLigneHeader, $address);
} }
if($isMultiline){ if ($isMultiline) {
if($gapBetweenAddressLines > 0){ if ($gapBetweenAddressLines > 0) {
$modulo = (int) round($gapBetweenAddressLines/$this->interLigneHeader); $modulo = (int) round($gapBetweenAddressLines / $this->interLigneHeader);
$clientInfoYAxis += $modulo*$this->interLigneHeader; $clientInfoYAxis += $modulo * $this->interLigneHeader;
} }
} } else {
else{
$clientInfoYAxis += $this->interLigneHeader; $clientInfoYAxis += $this->interLigneHeader;
} }
}else{ } else {
$clientAddresses = explode(",",$clientAddress); $clientAddresses = explode(",", $clientAddress);
foreach ($clientAddresses as $address) { foreach ($clientAddresses as $address) {
$address = FileExportHelpers::FormatTextForExport(trim($address)); $address = FileExportHelpers::FormatTextForExport(trim($address));
$addressWidth = $this->GetStringWidth($address); $addressWidth = $this->GetStringWidth($address);
@ -244,11 +243,12 @@ class InvoiceGroupPdfHandler extends FPDF
$clientInfoYAxis += $this->interLigneHeader; $clientInfoYAxis += $this->interLigneHeader;
} }
} }
$this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->Cell(0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city']))); $this->Cell(0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
if($this->factureData['siret']){ if ($this->factureData['siret']) {
$this->SetXY($clientInfoXAxis,$clientInfoYAxis); $clientInfoYAxis += $this->interLigneHeader;
$this->Cell(0, $this->interLigneHeader, 'Siret: ' . $this->factureData['siret']); $this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->Cell(0, $this->interLigneHeader, 'Siret: ' . $this->factureData['siret']);
} }
} }