Merge remote-tracking branch 'origin/staging' into releases/release-hytha-prod

This commit is contained in:
Tiavina 2025-04-07 16:53:43 +03:00
commit 3ea9d4ed52
4 changed files with 37 additions and 14 deletions

2
Jenkinsfile vendored
View File

@ -5,7 +5,7 @@ pipeline {
when { branch 'staging' } when { branch 'staging' }
agent { label 'apache && dev' } agent { label 'apache && dev' }
steps { steps {
sh '''cd /var/www/nextcloud/nextcloud/custom_apps sh '''cd /var/www/hytha35-sottye/nextcloud/custom_apps
sudo su jenkins -c "git stash && git pull origin staging" ''' sudo su jenkins -c "git stash && git pull origin staging" '''
} }
} }

View File

@ -2957,6 +2957,7 @@ class Bdd {
$factureData["client_mail"] = $devis["client_mail"]; $factureData["client_mail"] = $devis["client_mail"];
$factureData["siret"] = $devis["client_legal_one"]; $factureData["siret"] = $devis["client_legal_one"];
$factureData["group_name"] = $devis["client_nom"] ?? ""; $factureData["group_name"] = $devis["client_nom"] ?? "";
$factureData["group_type"] = "single";
} }
else{ else{
$factureData["client_real_adress"] = $devis["group_address"] ?? ""; $factureData["client_real_adress"] = $devis["group_address"] ?? "";
@ -2965,6 +2966,8 @@ class Bdd {
$factureData["siret"] = $devis["group_siret_number"]; $factureData["siret"] = $devis["group_siret_number"];
$factureData["group_name"] = $devis["group_name"] ?? ""; $factureData["group_name"] = $devis["group_name"] ?? "";
$templateType = $devis['fk_template_type_key'] ?? ClientTemplateTypeConstant::PRIVEES; $templateType = $devis['fk_template_type_key'] ?? ClientTemplateTypeConstant::PRIVEES;
$factureData["group_type"] = "group";
} }
} }
$products = $this->getDevisProduits($devis["devis_id"]); $products = $this->getDevisProduits($devis["devis_id"]);

View File

@ -44,6 +44,8 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
$maxDescriptionWidth = 102; $maxDescriptionWidth = 102;
$currentIndexPosition = $this->currentIndexPosition; $currentIndexPosition = $this->currentIndexPosition;
for($currentIndexPosition;$currentIndexPosition<($this->initialIndexPosition + $this->devisCountToGet);$currentIndexPosition++){ for($currentIndexPosition;$currentIndexPosition<($this->initialIndexPosition + $this->devisCountToGet);$currentIndexPosition++){
$this->SetFont('ComicSans', '', 8);
$currentDevis = $devisData[$currentIndexPosition]; $currentDevis = $devisData[$currentIndexPosition];
$devisDate = $currentDevis['devis_date']; $devisDate = $currentDevis['devis_date'];
$devisDate = DateTime::createFromFormat('Y-m-d',$devisDate); $devisDate = DateTime::createFromFormat('Y-m-d',$devisDate);
@ -59,6 +61,7 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
$this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($subcontractorCaseNumberText),0,'0',); $this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($subcontractorCaseNumberText),0,'0',);
$yValue += 6; $yValue += 6;
foreach($products as $product){ foreach($products as $product){
$valueHt = $product['produit_price'] * $product["quantite"]; $valueHt = $product['produit_price'] * $product["quantite"];
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue); $valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
$totalHt+=$valueHt; $totalHt+=$valueHt;
@ -90,7 +93,6 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
$this->Cell($maxDescriptionWidth, 6, $productDescription); $this->Cell($maxDescriptionWidth, 6, $productDescription);
} }
$this->SetFont('ComicSans', '', 8);
$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');
@ -112,7 +114,7 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
$this->initialIndexPosition = $this->currentIndexPosition; $this->initialIndexPosition = $this->currentIndexPosition;
$chargedDevisCount = $this->currentIndexPosition + 1; $chargedDevisCount = $this->currentIndexPosition + 1;
$devisLeftToGet = $this->devisCount - $chargedDevisCount; $devisLeftToGet = $this->devisCount - $chargedDevisCount;
$this->devisCountToGet = ($devisLeftToGet <= $this->maxArticlePerPage) ? $devisLeftToGet + 1 : $this->maxArticlePerPage; $this->devisCountToGet = ($devisLeftToGet < $this->maxArticlePerPage) ? $devisLeftToGet + 1: $this->maxArticlePerPage;
} }
} }

