Merge branch 'staging' into production

This commit is contained in:
narindraezway 2025-05-05 13:45:31 +03:00
commit 625e81ac30
3 changed files with 26 additions and 11 deletions

View File

@ -188,7 +188,8 @@ class InvoiceGroupPdfHandler extends FPDF
$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;
if ($this->factureData['group_type'] == 'single') { $gapBetweenAddressLines = 0;
if ( $this->factureData['group_type'] == 'single' ) {
$address = FileExportHelpers::FormatTextForExport(trim($clientAddress)); $address = FileExportHelpers::FormatTextForExport(trim($clientAddress));
$addressWidth = $this->GetStringWidth($address); $addressWidth = $this->GetStringWidth($address);
$addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo; $addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo;
@ -198,20 +199,26 @@ class InvoiceGroupPdfHandler extends FPDF
$yBefore = $this->GetY(); $yBefore = $this->GetY();
$this->MultiCell($availableWidhtForClientInfo, $this->interLigneHeader, $address, 0, 'L'); $this->MultiCell($availableWidhtForClientInfo, $this->interLigneHeader, $address, 0, 'L');
$yAfter = $this->GetY(); $yAfter = $this->GetY();
$isMultiline = ($yAfter - $yBefore) > $this->interLigneHeader; $gapBetweenAddressLines = $yAfter - $yBefore;
if ($isMultiline) { $isMultiline = ($gapBetweenAddressLines) > $this->interLigneHeader;
$this->SetXY($this->GetX(), $yBefore); if($isMultiline){
$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){
$modulo = (int) round($gapBetweenAddressLines/$this->interLigneHeader);
$clientInfoYAxis += $modulo*$this->interLigneHeader;
}
}
else{
$clientInfoYAxis += $this->interLigneHeader; $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);

View File

@ -49,7 +49,11 @@ class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler {
$clientInfoYAxis += $this->interLigneHeader; $clientInfoYAxis += $this->interLigneHeader;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis); $this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->MultiCell( 0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($clientAddress))); $this->MultiCell( 0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
if($clientAdressIsMultiline){ if ($clientAdressIsMultiline) {
$clientAdressIsMoreThanTwoLines = $clientAdressWidth > ($availableWidhtForClientInfo * 2);
if($clientAdressIsMoreThanTwoLines){
$clientInfoYAxis += $this->interLigneHeader;
}
$clientInfoYAxis += $this->interLigneHeader; $clientInfoYAxis += $this->interLigneHeader;
} }
$clientInfoYAxis += $this->interLigneHeader; $clientInfoYAxis += $this->interLigneHeader;

View File

@ -178,6 +178,10 @@ class InvoicePdfHandler extends FPDF
$this->SetXY($clientInfoXAxis, $clientInfoYAxis); $this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->MultiCell(0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($clientAddress))); $this->MultiCell(0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
if ($clientAdressIsMultiline) { if ($clientAdressIsMultiline) {
$clientAdressIsMoreThanTwoLines = $clientAdressWidth > ($availableWidhtForClientInfo * 2);
if($clientAdressIsMoreThanTwoLines){
$clientInfoYAxis += $this->interLigneHeader;
}
$clientInfoYAxis += $this->interLigneHeader; $clientInfoYAxis += $this->interLigneHeader;
} }
$clientInfoYAxis += $this->interLigneHeader; $clientInfoYAxis += $this->interLigneHeader;