diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index b0439f3..ba5c808 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -2670,6 +2670,7 @@ class Bdd { devis.comment as devis_comment, devis.id_client as devis_id_client, client.nom as client_nom, + client.prenom as client_prenom, client.entreprise as client_entreprise, client.adresse as client_adresse, defunt.nom as defunt_nom, @@ -2678,6 +2679,7 @@ class Bdd { lieu.adresse as lieu_adresse, thanato.nom as thanato_nom, thanato.prenom as thanato_prenom, + client_group_facturation.group_facturation_name as group_facturation_name, 'group' as facture_type FROM ".$this->tableprefix."facture as facture LEFT JOIN ".$this->tableprefix."devis as devis on facture.id_devis = devis.id @@ -2685,6 +2687,7 @@ class Bdd { LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id LEFT JOIN ".$this->tableprefix."lieu as lieu on devis.id_lieu = lieu.id LEFT JOIN ".$this->tableprefix."thanato as thanato on devis.id_thanato = thanato.id + LEFT JOIN ".$this->tableprefix."client_group_facturation as client_group_facturation on client.fk_client_group_facturation_id = client_group_facturation.id WHERE client.id IN ($clientIdsSqlPlaceholder) AND YEAR(facture.date_paiement) = ?"; @@ -2721,6 +2724,7 @@ class Bdd { devis.comment as devis_comment, devis.id_client as devis_id_client, client.nom as client_nom, + client.prenom as client_prenom, client.entreprise as client_entreprise, client.adresse as client_adresse, defunt.nom as defunt_nom, diff --git a/gestion/lib/Service/InvoicePdfHandler.php b/gestion/lib/Service/InvoicePdfHandler.php index bc5514e..ec46795 100644 --- a/gestion/lib/Service/InvoicePdfHandler.php +++ b/gestion/lib/Service/InvoicePdfHandler.php @@ -80,7 +80,7 @@ class InvoicePdfHandler extends FPDF { $filename = mb_strtoupper($factureData["client_prenom"],'UTF-8'); } else{ - $filename = 'GROUP_'.mb_strtoupper($factureData["client_nom"],'UTF-8'); + $filename = 'GROUPE_'.mb_strtoupper($factureData["group_facturation_name"],'UTF-8'); } $filename .= $month != 0 ? '_'.DateHelpers::GetMonthPlainString($month) :''; $filename .= "_".$year; @@ -97,10 +97,14 @@ class InvoicePdfHandler extends FPDF { } private function DrawInvoiceCompanyAndClientInfo(){ + $clientName = $this->factureData['client_nom']; + if($this->factureData['facture_type'] == MultipleFactureTypeConstant::GROUP_FILTER_TYPE){ + $clientName = $this->factureData['group_facturation_name']; + } $this->SetY(40); $this->SetFont('ComicSans', '', 12); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration']->entreprise), 0, 0); - $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['client_nom']), 0, 1,'R'); + $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($clientName), 0, 1,'R'); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse']), 0, 0); $this->Cell(0, 7, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_real_adress'])), 0, 1,'R'); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse_city']), 0, 0);border: