Merge branch 'hotfixes/hotfix-bdc' into releases/release-h2f

This commit is contained in:
Tiavina 2025-03-07 11:50:20 +03:00
commit 64dcf44e04
3 changed files with 24 additions and 6 deletions

View File

@ -150,7 +150,7 @@ class OrderPdfService {
$filename .= mb_strtoupper($defuntNom,'UTF-8'); $filename .= mb_strtoupper($defuntNom,'UTF-8');
} }
else{ else{
$filename .= mb_strtoupper($orderPdfData['provider_name'],'UTF-8'); $filename .= mb_strtoupper($orderPdfData['company_name'],'UTF-8');
} }
return $filename; return $filename;
} }

View File

@ -145,7 +145,7 @@ class OrderService {
"quantite" => $orderItem["order_item_quantity"], "quantite" => $orderItem["order_item_quantity"],
"produit_price" => $orderItem["order_product_ht_amount"], "produit_price" => $orderItem["order_product_ht_amount"],
"produit_reference" => $orderItem["order_product_reference"], "produit_reference" => $orderItem["order_product_reference"],
"description" => $orderItem["order_product_label"], "produit_description" => $orderItem["order_product_label"],
]; ];
} }
$orderDetails["client_real_adress"] = $orderDetails["provider_address"]; $orderDetails["client_real_adress"] = $orderDetails["provider_address"];

View File

@ -46,7 +46,7 @@ class OrderPdfHandler extends FPDF {
private $initialIndexPosition = 0; private $initialIndexPosition = 0;
private $articlesCountToGet = 0; private $articlesCountToGet = 0;
private const MAX_ARTICLES_PER_PAGE = 18; private const MAX_ARTICLES_PER_PAGE = 16;
private const DEFAULT_SUBCONTRACTOR_NAME = "SOUS TRAITANT"; private const DEFAULT_SUBCONTRACTOR_NAME = "SOUS TRAITANT";
function Header() function Header()
@ -159,6 +159,7 @@ class OrderPdfHandler extends FPDF {
$products = $this->orderData["products"]; $products = $this->orderData["products"];
// var_dump($products); // var_dump($products);
$yValue = 116; $yValue = 116;
$maxDescriptionWidth = 98;
$currentIndexPosition = $this->currentIndexPosition; $currentIndexPosition = $this->currentIndexPosition;
for($currentIndexPosition;$currentIndexPosition<($this->initialIndexPosition + $this->articlesCountToGet);$currentIndexPosition++){ for($currentIndexPosition;$currentIndexPosition<($this->initialIndexPosition + $this->articlesCountToGet);$currentIndexPosition++){
$product = $products[$currentIndexPosition]; $product = $products[$currentIndexPosition];
@ -166,7 +167,7 @@ class OrderPdfHandler extends FPDF {
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue); $valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
$totalHt+=$valueHt; $totalHt+=$valueHt;
$totalTtc+=$valueTtc; $totalTtc+=$valueTtc;
$productDescription = $product["produit_reference"]; $productDescription = $product["produit_reference"] . ' ' . $product['produit_description'];
$dateValue = ""; $dateValue = "";
if($product === end($products) ){ if($product === end($products) ){
$dateValue = $this->orderData["devis_date"]; $dateValue = $this->orderData["devis_date"];
@ -178,8 +179,22 @@ class OrderPdfHandler extends FPDF {
$this->SetXY( 10,$yValue ); $this->SetXY( 10,$yValue );
$this->Cell(25, 6, $dateValue, 0,0,'C'); $this->Cell(25, 6, $dateValue, 0,0,'C');
$productDescription = FileExportHelpers::FormatTextForExport($productDescription);
$productDescriptionWidth = $this->GetStringWidth($productDescription);
$productDescriptionWidthIsGreaterThanMaxWidth = $productDescriptionWidth > $maxDescriptionWidth;
$productDescriptionIsMultiline = false;
$this->SetXY( 35,$yValue ); $this->SetXY( 35,$yValue );
$this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($productDescription),0); if ($productDescriptionWidthIsGreaterThanMaxWidth) {
$yBefore = $this->GetY();
$this->MultiCell($maxDescriptionWidth, 6, $productDescription,0,'L');
$yAfter = $this->GetY();
$productDescriptionIsMultiline = ($yAfter - $yBefore) > 6;
if($productDescriptionIsMultiline){
$this->SetXY($this->GetX(),$yBefore);
}
} else {
$this->Cell($maxDescriptionWidth, 6, $productDescription);
}
$this->SetXY( 135,$yValue ); $this->SetXY( 135,$yValue );
$this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C'); $this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C');
@ -191,6 +206,9 @@ class OrderPdfHandler extends FPDF {
$this->Cell(25, 6, number_format($valueTtc,2,'.','').chr(128), 0, 1, 'C'); $this->Cell(25, 6, number_format($valueTtc,2,'.','').chr(128), 0, 1, 'C');
$yValue += 6; $yValue += 6;
$totalTva += $tvaAmount; $totalTva += $tvaAmount;
if($productDescriptionIsMultiline){
$yValue += 6;
}
} }
$this->currentIndexPosition = $currentIndexPosition; $this->currentIndexPosition = $currentIndexPosition;
$this->initialIndexPosition = $this->currentIndexPosition; $this->initialIndexPosition = $this->currentIndexPosition;