]> git.agnieray.net Git - galette.git/blob - galette/lib/Galette/Entity/PdfContribution.php
Throw errors
[galette.git] / galette / lib / Galette / Entity / PdfContribution.php
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 /**
6 * PDF contributions model
7 *
8 * PHP version 5
9 *
10 * Copyright © 2020-2021 The Galette Team
11 *
12 * This file is part of Galette (http://galette.tuxfamily.org).
13 *
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * @category Entity
28 * @package Galette
29 *
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2020-2021 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
33 * @link http://galette.tuxfamily.org
34 * @since 2020-11-21
35 */
36
37 namespace Galette\Entity;
38
39 use Analog\Analog;
40 use Galette\Core\Db;
41 use Galette\Core\Preferences;
42 use Galette\Entity\Contribution;
43 use NumberFormatter;
44
45 /**
46 * PDF contribution model
47 *
48 * @category Entity
49 * @name PdfContribution
50 * @package Galette
51 * @author Johan Cwiklinski <johan@x-tnd.be>
52 * @copyright 2020-2021 The Galette Team
53 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
54 * @link http://galette.tuxfamily.org
55 * @since 2020-11-21
56 */
57
58 abstract class PdfContribution extends PdfModel
59 {
60 /**
61 * Main constructor
62 *
63 * @param Db $zdb Database instance
64 * @param Preferences $preferences Galette preferences
65 * @param int $type Model type
66 * @param mixed $args Arguments
67 */
68 public function __construct(Db $zdb, Preferences $preferences, int $type, $args = null)
69 {
70 parent::__construct($zdb, $preferences, $type, $args);
71
72 $this->setPatterns(
73 $this->getMemberPatterns() + $this->getContributionPatterns()
74 );
75 }
76
77 /**
78 * Build legend array
79 *
80 * @return array
81 */
82 public function getLegend(): array
83 {
84 $legend = parent::getLegend();
85
86 $patterns = $this->getContributionPatterns(false);
87
88 $legend['contribution'] = [
89 'title' => _T('Contribution information'),
90 'patterns' => $patterns
91 ];
92
93 return $legend;
94 }
95 }