Skip to content

Commit dd936d7

Browse files
committed
On passe à tFPDF pour l'UTF-8
1 parent 2f2ddf4 commit dd936d7

File tree

17 files changed

+164
-142
lines changed

17 files changed

+164
-142
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ phpstan:
108108
##@ Frontend
109109

110110
### Compiler les assets pour la production
111+
.PHONY: assets
111112
assets:
112113
./node_modules/.bin/webpack -p
113114

assets/fonts/Arial.ttf

269 KB
Binary file not shown.

assets/fonts/Arial_Bold.ttf

280 KB
Binary file not shown.

assets/fonts/Arial_Bold_Italic.ttf

219 KB
Binary file not shown.

assets/fonts/Arial_Italic.ttf

201 KB
Binary file not shown.

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"psr/clock": "^1.0",
3939
"robmorgan/phinx": "^0.14.0",
4040
"sabre/vobject": "^4.1",
41-
"setasign/fpdf": "^1.8",
41+
"setasign/tfpdf": "^1.33",
4242
"smarty/smarty": "^5.4",
4343
"symfony/asset": "^5.4",
4444
"symfony/console": "^5.4",

composer.lock

+26-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sources/Afup/Association/Cotisations.php

+27-27
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public function genererFacture($id_cotisation, $chemin = null)
344344

345345
// A l'attention du client [adresse]
346346
$pdf->SetFont('Arial', 'BU', 10);
347-
$pdf->Cell(130, 5, utf8_decode('Objet : Facture n°' . $cotisation['numero_facture']));
347+
$pdf->Cell(130, 5, 'Objet : Facture n°' . $cotisation['numero_facture']);
348348
$pdf->SetFont('Arial', '', 10);
349349

350350
if ($cotisation['type_personne'] == AFUP_PERSONNES_MORALES) {
@@ -355,33 +355,33 @@ public function genererFacture($id_cotisation, $chemin = null)
355355
$patternPrefix = $personne['nom'];
356356
}
357357
$pdf->Ln(10);
358-
$pdf->MultiCell(130, 5, utf8_decode($nom . "\n" . $personne['adresse'] . "\n" . $personne['code_postal'] . "\n" . $personne['ville']));
358+
$pdf->MultiCell(130, 5, $nom . "\n" . $personne['adresse'] . "\n" . $personne['code_postal'] . "\n" . $personne['ville']);
359359

360360
if (isset($cotisation['reference_client'])) {
361361
$pdf->Ln(10);
362-
$pdf->MultiCell(180, 5, utf8_decode(sprintf(
362+
$pdf->MultiCell(180, 5, sprintf(
363363
"Référence client : %s",
364364
$cotisation['reference_client']
365-
)));
365+
));
366366
}
367367

368368
$pdf->Ln(15);
369369

370-
$pdf->MultiCell(180, 5, utf8_decode("Facture concernant votre adhésion à l'Association Française des Utilisateurs de PHP (AFUP)."));
370+
$pdf->MultiCell(180, 5, "Facture concernant votre adhésion à l'Association Française des Utilisateurs de PHP (AFUP).");
371371

