Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions sources/AppBundle/Accounting/InvoicingPdfGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use AppBundle\Accounting\Model\Invoicing;
use AppBundle\Accounting\Model\InvoicingDetail;
use AppBundle\Compta\BankAccount\BankAccountFactory;
use Symfony\Component\String\Slugger\AsciiSlugger;

class InvoicingPdfGenerator
{
Expand Down Expand Up @@ -105,12 +106,16 @@ public function generateQuotation(Invoicing $invoicing, ?string $path = null): s

public function getInvoiceFilename(Invoicing $invoicing): string
{
return 'Facture - ' . $invoicing->getCompany() . ' - ' . ($invoicing->getInvoiceDate() ? $invoicing->getInvoiceDate()->format('Y-m-d') : '') . '.pdf';
$slugger = new AsciiSlugger();

return 'Facture - ' . $slugger->slug($invoicing->getCompany()) . ' - ' . ($invoicing->getInvoiceDate() ? $invoicing->getInvoiceDate()->format('Y-m-d') : '') . '.pdf';
}

public function getQuotationFilename(Invoicing $invoicing): string
{
return 'Devis - ' . $invoicing->getCompany() . ' - ' . ($invoicing->getQuotationDate() ? $invoicing->getQuotationDate()->format('Y-m-d') : '') . '.pdf';
$slugger = new AsciiSlugger();

return 'Devis - ' . $slugger->slug($invoicing->getCompany()) . ' - ' . ($invoicing->getQuotationDate() ? $invoicing->getQuotationDate()->format('Y-m-d') : '') . '.pdf';
}

private function buildPdf(\DateTimeImmutable $date, bool $isSubjectedToVat): PDF_Facture
Expand Down
6 changes: 3 additions & 3 deletions tests/behat/features/Admin/Tresorerie/DevisFactures.feature
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ Feature: Administration - Trésorerie - Devis/Facture
When I follow "Devis"
# Téléchargement du devis
And I follow the button of tooltip "Télécharger le devis ESN dev en folie"
Then the response header "Content-disposition" should match '#attachment; filename="Devis - ESN dev en folie - (.*).pdf"#'
Then the response header "Content-disposition" should match '#attachment; filename="Devis - ESN-dev-en-folie - (.*).pdf"#'
When I parse the pdf downloaded content
Then The page "1" of the PDF should contain "ESN dev en folie"
# Téléchargement de la facture
When I go to "/admin/"
And I follow "Factures"
And I follow the button of tooltip "Télécharger la facture 2026-3"
Then the response header "Content-disposition" should match '#attachment; filename="Facture - ESN dev en folie - (.*).pdf"#'
Then the response header "Content-disposition" should match '#attachment; filename="Facture - ESN-dev-en-folie - (.*).pdf"#'
When I parse the pdf downloaded content
Then The page "1" of the PDF should contain "N° TVA Intracommunautaire : FR7612345"

Expand All @@ -163,7 +163,7 @@ Feature: Administration - Trésorerie - Devis/Facture
Then the ".content h2" element should contain "Liste des devis"
And I should see "My company Ltd"
And I follow the button of tooltip "Télécharger le devis My company Ltd"
Then the response header "Content-disposition" should match '#attachment; filename="Devis - My company Ltd - (.*).pdf"#'
Then the response header "Content-disposition" should match '#attachment; filename="Devis - My-company-Ltd - (.*).pdf"#'
When I parse the pdf downloaded content
Then The page "1" of the PDF should contain "0,00 €"

Expand Down
Loading