|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* Copyright (C) 2020 Jan Böhmer |
|
4
|
|
|
* |
|
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
6
|
|
|
* it under the terms of the GNU Affero General Public License as published |
|
7
|
|
|
* by the Free Software Foundation, either version 3 of the License, or |
|
8
|
|
|
* (at your option) any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* This program is distributed in the hope that it will be useful, |
|
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13
|
|
|
* GNU Affero General Public License for more details. |
|
14
|
|
|
* |
|
15
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
16
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
namespace App\Controller; |
|
20
|
|
|
|
|
21
|
|
|
use App\Entity\PaymentOrder; |
|
22
|
|
|
use App\Entity\SEPAExport; |
|
23
|
|
|
use App\Helpers\PDFResponse; |
|
24
|
|
|
use App\Services\PDF\PaymentOrderPDFGenerator; |
|
25
|
|
|
use App\Services\PDF\SEPAExport\SEPAExportPDFGenerator; |
|
26
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
27
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
28
|
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @Route("/admin/pdf") |
|
32
|
|
|
*/ |
|
33
|
|
|
class PDFGeneratorController extends AbstractController |
|
34
|
|
|
{ |
|
35
|
|
|
/** |
|
36
|
|
|
* @Route("/payment_order/{id}") |
|
37
|
|
|
*/ |
|
38
|
|
|
public function paymentOrderPdf(PaymentOrder $paymentOrder, PaymentOrderPDFGenerator $paymentOrderPDFGenerator): Response |
|
39
|
|
|
{ |
|
40
|
|
|
$this->denyAccessUnlessGranted('ROLE_SHOW_PAYMENT_ORDERS'); |
|
41
|
|
|
|
|
42
|
|
|
$data = $paymentOrderPDFGenerator->generatePDF($paymentOrder); |
|
43
|
|
|
|
|
44
|
|
|
return new PDFResponse($data); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @Route("/sepa_export/{id}") |
|
49
|
|
|
* |
|
50
|
|
|
* @param SEPAExport $SEPAExport |
|
51
|
|
|
* @param SEPAExportPDFGenerator $SEPAExportPDFGenerator |
|
52
|
|
|
* @return Response |
|
53
|
|
|
*/ |
|
54
|
|
|
public function sepaExportPDF(SEPAExport $SEPAExport, SEPAExportPDFGenerator $SEPAExportPDFGenerator): Response |
|
55
|
|
|
{ |
|
56
|
|
|
$this->denyAccessUnlessGranted('ROLE_SHOW_SEPA_EXPORTS'); |
|
57
|
|
|
|
|
58
|
|
|
$data = $SEPAExportPDFGenerator->generatePDF($SEPAExport); |
|
59
|
|
|
return new PDFResponse($data); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
} |
|
63
|
|
|
|