View File

@ -160,25 +160,42 @@ class InvoiceGroupPdfHandler extends FPDF {
public function DrawInvoiceClientInfo(){ public function DrawInvoiceClientInfo(){
$this->SetFont('ComicSans', '', 10); $this->SetFont('ComicSans', '', 10);
$clientName = $this->factureData['group_name']; $clientName = $this->factureData['group_name'];
$clientInfoXAxis = 125; $clientInfoXAxis = 135;
$clientAddress = $this->factureData['client_real_adress']; $clientAddress = $this->factureData['client_real_adress'];
$clientAdressWidth = $this->GetStringWidth($clientAddress);
$maxWidth = $this->GetPageWidth(); $maxWidth = $this->GetPageWidth();
$availableWidhtForClientInfo = $maxWidth - 10 - $clientInfoXAxis; $availableWidhtForClientInfo = $maxWidth - 20 - $clientInfoXAxis;
$clientAdressIsMultiline = $clientAdressWidth > $availableWidhtForClientInfo;
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 40; $clientInfoYAxis = 40;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis); $this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport($clientName)); $this->Cell(0, 4, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 4; $clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis); if ( $this->factureData['group_type'] == 'single' ) {
$this->MultiCell( 0, 4, trim(FileExportHelpers::FormatTextForExport($clientAddress))); $addressWidth = $this->GetStringWidth($clientAddress);
if($clientAdressIsMultiline){ $isMultiline = $addressWidth > $availableWidhtForClientInfo;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->MultiCell( 0, 4, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
if($isMultiline){
$clientInfoYAxis += 4;
}
$clientInfoYAxis += 4; $clientInfoYAxis += 4;
}else{
$clientAddresses = explode(",",$clientAddress);
foreach ($clientAddresses as $address) {
$addressWidth = $this->GetStringWidth($address);
$isMultiline = $addressWidth > $availableWidhtForClientInfo;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->MultiCell( 0, 4, trim(FileExportHelpers::FormatTextForExport($address)));
if($isMultiline){
$clientInfoYAxis += 4;
}
$clientInfoYAxis += 4;
}
} }
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis); $this->SetXY($clientInfoXAxis,$clientInfoYAxis + 1);
$this->Cell(0, 4, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city']))); $this->Cell(0, 4, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
} }
@ -319,7 +336,8 @@ class InvoiceGroupPdfHandler extends FPDF {
$this->initialIndexPosition = $this->currentIndexPosition; $this->initialIndexPosition = $this->currentIndexPosition;
$chargedDevisCount = $this->currentIndexPosition + 1; $chargedDevisCount = $this->currentIndexPosition + 1;
$devisLeftToGet = $this->devisCount - $chargedDevisCount; $devisLeftToGet = $this->devisCount - $chargedDevisCount;
$this->devisCountToGet = ($devisLeftToGet <= $this->maxArticlePerPage) ? $devisLeftToGet + 1 : $this->maxArticlePerPage; $this->devisCountToGet = ($devisLeftToGet < $this->maxArticlePerPage) ? $devisLeftToGet + 1: $this->maxArticlePerPage;
} }
public function DrawBankAndTotalPriceInfo(){ public function DrawBankAndTotalPriceInfo(){