Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
62.38% covered (warning)
62.38%
63 / 101
77.78% covered (warning)
77.78%
35 / 45
CRAP
0.00% covered (danger)
0.00%
0 / 1
Adresse
62.38% covered (warning)
62.38%
63 / 101
77.78% covered (warning)
77.78%
35 / 45
259.17
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getTerminAdressen
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 addTermin
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
12
 addTerminAdresse
80.00% covered (warning)
80.00%
4 / 5
0.00% covered (danger)
0.00%
0 / 1
2.03
 getArt
n/a
0 / 0
n/a
0 / 0
0
 setArt
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getBemerkung
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
 setBemerkung
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getFreifeld13
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setFreifeld13
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getNr
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setNr
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 padNr
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe1Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe1Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe10Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe10Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe2Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe2Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe3Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe3Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe4Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe4Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe5Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe5Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe6Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe6Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe7Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe7Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe8Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe8Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getRabattgruppe9Prozent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setRabattgruppe9Prozent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getTermine
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 isInteressent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isSerienbriefsperre
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 removeTermin
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
12
 removeTerminAdresse
80.00% covered (warning)
80.00%
4 / 5
0.00% covered (danger)
0.00%
0 / 1
2.03
 setInteressent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 setSerienbriefsperre
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 addAdressgruppe
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
12
 removeAdressgruppe
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
12
 addAdressgruppeAdresse
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 removeAdressgruppeAdresse
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 getAdressgruppen
75.00% covered (warning)
75.00%
3 / 4
0.00% covered (danger)
0.00%
0 / 1
2.06
 getLfdnr
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Satag\AmicronEntityBundle\Entity;
6
7use Doctrine\Common\Collections\ArrayCollection;
8use Doctrine\Common\Collections\Collection;
9use Doctrine\DBAL\Types\Types;
10use Doctrine\ORM\Mapping as ORM;
11use Satag\AmicronEntityBundle\Doctrine\IdGeneratorAdresse;
12use Satag\AmicronEntityBundle\Traits\BlameableEntity;
13use Satag\AmicronEntityBundle\Traits\BlameableEntityInterface;
14use Satag\AmicronEntityBundle\Traits\DecimalEntity;
15use Satag\AmicronEntityBundle\Traits\VorlegbareEntity;
16use Satag\AmicronEntityBundle\Util\Pad;
17use Symfony\Component\Validator\Constraints as Assert;
18
19/**
20 * @see \Satag\AmicronEntityBundle\Tests\Entity\AdresseTest
21 */
22#[ORM\Entity]
23#[ORM\InheritanceType('SINGLE_TABLE')]
24#[ORM\DiscriminatorColumn(name: 'ART', type: 'string', length: 1)]
25#[ORM\DiscriminatorMap(['K' => Kunde::class, 'L' => Lieferant::class, 'M' => Mitarbeiter::class])]
26#[ORM\HasLifecycleCallbacks]
27#[ORM\Table(name: 'ADRESSEN')]
28#[ORM\Index(columns: ['art'], name: 'ADRESSEN_ART_IDX')]
29#[ORM\Index(columns: ['bankktonr'], name: 'ADRESSEN_BANKKTONR_IDX')]
30#[ORM\Index(columns: ['blz'], name: 'ADRESSEN_BLZ_IDX')]
31#[ORM\Index(columns: ['email'], name: 'ADRESSEN_EMAIL_IDX')]
32#[ORM\Index(columns: ['kontoinhaber'], name: 'ADRESSEN_KONTOINHABER_IDX')]
33#[ORM\Index(columns: ['nrkto'], name: 'ADRESSEN_NRKTO_IDX')]
34#[ORM\Index(columns: ['vorlageam'], name: 'ADRESSEN_VORLAGEAM_DIDX')]
35#[ORM\Index(columns: ['nr'], name: 'NR_IDX')]
36#[ORM\Index(columns: ['lfdnrzweitadresse'], name: 'ADRESSEN_LFDNRZWEITADRESSE_FK')]
37#[ORM\Index(columns: ['privatbenutzergruppelfdnr'], name: 'ADRESSEN_PRIVATBENUTZERGR_FK')]
38#[ORM\Index(columns: ['privatfuer'], name: 'ADRESSEN_PRIVATFUER_FK')]
39#[ORM\Index(columns: ['vertreterlfdnr'], name: 'ADRESSEN_VERTRETERLFDNR_FK')]
40#[ORM\UniqueConstraint(name: 'ADRESSEN_UK', columns: ['nr', 'art'])]
41abstract class Adresse extends AbstractAmicronEntity implements BlameableEntityInterface
42{
43    use BlameableEntity;
44    use DecimalEntity;
45    use VorlegbareEntity;
46
47    #[ORM\Column(name: 'abgleichen', type: Types::INTEGER, nullable: true)]
48    public ?int $abgleichen = null;
49
50    #[ORM\Column(name: 'abrechnungsart', type: Types::STRING, length: 1, nullable: true)]
51    #[Assert\Choice(['B', 'R'], message: 'Ungültige Abrechnungsart, es gibt (B)ezahlung (R)echnung')]
52    public ?string $abrechnungsart = null;
53
54    #[ORM\Column(name: 'anrede', type: Types::STRING, length: 25, nullable: true)]
55    public ?string $anrede = null;
56
57    protected string $art;
58
59    #[ORM\Column(name: 'artikeltextfeld', type: Types::INTEGER, nullable: true)]
60    public ?int $artikeltextfeld = null;
61
62    #[ORM\Column(name: 'auftragssperre', type: Types::BOOLEAN, length: 1, nullable: true)]
63    public ?bool $auftragssperre = null;
64
65    #[ORM\Column(name: 'auftragssperream', type: Types::DATETIME_IMMUTABLE, nullable: true)]
66    public ?\DateTimeImmutable $auftragssperream = null;
67
68    #[ORM\Column(name: 'auftragssperrevon', type: Types::STRING, length: 3, nullable: true)]
69    public ?string $auftragssperrevon = null;
70
71    #[ORM\Column(name: 'austritt', type: Types::DATETIME_IMMUTABLE, nullable: true)]
72    public ?\DateTimeImmutable $austritt = null;
73
74    #[ORM\Column(name: 'bank', type: Types::STRING, length: 30, nullable: true)]
75    public ?string $bank = null;
76
77    #[ORM\Column(name: 'bankeinzug', type: Types::BOOLEAN, length: 1, nullable: true)]
78    public ?bool $bankeinzug = null;
79
80    #[ORM\Column(name: 'bankktonr', type: Types::STRING, length: 11, nullable: true)]
81    public ?string $bankktonr = null;
82
83    #[ORM\Column(name: 'bemerkung', type: Types::TEXT, nullable: true)]
84    public ?string $bemerkung = null {
85        get => $this->bemerkung ?: '';
86    }
87
88    #[ORM\Column(name: 'bemerkungzeigen', type: Types::BOOLEAN, length: 1, nullable: true)]
89    public ?bool $bemerkungzeigen = null;
90
91    #[ORM\Column(name: 'bic', type: Types::STRING, length: 11, nullable: true)]
92    public ?string $bic = null;
93
94    #[ORM\Column(name: 'bild', type: 'blob_base64', nullable: true)]
95    #[Assert\DisableAutoMapping]
96    public ?string $bild = null;
97
98    #[ORM\Column(name: 'bildanzeige', type: Types::INTEGER, nullable: true)]
99    public ?int $bildanzeige = null;
100
101    #[ORM\Column(name: 'blz', type: Types::STRING, length: 9, nullable: true)]
102    public ?string $blz = null;
103
104    #[ORM\Column(name: 'briefanrede', type: Types::STRING, length: 45, nullable: true)]
105    public ?string $briefanrede = null;
106
107    #[ORM\Column(name: 'ebaykunde', type: Types::BOOLEAN, length: 1, nullable: true)]
108    public ?bool $ebaykunde = null;
109
110    #[ORM\Column(name: 'ebayusername', type: Types::STRING, length: 64, nullable: true)]
111    public ?string $ebayusername = null;
112
113    #[ORM\Column(name: 'eigenekdnr', type: Types::STRING, length: 12, nullable: true)]
114    public ?string $eigenekdnr = null;
115
116    #[ORM\Column(name: 'email', type: Types::STRING, length: 80, nullable: true)]
117    public ?string $email = null;
118
119    #[ORM\Column(name: 'fax', type: Types::STRING, length: 30, nullable: true)]
120    public ?string $fax = null;
121
122    #[ORM\Column(name: 'fixum', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
123    public ?string $fixum = null;
124
125    #[ORM\Column(name: 'freifeld1', type: Types::STRING, length: 255, nullable: true)]
126    public ?string $freifeld1 = null;
127
128    #[ORM\Column(name: 'freifeld10', type: Types::STRING, length: 255, nullable: true)]
129    public ?string $freifeld10 = null;
130
131    #[ORM\Column(name: 'freifeld11', type: Types::STRING, length: 255, nullable: true)]
132    public ?string $freifeld11 = null;
133
134    #[ORM\Column(name: 'freifeld12', type: Types::STRING, length: 255, nullable: true)]
135    public ?string $freifeld12 = null;
136
137    #[ORM\Column(name: 'freifeld13', type: Types::STRING, length: 255, nullable: true)]
138    public ?string $freifeld13 = null {
139        set => $this->freifeld10 = $value;
140    }
141
142    #[ORM\Column(name: 'freifeld14', type: Types::STRING, length: 255, nullable: true)]
143    public ?string $freifeld14 = null;
144
145    #[ORM\Column(name: 'freifeld15', type: Types::STRING, length: 255, nullable: true)]
146    public ?string $freifeld15 = null;
147
148    #[ORM\Column(name: 'freifeld16', type: Types::STRING, length: 255, nullable: true)]
149    public ?string $freifeld16 = null;
150
151    #[ORM\Column(name: 'freifeld17', type: Types::STRING, length: 255, nullable: true)]
152    public ?string $freifeld17 = null;
153
154    #[ORM\Column(name: 'freifeld18', type: Types::STRING, length: 255, nullable: true)]
155    public ?string $freifeld18 = null;
156
157    #[ORM\Column(name: 'freifeld19', type: Types::STRING, length: 255, nullable: true)]
158    public ?string $freifeld19 = null;
159
160    #[ORM\Column(name: 'freifeld2', type: Types::STRING, length: 255, nullable: true)]
161    public ?string $freifeld2 = null;
162
163    #[ORM\Column(name: 'freifeld20', type: Types::STRING, length: 255, nullable: true)]
164    public ?string $freifeld20 = null;
165
166    #[ORM\Column(name: 'freifeld3', type: Types::STRING, length: 255, nullable: true)]
167    public ?string $freifeld3 = null;
168
169    #[ORM\Column(name: 'freifeld4', type: Types::STRING, length: 255, nullable: true)]
170    public ?string $freifeld4 = null;
171
172    #[ORM\Column(name: 'freifeld5', type: Types::STRING, length: 255, nullable: true)]
173    public ?string $freifeld5 = null;
174
175    #[ORM\Column(name: 'freifeld6', type: Types::STRING, length: 255, nullable: true)]
176    public ?string $freifeld6 = null;
177
178    #[ORM\Column(name: 'freifeld7', type: Types::STRING, length: 255, nullable: true)]
179    public ?string $freifeld7 = null;
180
181    #[ORM\Column(name: 'freifeld8', type: Types::STRING, length: 255, nullable: true)]
182    public ?string $freifeld8 = null;
183
184    #[ORM\Column(name: 'freifeld9', type: Types::STRING, length: 255, nullable: true)]
185    public ?string $freifeld9 = null;
186
187    #[ORM\Column(name: 'gebiet', type: Types::STRING, length: 15, nullable: true)]
188    public ?string $gebiet = null;
189
190    #[ORM\Column(name: 'geburtstag', type: Types::DATETIME_IMMUTABLE, nullable: true)]
191    public ?\DateTimeImmutable $geburtstag = null;
192
193    #[ORM\Column(name: 'gehaelteranzahl', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
194    public ?string $gehaelteranzahl = null;
195
196    #[ORM\Column(name: 'gehaltpromonat', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
197    public ?string $gehaltpromonat = null;
198
199    #[ORM\Column(name: 'geloeschtam', type: Types::DATETIME_IMMUTABLE, nullable: true)]
200    public ?\DateTimeImmutable $geloeschtam = null;
201
202    #[ORM\Column(name: 'geloeschtvon', type: Types::STRING, length: 3, nullable: true)]
203    public ?string $geloeschtvon = null;
204
205    #[ORM\Column(name: 'gruppe', type: Types::STRING, length: 80, nullable: true)]
206    public ?string $gruppe = null;
207
208    #[ORM\Column(name: 'iban', type: Types::STRING, length: 34, nullable: true)]
209    public ?string $iban = null;
210
211    /**
212     * Wird der Parameter auf 1 gesetzt, ist der Datensatz ein Interessent.
213     */
214    #[ORM\Column(name: 'interessent', type: Types::INTEGER, nullable: true)]
215    public ?int $interessent = null;
216
217    public bool $isInteressent {
218        get => ($this->interessent ?? 0) > 0;
219        set { $this->interessent = $value ? 1 : 0; }
220    }
221
222    #[ORM\Column(name: 'internet', type: Types::STRING, length: 50, nullable: true)]
223    public ?string $internet = null;
224
225    #[ORM\Column(name: 'kontoinhaber', type: Types::STRING, length: 50, nullable: true)]
226    public ?string $kontoinhaber = null;
227
228    #[ORM\Column(name: 'krankheitstage', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
229    public ?string $krankheitstage = null;
230
231    #[ORM\Column(name: 'kreditlimit', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
232    public ?string $kreditlimit = null;
233
234    #[ORM\Column(name: 'land', type: Types::STRING, length: 3, nullable: true)]
235    public ?string $land = null;
236
237    #[ORM\Column(name: 'letzterechnung', type: Types::DATETIME_IMMUTABLE, nullable: true)]
238    public ?\DateTimeImmutable $letzterechnung = null;
239
240    #[ORM\Column(name: 'letzterkontakt', type: Types::DATETIME_IMMUTABLE, nullable: true)]
241    public ?\DateTimeImmutable $letzterkontakt = null;
242
243    #[ORM\Column(name: 'lfdnr', type: Types::INTEGER, nullable: false)]
244    #[ORM\Id]
245    #[ORM\GeneratedValue(strategy: 'CUSTOM')]
246    #[ORM\CustomIdGenerator(class: IdGeneratorAdresse::class)]
247    public ?int $lfdnr = null;
248
249    #[ORM\Column(name: 'lieferart', type: Types::STRING, length: 25, nullable: true)]
250    public ?string $lieferart = null;
251
252    #[ORM\Column(name: 'lieferzeittage', type: Types::INTEGER, nullable: true)]
253    public ?int $lieferzeittage = null;
254
255    #[ORM\Column(name: 'lieferzeittext', type: Types::STRING, length: 30, nullable: true)]
256    public ?string $lieferzeittext = null;
257
258    #[ORM\Column(name: 'mahnsperre', type: Types::BOOLEAN, length: 1, nullable: true)]
259    public ?bool $mahnsperre = null;
260
261    #[ORM\Column(name: 'mahnsperream', type: Types::DATETIME_IMMUTABLE, nullable: true)]
262    public ?\DateTimeImmutable $mahnsperream = null;
263
264    #[ORM\Column(name: 'mahnsperrevon', type: Types::STRING, length: 3, nullable: true)]
265    public ?string $mahnsperrevon = null;
266
267    #[ORM\Column(name: 'mahntage1', type: Types::INTEGER, nullable: true)]
268    public ?int $mahntage1 = null;
269
270    #[ORM\Column(name: 'mahntage2', type: Types::INTEGER, nullable: true)]
271    public ?int $mahntage2 = null;
272
273    #[ORM\Column(name: 'mahntage3', type: Types::INTEGER, nullable: true)]
274    public ?int $mahntage3 = null;
275
276    #[ORM\Column(name: 'mahntage4', type: Types::INTEGER, nullable: true)]
277    public ?int $mahntage4 = null;
278
279    #[ORM\Column(name: 'mark', type: Types::BOOLEAN, length: 1, nullable: true)]
280    public ?bool $mark = null;
281
282    #[ORM\Column(name: 'mindermengenzuschlag', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
283    public ?string $mindermengenzuschlag = null;
284
285    #[ORM\Column(name: 'mindestbestellwert', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
286    public ?string $mindestbestellwert = null;
287
288    #[ORM\Column(name: 'name', type: Types::STRING, length: 40, nullable: true)]
289    public ?string $name = null;
290
291    #[ORM\Column(name: 'name2', type: Types::STRING, length: 100, nullable: true)]
292    public ?string $name2 = null;
293
294    #[ORM\Column(name: 'name3', type: Types::STRING, length: 100, nullable: true)]
295    public ?string $name3 = null;
296
297    /**
298     * Kunde-, Lieferant oder Mitarbeiternummer. Diese Nummer muss eindeutig sein.
299     * Die Kundennummer darf maximal 8-stellig sein und kann beliebige Zeichen enthalten.
300     * Wenn die Nummer nummerisch ist, wird sie beim Import automatisch rechtsbündig formatiert.
301     * Wenn Sie Nummern importieren, die rechtsbündig in einem Zeichenfeld gespeichert sind,
302     * das länger ist als 8 Zeichen ist, müssen Sie beim Import führende Leerzeichen entfernen,
303     * indem Sie beim Feld Nr die Formel Trim verwenden. Beispiel: Trim(Importfeld).
304     */
305    #[ORM\Column(name: 'nr', type: Types::STRING, length: 8, nullable: false)]
306    public string $nr = '' {
307        set => $this->nr = self::padNr($value);
308    }
309
310    #[ORM\Column(name: 'nrkto', type: Types::STRING, length: 8, nullable: true)]
311    public ?string $nrkto = null;
312
313    #[ORM\Column(name: 'ort', type: Types::STRING, length: 40, nullable: true)]
314    public ?string $ort = null;
315
316    #[ORM\Column(name: 'plz', type: Types::STRING, length: 9, nullable: true)]
317    public ?string $plz = null;
318
319    #[ORM\ManyToOne(targetEntity: Preisgruppe::class, cascade: ['persist'])]
320    #[ORM\JoinColumn(name: 'preisgruppenlfdnr', referencedColumnName: 'lfdnr')]
321    public ?Preisgruppe $preisgruppe = null;
322
323    /**
324     * Faktura 13.
325     */
326    #[ORM\Column(name: 'preisgruppe', type: Types::STRING, length: 1, nullable: true)]
327    public ?string $preisgruppe1bis8 = null;
328
329    #[ORM\ManyToOne(targetEntity: Benutzergruppe::class, cascade: ['persist'])]
330    #[ORM\JoinColumn(name: 'privatbenutzergruppelfdnr', referencedColumnName: 'lfdnr')]
331    public ?Benutzergruppe $privatbenutzergruppe = null;
332
333    #[ORM\ManyToOne(targetEntity: Benutzer::class, cascade: ['persist'])]
334    #[ORM\JoinColumn(name: 'privatfuer', referencedColumnName: 'lfdnr')]
335    public ?Benutzer $privatfuer = null;
336
337    #[ORM\Column(name: 'privatmodus', type: Types::INTEGER, nullable: true)]
338    #[Assert\Choice([null, 1, 2, 3], message: 'Sichtbar für null = alle, 1 = Inhaber $this->privatfuer, 2 = $this->privatbenutzergruppe, 3 = Benutzerliste')]
339    public ?int $privatmodus = null;
340
341    #[ORM\Column(name: 'provision', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
342    public ?string $provision = null;
343
344    #[ORM\Column(name: 'provisionsbasis', type: Types::STRING, length: 1, nullable: true)]
345    #[Assert\Choice(['U', 'E'], message: '(U)msatz, (E)rtrag')]
346    public ?string $provisionsbasis = null;
347
348    #[ORM\Column(name: 'rabatt', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
349    public ?string $rabattProzent = null;
350
351    #[ORM\Column(name: 'rabattgr1', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
352    public protected(set) ?string $rabattgr1 = null;
353
354    #[ORM\Column(name: 'rabattgr10', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
355    public protected(set) ?string $rabattgr10 = null;
356
357    #[ORM\Column(name: 'rabattgr2', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
358    public protected(set) ?string $rabattgr2 = null;
359
360    #[ORM\Column(name: 'rabattgr3', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
361    public protected(set) ?string $rabattgr3 = null;
362
363    #[ORM\Column(name: 'rabattgr4', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
364    public protected(set) ?string $rabattgr4 = null;
365
366    #[ORM\Column(name: 'rabattgr5', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
367    public protected(set) ?string $rabattgr5 = null;
368
369    #[ORM\Column(name: 'rabattgr6', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
370    public protected(set) ?string $rabattgr6 = null;
371
372    #[ORM\Column(name: 'rabattgr7', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
373    public protected(set) ?string $rabattgr7 = null;
374
375    #[ORM\Column(name: 'rabattgr8', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
376    public protected(set) ?string $rabattgr8 = null;
377
378    #[ORM\Column(name: 'rabattgr9', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
379    public protected(set) ?string $rabattgr9 = null;
380
381    #[ORM\Column(name: 'rabattgruppe', type: Types::STRING, length: 20, nullable: true)]
382    public ?string $rabattgruppe = null;
383
384    #[ORM\Column(name: 'sepadatumunterschrift', type: Types::DATETIME_IMMUTABLE, nullable: true)]
385    public ?\DateTimeImmutable $sepadatumunterschrift = null;
386
387    #[ORM\Column(name: 'sepamandatreferenz', type: Types::STRING, length: 35, nullable: true)]
388    public ?string $sepamandatreferenz = null;
389
390    #[ORM\Column(name: 'serienbriefletzter', type: Types::DATETIME_IMMUTABLE, nullable: true)]
391    public ?\DateTimeImmutable $serienbriefletzter = null;
392
393    #[ORM\Column(name: 'serienbriefsperre', type: Types::BOOLEAN, length: 1, nullable: true)]
394    protected ?bool $serienbriefsperre = null;
395
396    #[ORM\Column(name: 'serienbriefsperream', type: Types::DATETIME_IMMUTABLE, nullable: true)]
397    public ?\DateTimeImmutable $serienbriefsperream = null;
398
399    #[ORM\Column(name: 'serienbriefsperrevon', type: Types::STRING, length: 3, nullable: true)]
400    public ?string $serienbriefsperrevon = null;
401
402    #[ORM\Column(name: 'serienemailletzte', type: Types::DATETIME_IMMUTABLE, nullable: true)]
403    public ?\DateTimeImmutable $serienemailletzte = null;
404
405    #[ORM\Column(name: 'serienemailsperre', type: Types::BOOLEAN, length: 1, nullable: true)]
406    public ?bool $serienemailsperre = null;
407
408    #[ORM\Column(name: 'serienemailsperream', type: Types::DATETIME_IMMUTABLE, nullable: true)]
409    public ?\DateTimeImmutable $serienemailsperream = null;
410
411    #[ORM\Column(name: 'serienemailsperrevon', type: Types::STRING, length: 3, nullable: true)]
412    public ?string $serienemailsperrevon = null;
413
414    #[ORM\Column(name: 'shopkunde', type: Types::BOOLEAN, length: 1, nullable: true)]
415    public ?bool $shopkunde = null;
416
417    #[ORM\Column(name: 'shopusername', type: Types::STRING, length: 64, nullable: true)]
418    public ?string $shopusername = null;
419
420    #[ORM\Column(name: 'skonto', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
421    public ?string $skontoProzent = null;
422
423    #[ORM\Column(name: 'skontotage', type: Types::INTEGER, nullable: true)]
424    public ?int $skontotage = null;
425
426    #[ORM\Column(name: 'skypeusername', type: Types::STRING, length: 64, nullable: true)]
427    public ?string $skypeusername = null;
428
429    #[ORM\Column(name: 'steuerausweisen', type: Types::BOOLEAN, length: 1, nullable: true)]
430    public ?bool $steuerausweisen = null;
431
432    #[ORM\Column(name: 'steuerinkl', type: Types::STRING, length: 1, nullable: true)]
433    #[Assert\Choice(['J', 'N', '0'], message: '(J)a, (N)ein oder (0)Keine Steuer')]
434    public ?string $steuerinkl = null;
435
436    #[ORM\Column(name: 'steuernummer', type: Types::STRING, length: 20, nullable: true)]
437    public ?string $steuernummer = null;
438
439    #[ORM\Column(name: 'strasse', type: Types::STRING, length: 40, nullable: true)]
440    public ?string $strasse = null;
441
442    #[ORM\Column(name: 'stundenlohn', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
443    public ?string $stundenlohn = null;
444
445    #[ORM\Column(name: 'suchbegriff', type: Types::STRING, length: 40, nullable: true)]
446    public ?string $suchbegriff = null;
447
448    #[ORM\Column(name: 'telefon1', type: Types::STRING, length: 30, nullable: true)]
449    public ?string $telefon1 = null;
450
451    #[ORM\Column(name: 'telefon2', type: Types::STRING, length: 30, nullable: true)]
452    public ?string $telefon2 = null;
453
454    #[ORM\Column(name: 'telefon3', type: Types::STRING, length: 30, nullable: true)]
455    public ?string $telefon3 = null;
456
457    #[ORM\Column(name: 'telefonakquisesperre', type: Types::BOOLEAN, length: 1, nullable: true)]
458    public ?bool $telefonakquisesperre = null;
459
460    #[ORM\Column(name: 'telefonakquisesperream', type: Types::DATETIME_IMMUTABLE, nullable: true)]
461    public ?\DateTimeImmutable $telefonakquisesperream = null;
462
463    #[ORM\Column(name: 'telefonakquisesperrevon', type: Types::STRING, length: 3, nullable: true)]
464    public ?string $telefonakquisesperrevon = null;
465
466    #[ORM\Column(name: 'telefonmatchcode', type: Types::STRING, length: 85, nullable: true)]
467    public ?string $telefonmatchcode = null;
468
469    /**
470     * @var Collection<int, TerminAufgabeAdresse>
471     */
472    #[ORM\OneToMany(mappedBy: 'adresse', targetEntity: TerminAufgabeAdresse::class, cascade: ['persist'], fetch: 'EXTRA_LAZY', orphanRemoval: true)]
473    protected Collection $terminAdressen;
474
475    /**
476     * @var Collection<int, AdressgruppeAdresse>
477     */
478    #[ORM\OneToMany(mappedBy: 'adresse', targetEntity: AdressgruppeAdresse::class, cascade: ['persist'], orphanRemoval: true)]
479    protected Collection $adressgruppenAdressen;
480
481    #[ORM\Column(name: 'titel', type: Types::STRING, length: 20, nullable: true)]
482    public ?string $titel = null;
483
484    #[ORM\Column(name: 'umsatz', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
485    public ?string $umsatz = null;
486
487    #[ORM\Column(name: 'urlaubstageist', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
488    public ?string $urlaubstageist = null;
489
490    #[ORM\Column(name: 'urlaubstagesoll', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
491    public ?string $urlaubstagesoll = null;
492
493    #[ORM\Column(name: 'ustidnr', type: Types::STRING, length: 15, nullable: true)]
494    public ?string $ustidnr = null;
495
496    #[ORM\Column(name: 'ustidnrprotokoll', type: Types::TEXT, nullable: true)]
497    public ?string $ustidnrprotokoll = null;
498
499    #[ORM\ManyToOne(targetEntity: Adresse::class, cascade: ['persist'])]
500    #[ORM\JoinColumn(name: 'vertreterlfdnr', referencedColumnName: 'lfdnr')]
501    public ?Adresse $vertreter = null;
502
503    #[ORM\Column(name: 'vorname', type: Types::STRING, length: 30, nullable: true)]
504    public ?string $vorname = null;
505
506    #[ORM\Column(name: 'waehrung', type: Types::STRING, length: 3, nullable: true)]
507    public ?string $waehrung = null;
508
509    #[ORM\Column(name: 'wochenstunden', type: 'amicron_decimal', precision: 15, scale: 6, nullable: true)]
510    public ?string $wochenstunden = null;
511
512    #[ORM\Column(name: 'xing', type: Types::STRING, length: 60, nullable: true)]
513    public ?string $xing = null;
514
515    #[ORM\Column(name: 'zahlbedingungen', type: Types::TEXT, nullable: true)]
516    public ?string $zahlbedingungen = null;
517
518    #[ORM\Column(name: 'zahlungin', type: Types::INTEGER, nullable: true)]
519    public ?int $zahlungin = null;
520
521    #[ORM\Column(name: 'zahlweise', type: Types::STRING, length: 25, nullable: true)]
522    public ?string $zahlweise = null;
523
524    #[ORM\Column(name: 'gln', type: Types::STRING, length: 13, nullable: true)]
525    public ?string $gln = null;
526
527    #[ORM\Column(name: 'seit', type: Types::DATETIME_IMMUTABLE, nullable: true)]
528    public ?\DateTimeImmutable $seit = null;
529
530    #[ORM\ManyToOne(targetEntity: Adresse::class, cascade: ['persist'])]
531    #[ORM\JoinColumn(name: 'lfdnrzweitadresse', referencedColumnName: 'lfdnr')]
532    public ?Adresse $zweitadresse = null;
533
534    public function __construct(
535    ) {
536        $this->terminAdressen = new ArrayCollection();
537        $this->adressgruppenAdressen = new ArrayCollection();
538    }
539
540    /**
541     * @return Collection<int, TerminAufgabeAdresse>
542     */
543    public function getTerminAdressen(): Collection
544    {
545        return $this->terminAdressen;
546    }
547
548    public function addTermin(Termin $termin): self
549    {
550        foreach ($this->terminAdressen as $terminAdresse) {
551            if ($terminAdresse->getTermin() === $termin) {
552                return $this;
553            }
554        }
555        $terminAdresse = new TerminAufgabeAdresse();
556
557        $terminAdresse
558            ->setAdresse($this)
559            ->setTermin($termin);
560        $this->addTerminAdresse($terminAdresse);
561
562        return $this;
563    }
564
565    public function addTerminAdresse(TerminAufgabeAdresse $terminAdresse): void
566    {
567        if ($this->terminAdressen->contains($terminAdresse)) {
568            return;
569        }
570
571        $this->terminAdressen->add($terminAdresse);
572        // needed to update the owning side of the relationship!
573        $terminAdresse->setAdresse($this);
574        $terminAdresse->getTermin()?->addTerminAdresse($terminAdresse);
575    }
576
577    abstract public function getArt(): string;
578
579    public function setArt(string $art): self
580    {
581        $this->art = $art;
582
583        return $this;
584    }
585
586    public function getBemerkung(): string
587    {
588        return $this->bemerkung ?: '';
589    }
590
591    public function setBemerkung(?string $bemerkung): self
592    {
593        $this->bemerkung = $bemerkung;
594
595        return $this;
596    }
597
598    public function getFreifeld13(): ?string
599    {
600        return $this->freifeld13;
601    }
602
603    public function setFreifeld13(?string $freifeld13): self
604    {
605        $this->freifeld13 = $freifeld13;
606
607        return $this;
608    }
609
610    public function getNr(): string
611    {
612        return trim((string) $this->nr);
613    }
614
615    public function setNr(?string $nr): self
616    {
617        $this->nr = self::padNr($nr);
618
619        return $this;
620    }
621
622    public static function padNr(?string $nr): string
623    {
624        return Pad::number($nr, 8) ?? '';
625    }
626
627    /**
628     * @todo Determine the different types for Provisionsbasis (i.e. U = Umsatz?)
629     */
630    public function getRabattgruppe1Prozent(): ?string
631    {
632        return $this->rabattgr1;
633    }
634
635    public function setRabattgruppe1Prozent(?string $rabatt): self
636    {
637        $this->rabattgr1 = $rabatt;
638
639        return $this;
640    }
641
642    public function getRabattgruppe10Prozent(): ?string
643    {
644        return $this->rabattgr10;
645    }
646
647    public function setRabattgruppe10Prozent(?string $rabatt): self
648    {
649        $this->rabattgr10 = $rabatt;
650
651        return $this;
652    }
653
654    public function getRabattgruppe2Prozent(): ?string
655    {
656        return $this->rabattgr2;
657    }
658
659    public function setRabattgruppe2Prozent(?string $rabatt): self
660    {
661        $this->rabattgr2 = $rabatt;
662
663        return $this;
664    }
665
666    public function getRabattgruppe3Prozent(): ?string
667    {
668        return $this->rabattgr3;
669    }
670
671    public function setRabattgruppe3Prozent(?string $rabatt): self
672    {
673        $this->rabattgr3 = $rabatt;
674
675        return $this;
676    }
677
678    public function getRabattgruppe4Prozent(): ?string
679    {
680        return $this->rabattgr4;
681    }
682
683    public function setRabattgruppe4Prozent(?string $rabatt): self
684    {
685        $this->rabattgr4 = $rabatt;
686
687        return $this;
688    }
689
690    public function getRabattgruppe5Prozent(): ?string
691    {
692        return $this->rabattgr5;
693    }
694
695    public function setRabattgruppe5Prozent(?string $rabatt): self
696    {
697        $this->rabattgr5 = $rabatt;
698
699        return $this;
700    }
701
702    public function getRabattgruppe6Prozent(): ?string
703    {
704        return $this->rabattgr6;
705    }
706
707    public function setRabattgruppe6Prozent(?string $rabatt): self
708    {
709        $this->rabattgr6 = $rabatt;
710
711        return $this;
712    }
713
714    public function getRabattgruppe7Prozent(): ?string
715    {
716        return $this->rabattgr7;
717    }
718
719    public function setRabattgruppe7Prozent(?string $rabatt): self
720    {
721        $this->rabattgr7 = $rabatt;
722
723        return $this;
724    }
725
726    public function getRabattgruppe8Prozent(): ?string
727    {
728        return $this->rabattgr8;
729    }
730
731    public function setRabattgruppe8Prozent(?string $rabatt): self
732    {
733        $this->rabattgr8 = $rabatt;
734
735        return $this;
736    }
737
738    public function getRabattgruppe9Prozent(): ?string
739    {
740        return $this->rabattgr9;
741    }
742
743    public function setRabattgruppe9Prozent(?string $rabatt): self
744    {
745        $this->rabattgr9 = $rabatt;
746
747        return $this;
748    }
749
750    /**
751     * @return Collection<int, Termin>
752     */
753    public function getTermine(): Collection
754    {
755        $termine = new ArrayCollection();
756        foreach ($this->terminAdressen as $terminAdresse) {
757            $termine->add($terminAdresse->getTermin());
758        }
759
760        return $termine;
761    }
762
763    public function isInteressent(): ?bool
764    {
765        return $this->interessent > 0;
766    }
767
768    public function isSerienbriefsperre(): bool
769    {
770        return (bool) $this->serienbriefsperre;
771    }
772
773    public function removeTermin(Termin $termin): self
774    {
775        foreach ($this->terminAdressen as $terminAdresse) {
776            if ($terminAdresse->getTermin() === $termin) {
777                $this->removeTerminAdresse($terminAdresse);
778
779                return $this;
780            }
781        }
782
783        return $this;
784    }
785
786    public function removeTerminAdresse(TerminAufgabeAdresse $terminAdresse): void
787    {
788        if (!$this->terminAdressen->contains($terminAdresse)) {
789            return;
790        }
791        $this->terminAdressen->removeElement($terminAdresse);
792        // needed to update the owning side of the relationship!
793        $terminAdresse->getTermin()?->removeTerminAdresse($terminAdresse);
794        $terminAdresse->setAdresse(null);
795    }
796
797    public function setInteressent(?bool $interessent): self
798    {
799        $this->interessent = $interessent ? 1 : 0;
800
801        return $this;
802    }
803
804    public function setSerienbriefsperre(?bool $serienbriefsperre): self
805    {
806        $this->serienbriefsperre = $serienbriefsperre;
807
808        return $this;
809    }
810
811    public function addAdressgruppe(Adressgruppe $adressgruppe): void
812    {
813        foreach ($this->adressgruppenAdressen as $adressgruppeAdresse) {
814            if ($adressgruppeAdresse->getAdressgruppe() === $adressgruppe) {
815                return;
816            }
817        }
818
819        $this->addAdressgruppeAdresse(new AdressgruppeAdresse($adressgruppe, $this));
820    }
821
822    public function removeAdressgruppe(Adressgruppe $adressgruppe): void
823    {
824        foreach ($this->adressgruppenAdressen as $adressguppeAdresse) {
825            if ($adressguppeAdresse->getAdressgruppe() === $adressgruppe) {
826                $this->removeAdressgruppeAdresse($adressguppeAdresse);
827
828                return;
829            }
830        }
831    }
832
833    public function addAdressgruppeAdresse(AdressgruppeAdresse $adressgruppeAdresse): void
834    {
835        if ($this->adressgruppenAdressen->contains($adressgruppeAdresse)) {
836            return;
837        }
838
839        $this->adressgruppenAdressen->add($adressgruppeAdresse);
840        $adressgruppeAdresse->getAdresse()?->addAdressgruppeAdresse($adressgruppeAdresse);
841    }
842
843    public function removeAdressgruppeAdresse(AdressgruppeAdresse $adressguppeAdresse): void
844    {
845        if (!$this->adressgruppenAdressen->contains($adressguppeAdresse)) {
846            return;
847        }
848
849        $adressguppeAdresse->getAdressgruppe()?->removeAdressgruppeAdresse($adressguppeAdresse);
850        $this->adressgruppenAdressen->removeElement($adressguppeAdresse);
851        $adressguppeAdresse->setAdresse(null);
852    }
853
854    /**
855     * @return Collection<int, Adressgruppe>
856     */
857    public function getAdressgruppen(): Collection
858    {
859        $adressgruppen = new ArrayCollection();
860        foreach ($this->adressgruppenAdressen as $adressgruppeAdresse) {
861            $adressgruppen->add($adressgruppeAdresse->getAdressgruppe());
862        }
863
864        return $adressgruppen;
865    }
866
867    public function getLfdnr(): ?int
868    {
869        return $this->lfdnr;
870    }
871}