372372
if (false === $isSubjectedToVat) {
373373
// Cadre
374374
$pdf->Ln(10);
375375
$pdf->SetFillColor(200, 200, 200);
376376
$pdf->Cell(50, 5, 'Code', 1, 0, 'L', 1);
377-
$pdf->Cell(100, 5, utf8_decode('Désignation'), 1, 0, 'L', 1);
377+
$pdf->Cell(100, 5, 'Désignation', 1, 0, 'L', 1);
378378
$pdf->Cell(40, 5, 'Prix', 1, 0, 'L', 1);
379379

380380
$pdf->Ln();
381381
$pdf->SetFillColor(255, 255, 255);
382382
$pdf->Cell(50, 5, 'ADH', 1);
383-
$pdf->Cell(100, 5, utf8_decode("Adhésion AFUP jusqu'au " . date('d/m/Y', (int) $cotisation['date_fin'])), 1);
384-
$pdf->Cell(40, 5, utf8_decode($cotisation['montant'] . ' €'), 1);
383+
$pdf->Cell(100, 5, "Adhésion AFUP jusqu'au " . date('d/m/Y', (int) $cotisation['date_fin']), 1);
384+
$pdf->Cell(40, 5, $cotisation['montant'] . ' ', 1);
385385

386386
$pdf->Ln(15);
387387
$pdf->Cell(10, 5, 'TVA non applicable - art. 293B du CGI');
@@ -397,7 +397,7 @@ public function genererFacture($id_cotisation, $chemin = null)
397397
$pdf->Ln(10);
398398
$pdf->SetFillColor(200, 200, 200);
399399
$pdf->Cell(20, 5, 'Code', 1, 0, 'L', 1);
400-
$pdf->Cell(95, 5, utf8_decode('Désignation'), 1, 0, 'L', 1);
400+
$pdf->Cell(95, 5, 'Désignation', 1, 0, 'L', 1);
401401
$pdf->Cell(25, 5, 'Prix HT', 1, 0, 'R', 1);
402402
$pdf->Cell(25, 5, 'Taux TVA', 1, 0, 'R', 1);
403403
$pdf->Cell(25, 5, 'Prix TTC', 1, 0, 'R', 1);
@@ -411,28 +411,28 @@ public function genererFacture($id_cotisation, $chemin = null)
411411
$pdf->Ln();
412412
$pdf->SetFillColor(225, 225, 225);
413413
$pdf->Cell(165, 5, 'Total HT', 1, 0, 'R', 1);
414-
$pdf->Cell(25, 5, $this->formatFactureValue($totalHt) . utf8_decode(' €'), 1, 0, 'R', 1);
414+
$pdf->Cell(25, 5, $this->formatFactureValue($totalHt) . '', 1, 0, 'R', 1);
415415

416416
$pdf->Ln();
417417
$pdf->SetFillColor(255, 255, 255);
418418
$pdf->Cell(165, 5, 'Total TVA 20%', 1, 0, 'R', 1);
419-
$pdf->Cell(25, 5, $this->formatFactureValue($total - $totalHt) . utf8_decode(' €'), 1, 0, 'R', 1);
419+
$pdf->Cell(25, 5, $this->formatFactureValue($total - $totalHt) . '', 1, 0, 'R', 1);
420420

421421
$pdf->Ln();
422422
$pdf->SetFillColor(225, 225, 225);
423423
$pdf->Cell(165, 5, 'Total TTC', 1, 0, 'R', 1);
424-
$pdf->Cell(25, 5, $this->formatFactureValue($total) . utf8_decode(' €'), 1, 0, 'R', 1);
424+
$pdf->Cell(25, 5, $this->formatFactureValue($total) . '', 1, 0, 'R', 1);
425425
}
426426

427427
$pdf->Ln(15);
428-
$pdf->Cell(10, 5, utf8_decode('Lors de votre règlement, merci de préciser la mention : "Facture n°' . $cotisation['numero_facture']) . '"');
428+
$pdf->Cell(10, 5, 'Lors de votre règlement, merci de préciser la mention : "Facture n°' . $cotisation['numero_facture'] . '"');
429429

430430
if (is_null($chemin)) {
431431
$pattern = str_replace(' ', '', $patternPrefix) . '_' . $cotisation['numero_facture'] . '_' . date('dmY', (int) $cotisation['date_debut']) . '.pdf';
432432

433-
$pdf->Output($pattern, 'D');
433+
$pdf->Output($pattern, 'D', true);
434434
} else {
435-
$pdf->Output($chemin, 'F');
435+
$pdf->Output($chemin, 'F', true);
436436
}
437437

438438
return $cotisation['numero_facture'];
@@ -444,10 +444,10 @@ private function buildDetailsPersonneMorale(PDF_Facture $pdf, $montant, $dateFin
444444
$pdf->Ln();
445445
$pdf->SetFillColor(255, 255, 255);
446446
$pdf->Cell(20, 5, 'ADH', 1);
447-
$pdf->Cell(95, 5, utf8_decode("Adhésion AFUP jusqu'au " . date('d/m/Y', (int) $dateFin)), 1);
448-
$pdf->Cell(25, 5, utf8_decode($this->formatFactureValue($montant) . ' €'), 1, 0, 'R');
449-
$pdf->Cell(25, 5, utf8_decode((Utils::MEMBERSHIP_FEE_VAT_RATE * 100) . ' %'), 1, 0, 'R');
450-
$pdf->Cell(25, 5, utf8_decode($this->formatFactureValue($montantTtc) . ' €'), 1, 0, 'R');
447+
$pdf->Cell(95, 5, "Adhésion AFUP jusqu'au " . date('d/m/Y', (int) $dateFin), 1);
448+
$pdf->Cell(25, 5, $this->formatFactureValue($montant) . ' ', 1, 0, 'R');
449+
$pdf->Cell(25, 5, (Utils::MEMBERSHIP_FEE_VAT_RATE * 100 . ' %'), 1, 0, 'R');
450+
$pdf->Cell(25, 5, $this->formatFactureValue($montantTtc) . ' ', 1, 0, 'R');
451451
$totalHt = $montant;
452452
$total = $montantTtc;
453453

@@ -463,18 +463,18 @@ private function buildDetailsPersonnePhysique(PDF_Facture $pdf, $montant, $dateF
463463
$pdf->Ln();
464464
$pdf->SetFillColor(255, 255, 255);
465465
$pdf->Cell(20, 5, 'ADH-var', 1);
466-
$pdf->Cell(95, 5, utf8_decode("Adhésion AFUP jusqu'au " . date('d/m/Y', (int) $dateFin) . ' - part variable'), 1);
467-
$pdf->Cell(25, 5, utf8_decode($this->formatFactureValue($montantFixeHt) . ' €'), 1, 0, 'R');
468-
$pdf->Cell(25, 5, utf8_decode((Utils::MEMBERSHIP_FEE_VAT_RATE * 100) . ' %'), 1, 0, 'R');
469-
$pdf->Cell(25, 5, utf8_decode($this->formatFactureValue($montantFixeTTc) . ' €'), 1, 0, 'R');
466+
$pdf->Cell(95, 5, "Adhésion AFUP jusqu'au " . date('d/m/Y', (int) $dateFin) . ' - part variable', 1);
467+
$pdf->Cell(25, 5, $this->formatFactureValue($montantFixeHt) . ' ', 1, 0, 'R');
468+
$pdf->Cell(25, 5, (Utils::MEMBERSHIP_FEE_VAT_RATE * 100 . ' %'), 1, 0, 'R');
469+
$pdf->Cell(25, 5, $this->formatFactureValue($montantFixeTTc) . ' ', 1, 0, 'R');
470470

471471
$pdf->Ln();
472472
$pdf->SetFillColor(255, 255, 255);
473473
$pdf->Cell(20, 5, 'ADH-fixe', 1);
474-
$pdf->Cell(95, 5, utf8_decode("Adhésion AFUP jusqu'au " . date('d/m/Y', (int) $dateFin) . ' - part fixe'), 1);
475-
$pdf->Cell(25, 5, utf8_decode($this->formatFactureValue($montantVariable) . ' €'), 1, 0, 'R');
476-
$pdf->Cell(25, 5, utf8_decode('0 %'), 1, 0, 'R');
477-
$pdf->Cell(25, 5, utf8_decode($this->formatFactureValue($montantVariable) . ' €'), 1, 0, 'R');
474+
$pdf->Cell(95, 5, "Adhésion AFUP jusqu'au " . date('d/m/Y', (int) $dateFin) . ' - part fixe', 1);
475+
$pdf->Cell(25, 5, $this->formatFactureValue($montantVariable) . ' ', 1, 0, 'R');
476+
$pdf->Cell(25, 5, '0 %', 1, 0, 'R');
477+
$pdf->Cell(25, 5, $this->formatFactureValue($montantVariable) . ' ', 1, 0, 'R');
478478

479479
$totalHt = $montantFixeHt + $montantVariable;
480480
$total = $montantFixeTTc + $montantVariable;

0 commit comments

Comments
 (0)