Completed
Pull Request — master (#38)
by
unknown
02:58
created

Request::setMembershipFee()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace WMDE\Fundraising\Entities;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * @since 0.1
9
 *
10
 * @ORM\Table(name="request", indexes={@ORM\Index(name="idx_donation_id", columns={"donation_id"})})
11
 * @ORM\Entity
12
 */
13
class Request {
14
	/**
15
	 * @var integer
16
	 *
17
	 * @ORM\Column(name="donation_id", type="integer", nullable=true)
18
	 */
19
	private $donationId;
20
21
	/**
22
	 * @var \DateTime
23
	 *
24
	 * @ORM\Column(name="timestamp", type="datetime", nullable=false)
25
	 */
26
	private $timestamp;
27
28
	/**
29
	 * @var string
30
	 *
31
	 * @ORM\Column(name="anrede", type="string", length=16, nullable=true)
32
	 */
33
	private $anrede;
34
35
	/**
36
	 * @var string
37
	 *
38
	 * @ORM\Column(name="firma", type="string", length=100, nullable=true)
39
	 */
40
	private $firma;
41
42
	/**
43
	 * @var string
44
	 *
45
	 * @ORM\Column(name="titel", type="string", length=16, nullable=true)
46
	 */
47
	private $titel;
48
49
	/**
50
	 * @var string
51
	 *
52
	 * @ORM\Column(name="name", type="string", length=250, options={"default":""}, nullable=false)
53
	 */
54
	private $name = '';
55
56
	/**
57
	 * @var string
58
	 *
59
	 * @ORM\Column(name="vorname", type="string", length=50, options={"default":""}, nullable=false)
60
	 */
61
	private $vorname = '';
62
63
	/**
64
	 * @var string
65
	 *
66
	 * @ORM\Column(name="nachname", type="string", length=50, options={"default":""}, nullable=false)
67
	 */
68
	private $nachname = '';
69
70
	/**
71
	 * @var string
72
	 *
73
	 * @ORM\Column(name="strasse", type="string", length=100, nullable=true)
74
	 */
75
	private $strasse;
76
77
	/**
78
	 * @var string
79
	 *
80
	 * @ORM\Column(name="plz", type="string", length=8, nullable=true)
81
	 */
82
	private $plz;
83
84
	/**
85
	 * @var string
86
	 *
87
	 * @ORM\Column(name="ort", type="string", length=100, nullable=true)
88
	 */
89
	private $ort;
90
91
	/**
92
	 * @var string
93
	 *
94
	 * @ORM\Column(name="email", type="string", length=250, options={"default":""}, nullable=false)
95
	 */
96
	private $email = '';
97
98
	/**
99
	 * @var string
100
	 *
101
	 * @ORM\Column(name="phone", type="string", length=30, options={"default":""}, nullable=false)
102
	 */
103
	private $phone = '';
104
105
	/**
106
	 * @var \DateTime
107
	 *
108
	 * @ORM\Column(name="dob", type="date", nullable=true)
109
	 */
110
	private $dob;
111
112
	/**
113
	 * @var string
114
	 *
115
	 * @ORM\Column(name="wikimedium_shipping", type="string", options={"default":""}, nullable=false)
116
	 */
117
	private $wikimediumShipping = 'none';
118
119
	/**
120
	 * @var string
121
	 *
122
	 * @ORM\Column(name="membership_type", type="string", options={"default":"sustaining"}, nullable=false)
123
	 */
124
	private $membershipType = 'sustaining';
125
126
	/**
127
	 * @var integer
128
	 *
129
	 * @ORM\Column(name="membership_fee", type="integer", options={"default":0}, nullable=false)
130
	 */
131
	private $membershipFee = 0;
132
133
	/**
134
	 * @var integer
135
	 *
136
	 * @ORM\Column(name="membership_fee_interval", type="smallint", options={"default":12}, nullable=true)
137
	 */
138
139
	private $membershipFeeInterval = 12;
140
141
	/**
142
	 * @var string
143
	 *
144
	 * @ORM\Column(name="account_number", type="string", length=16, options={"default":""}, nullable=false)
145
	 */
146
	private $accountNumber = '';
147
148
	/**
149
	 * @var string
150
	 *
151
	 * @ORM\Column(name="bank_name", type="string", length=50, options={"default":""}, nullable=false)
152
	 */
153
	private $bankName = '';
154
155
	/**
156
	 * @var string
157
	 *
158
	 * @ORM\Column(name="bank_code", type="string", length=16, options={"default":""}, nullable=false)
159
	 */
160
	private $bankCode = '';
161
162
	/**
163
	 * @var string
164
	 *
165
	 * @ORM\Column(name="iban", type="string", length=32, options={"default":""}, nullable=true)
166
	 */
167
	private $iban = '';
168
169
	/**
170
	 * @var string
171
	 *
172
	 * @ORM\Column(name="bic", type="string", length=32, options={"default":""}, nullable=true)
173
	 */
174
	private $bic = '';
175
176
	/**
177
	 * @var string
178
	 *
179
	 * @ORM\Column(name="account_holder", type="string", length=50, options={"default":""}, nullable=false)
180
	 */
181
	private $accountHolder = '';
182
183
	/**
184
	 * @var string
185
	 *
186
	 * @ORM\Column(name="comment", type="text", options={"default":""}, nullable=false)
187
	 */
188
	private $comment = '';
189
190
	/**
191
	 * @var \DateTime
192
	 *
193
	 * @ORM\Column(name="export", type="datetime", nullable=true)
194
	 */
195
	private $export;
196
197
	/**
198
	 * @var \DateTime
199
	 *
200
	 * @ORM\Column(name="backup", type="datetime", nullable=true)
201
	 */
202
	private $backup;
203
204
	/**
205
	 * @var boolean
206
	 *
207
	 * @ORM\Column(name="wikilogin", type="boolean", options={"default":0}, nullable=false)
208
	 */
209
	private $wikilogin = 0;
210
211
	/**
212
	 * @var string
213
	 *
214
	 * @ORM\Column(name="tracking", type="string", length=50, nullable=true)
215
	 */
216
	private $tracking;
217
218
	/**
219
	 * @var integer
220
	 *
221
	 * @ORM\Column(name="status", type="smallint", options={"default":0}, nullable=true)
222
	 */
223
	private $status = 0;
224
225
	/**
226
	 * @var string
227
	 *
228
	 * @ORM\Column(name="country", type="string", length=8, options={"default":""}, nullable=true)
229
	 */
230
	private $country = '';
231
232
	/**
233
	 * @var string
234
	 *
235
	 * @ORM\Column(name="data", type="text", nullable=true)
236
	 */
237
	private $data;
238
239
	/**
240
	 * @var string
241
	 *
242
	 * @ORM\Column(name="guid", type="blob", length=16, nullable=true)
243
	 */
244
	private $guid;
245
246
	/**
247
	 * @var string
248
	 *
249
	 * @ORM\Column(name="type", type="string", options={"default":"membership"}, nullable=false)
250
	 */
251
	private $type = 'membership';
252
253
	/**
254
	 * @var integer
255
	 *
256
	 * @ORM\Column(name="id", type="integer")
257
	 * @ORM\Id
258
	 * @ORM\GeneratedValue(strategy="IDENTITY")
259
	 */
260
	private $id;
261
262
	const STATUS_CONFIRMED = 1;
263
	const STATUS_NEUTRAL = 0;
264
	const STATUS_DELETED = -1;
265
	const STATUS_MODERATION = -2;
266
	const STATUS_ABORTED = -4;
267
	const STATUS_CANCELED = -8;
268
269
	const TYPE_MEMBERSHIP = 'membership';
270
	const TYPE_SUBSCRIPTION = 'subscription';
271
	const TYPE_OTHER = 'other';
272
273
	public function __construct() {
274
		$this->setTimestamp( new \DateTime( '1970-01-01 00:00:00' ) );
275
	}
276
277
278
	/**
279
	 * Set donationId
280
	 *
281
	 * @param integer $donationId
282
	 * @return Request
283
	 */
284
	public function setDonationId( $donationId ) {
285
		$this->donationId = $donationId;
286
287
		return $this;
288
	}
289
290
	/**
291
	 * Get donationId
292
	 *
293
	 * @return integer
294
	 */
295
	public function getDonationId() {
296
		return $this->donationId;
297
	}
298
299
	/**
300
	 * Set timestamp
301
	 *
302
	 * @param \DateTime $timestamp
303
	 * @return Request
304
	 */
305
	public function setTimestamp( $timestamp ) {
306
		$this->timestamp = $timestamp;
307
308
		return $this;
309
	}
310
311
	/**
312
	 * Get timestamp
313
	 *
314
	 * @return \DateTime
315
	 */
316
	public function getTimestamp() {
317
		return $this->timestamp;
318
	}
319
320
	/**
321
	 * Set anrede
322
	 *
323
	 * @param string $anrede
324
	 * @return Request
325
	 */
326
	public function setAnrede( $anrede ) {
327
		$this->anrede = $anrede;
328
329
		return $this;
330
	}
331
332
	/**
333
	 * Get anrede
334
	 *
335
	 * @return string
336
	 */
337
	public function getAnrede() {
338
		return $this->anrede;
339
	}
340
341
	/**
342
	 * Set firma
343
	 *
344
	 * @param string $firma
345
	 * @return Request
346
	 */
347
	public function setFirma( $firma ) {
348
		$this->firma = $firma;
349
350
		return $this;
351
	}
352
353
	/**
354
	 * Get firma
355
	 *
356
	 * @return string
357
	 */
358
	public function getFirma() {
359
		return $this->firma;
360
	}
361
362
	/**
363
	 * Set titel
364
	 *
365
	 * @param string $titel
366
	 * @return Request
367
	 */
368
	public function setTitel( $titel ) {
369
		$this->titel = $titel;
370
371
		return $this;
372
	}
373
374
	/**
375
	 * Get titel
376
	 *
377
	 * @return string
378
	 */
379
	public function getTitel() {
380
		return $this->titel;
381
	}
382
383
	/**
384
	 * Set name
385
	 *
386
	 * @param string $name
387
	 * @return Request
388
	 */
389
	public function setName( $name ) {
390
		$this->name = $name;
391
392
		return $this;
393
	}
394
395
	/**
396
	 * Get name
397
	 *
398
	 * @return string
399
	 */
400
	public function getName() {
401
		return $this->name;
402
	}
403
404
	/**
405
	 * Set vorname
406
	 *
407
	 * @param string $vorname
408
	 * @return Request
409
	 */
410
	public function setVorname( $vorname ) {
411
		$this->vorname = $vorname;
412
		$this->setNameFromParts( $vorname, $this->getNachname() );
413
414
		return $this;
415
	}
416
417
	/**
418
	 * Get vorname
419
	 *
420
	 * @return string
421
	 */
422
	public function getVorname() {
423
		return $this->vorname;
424
	}
425
426
	/**
427
	 * Set nachname
428
	 *
429
	 * @param string $nachname
430
	 * @return Request
431
	 */
432
	public function setNachname( $nachname ) {
433
		$this->nachname = $nachname;
434
		$this->setNameFromParts( $this->getVorname(), $nachname );
435
436
		return $this;
437
	}
438
439
	/**
440
	 * Get nachname
441
	 *
442
	 * @return string
443
	 */
444
	public function getNachname() {
445
		return $this->nachname;
446
	}
447
448
	/**
449
	 * Sets the full name
450
	 */
451
	public function setNameFromParts( $vorname, $nachname) {
452
		$parts = array_filter( [ $vorname, $nachname ] );
453
		$this->setName( implode( ' ', $parts ) );
454
455
		return $this;
456
	}
457
458
	/**
459
	 * Set strasse
460
	 *
461
	 * @param string $strasse
462
	 * @return Request
463
	 */
464
	public function setStrasse( $strasse ) {
465
		$this->strasse = $strasse;
466
467
		return $this;
468
	}
469
470
	/**
471
	 * Get strasse
472
	 *
473
	 * @return string
474
	 */
475
	public function getStrasse() {
476
		return $this->strasse;
477
	}
478
479
	/**
480
	 * Set plz
481
	 *
482
	 * @param string $plz
483
	 * @return Request
484
	 */
485
	public function setPlz( $plz ) {
486
		$this->plz = $plz;
487
488
		return $this;
489
	}
490
491
	/**
492
	 * Get plz
493
	 *
494
	 * @return string
495
	 */
496
	public function getPlz() {
497
		return $this->plz;
498
	}
499
500
	/**
501
	 * Set ort
502
	 *
503
	 * @param string $ort
504
	 * @return Request
505
	 */
506
	public function setOrt( $ort ) {
507
		$this->ort = $ort;
508
509
		return $this;
510
	}
511
512
	/**
513
	 * Get ort
514
	 *
515
	 * @return string
516
	 */
517
	public function getOrt() {
518
		return $this->ort;
519
	}
520
521
	/**
522
	 * Set email
523
	 *
524
	 * @param string $email
525
	 * @return Request
526
	 */
527
	public function setEmail( $email ) {
528
		$this->email = $email;
529
530
		return $this;
531
	}
532
533
	/**
534
	 * Get email
535
	 *
536
	 * @return string
537
	 */
538
	public function getEmail() {
539
		return $this->email;
540
	}
541
542
	/**
543
	 * Set phone
544
	 *
545
	 * @param string $phone
546
	 * @return Request
547
	 */
548
	public function setPhone( $phone ) {
549
		$this->phone = $phone;
550
551
		return $this;
552
	}
553
554
	/**
555
	 * Get phone
556
	 *
557
	 * @return string
558
	 */
559
	public function getPhone() {
560
		return $this->phone;
561
	}
562
563
	/**
564
	 * Set dob
565
	 *
566
	 * @param \DateTime $dob
567
	 * @return Request
568
	 */
569
	public function setDob( $dob ) {
570
		$this->dob = $dob;
571
572
		return $this;
573
	}
574
575
	/**
576
	 * Get dob
577
	 *
578
	 * @return \DateTime
579
	 */
580
	public function getDob() {
581
		return $this->dob;
582
	}
583
584
	/**
585
	 * Set wikimediumShipping
586
	 *
587
	 * @param string $wikimediumShipping
588
	 * @return Request
589
	 */
590
	public function setWikimediumShipping( $wikimediumShipping ) {
591
		$this->wikimediumShipping = $wikimediumShipping;
592
593
		return $this;
594
	}
595
596
	/**
597
	 * Get wikimediumShipping
598
	 *
599
	 * @return string
600
	 */
601
	public function getWikimediumShipping() {
602
		return $this->wikimediumShipping;
603
	}
604
605
	/**
606
	 * Set membershipType
607
	 *
608
	 * @param string $membershipType
609
	 * @return Request
610
	 */
611
	public function setMembershipType( $membershipType ) {
612
		$this->membershipType = $membershipType;
613
614
		return $this;
615
	}
616
617
	/**
618
	 * Get membershipType
619
	 *
620
	 * @return string
621
	 */
622
	public function getMembershipType() {
623
		return $this->membershipType;
624
	}
625
626
	/**
627
	 * Set membershipFee
628
	 *
629
	 * @param integer $membershipFee
630
	 * @return Request
631
	 */
632
	public function setMembershipFee( $membershipFee ) {
633
		$this->membershipFee = $membershipFee;
634
635
		return $this;
636
	}
637
638
	/**
639
	 * Get membershipFee
640
	 *
641
	 * @return integer
642
	 */
643
	public function getMembershipFee() {
644
		return $this->membershipFee;
645
	}
646
647
	/**
648
	 * Set membershipFeeInterval
649
	 *
650
	 * @param integer $membershipFeeInterval
651
	 *
652
	 * @return Request
653
	 */
654
	public function setMembershipFeeInterval($membershipFeeInterval) {
655
		$this->membershipFeeInterval = $membershipFeeInterval;
656
657
		return $this;
658
	}
659
660
	/**
661
	 * Get membershipFeeInterval
662
	 *
663
	 * @return integer
664
	 */
665
	public function getMembershipFeeInterval() {
666
		return $this->membershipFeeInterval;
667
	}
668
669
670
	/**
671
	 * Set accountNumber
672
	 *
673
	 * @param string $accountNumber
674
	 * @return Request
675
	 */
676
	public function setAccountNumber( $accountNumber ) {
677
		$this->accountNumber = $accountNumber;
678
679
		return $this;
680
	}
681
682
	/**
683
	 * Get accountNumber
684
	 *
685
	 * @return string
686
	 */
687
	public function getAccountNumber() {
688
		return $this->accountNumber;
689
	}
690
691
	/**
692
	 * Set bankName
693
	 *
694
	 * @param string $bankName
695
	 * @return Request
696
	 */
697
	public function setBankName( $bankName ) {
698
		$this->bankName = $bankName;
699
700
		return $this;
701
	}
702
703
	/**
704
	 * Get bankName
705
	 *
706
	 * @return string
707
	 */
708
	public function getBankName() {
709
		return $this->bankName;
710
	}
711
712
	/**
713
	 * Set bankCode
714
	 *
715
	 * @param string $bankCode
716
	 * @return Request
717
	 */
718
	public function setBankCode( $bankCode ) {
719
		$this->bankCode = $bankCode;
720
721
		return $this;
722
	}
723
724
	/**
725
	 * Get bankCode
726
	 *
727
	 * @return string
728
	 */
729
	public function getBankCode() {
730
		return $this->bankCode;
731
	}
732
733
	/**
734
	 * Set iban
735
	 *
736
	 * @param string $iban
737
	 * @return Request
738
	 */
739
	public function setIban( $iban ) {
740
		$this->iban = $iban;
741
742
		return $this;
743
	}
744
745
	/**
746
	 * Get iban
747
	 *
748
	 * @return string
749
	 */
750
	public function getIban() {
751
		return $this->iban;
752
	}
753
754
	/**
755
	 * Set bic
756
	 *
757
	 * @param string $bic
758
	 * @return Request
759
	 */
760
	public function setBic( $bic ) {
761
		$this->bic = $bic;
762
763
		return $this;
764
	}
765
766
	/**
767
	 * Get bic
768
	 *
769
	 * @return string
770
	 */
771
	public function getBic() {
772
		return $this->bic;
773
	}
774
775
	/**
776
	 * Set accountHolder
777
	 *
778
	 * @param string $accountHolder
779
	 * @return Request
780
	 */
781
	public function setAccountHolder( $accountHolder ) {
782
		$this->accountHolder = $accountHolder;
783
784
		return $this;
785
	}
786
787
	/**
788
	 * Get accountHolder
789
	 *
790
	 * @return string
791
	 */
792
	public function getAccountHolder() {
793
		return $this->accountHolder;
794
	}
795
796
	/**
797
	 * Set comment
798
	 *
799
	 * @param string $comment
800
	 * @return Request
801
	 */
802
	public function setComment( $comment ) {
803
		$this->comment = $comment;
804
805
		return $this;
806
	}
807
808
	/**
809
	 * Get comment
810
	 *
811
	 * @return string
812
	 */
813
	public function getComment() {
814
		return $this->comment;
815
	}
816
817
	/**
818
	 * Set export
819
	 *
820
	 * @param \DateTime $export
821
	 * @return Request
822
	 */
823
	public function setExport( $export ) {
824
		$this->export = $export;
825
826
		return $this;
827
	}
828
829
	/**
830
	 * Get export
831
	 *
832
	 * @return \DateTime
833
	 */
834
	public function getExport() {
835
		return $this->export;
836
	}
837
838
	/**
839
	 * Set backup
840
	 *
841
	 * @param \DateTime $backup
842
	 * @return Request
843
	 */
844
	public function setBackup( $backup ) {
845
		$this->backup = $backup;
846
847
		return $this;
848
	}
849
850
	/**
851
	 * Get backup
852
	 *
853
	 * @return \DateTime
854
	 */
855
	public function getBackup() {
856
		return $this->backup;
857
	}
858
859
	/**
860
	 * Set wikilogin
861
	 *
862
	 * @param boolean $wikilogin
863
	 * @return Request
864
	 */
865
	public function setWikilogin( $wikilogin ) {
866
		$this->wikilogin = $wikilogin;
867
868
		return $this;
869
	}
870
871
	/**
872
	 * Get wikilogin
873
	 *
874
	 * @return boolean
875
	 */
876
	public function getWikilogin() {
877
		return $this->wikilogin;
878
	}
879
880
	/**
881
	 * Set tracking
882
	 *
883
	 * @param string $tracking
884
	 * @return Request
885
	 */
886
	public function setTracking( $tracking ) {
887
		$this->tracking = $tracking;
888
889
		return $this;
890
	}
891
892
	/**
893
	 * Get tracking
894
	 *
895
	 * @return string
896
	 */
897
	public function getTracking() {
898
		return $this->tracking;
899
	}
900
901
	/**
902
	 * Set status
903
	 *
904
	 * @param integer $status
905
	 * @return Request
906
	 */
907
	public function setStatus( $status ) {
908
		$this->status = $status;
909
910
		return $this;
911
	}
912
913
	/**
914
	 * Get status
915
	 *
916
	 * @return integer
917
	 */
918
	public function getStatus() {
919
		return $this->status;
920
	}
921
922
	/**
923
	 * Set country
924
	 *
925
	 * @param string $country
926
	 * @return Request
927
	 */
928
	public function setCountry( $country ) {
929
		$this->country = $country;
930
931
		return $this;
932
	}
933
934
	/**
935
	 * Get country
936
	 *
937
	 * @return string
938
	 */
939
	public function getCountry() {
940
		return $this->country;
941
	}
942
943
	/**
944
	 * Set data
945
	 *
946
	 * @param string $data
947
	 * @return Request
948
	 */
949
	public function setData( $data ) {
950
		$this->data = $data;
951
952
		return $this;
953
	}
954
955
	/**
956
	 * Get data
957
	 *
958
	 * @return string
959
	 */
960
	public function getData() {
961
		return $this->data;
962
	}
963
964
	/**
965
	 * Set guid
966
	 *
967
	 * @param string $guid
968
	 * @return Request
969
	 */
970
	public function setGuid( $guid ) {
971
		$this->guid = $guid;
972
973
		return $this;
974
	}
975
976
	/**
977
	 * Get guid
978
	 *
979
	 * @return string
980
	 */
981
	public function getGuid() {
982
		return $this->guid;
983
	}
984
985
	/**
986
	 * Set type
987
	 *
988
	 * @param string $type
989
	 * @return Request
990
	 */
991
	public function setType( $type ) {
992
		$this->type = $type;
993
994
		return $this;
995
	}
996
997
	/**
998
	 * Get type
999
	 *
1000
	 * @return string
1001
	 */
1002
	public function getType() {
1003
		return $this->type;
1004
	}
1005
1006
	/**
1007
	 * Get id
1008
	 *
1009
	 * @return integer
1010
	 */
1011
	public function getId() {
1012
		return $this->id;
1013
	}
1014
1015
	public function isUnconfirmed() {
1016
		return $this->getStatus() === self::STATUS_NEUTRAL;
1017
	}
1018
1019
	public function log( $message ) {
1020
		$dataArray = $this->getDataArray();
1021
		$dataArray[ "log" ][ date( "Y-m-d H:i:s" ) ] = $message;
1022
		return $this->saveDataArray( $dataArray );
1023
	}
1024
1025
	private function getDataArray() {
1026
		return unserialize( base64_decode( $this->data ) );
1027
	}
1028
1029
	private function saveDataArray( array $dataArray ) {
1030
		$this->data = base64_encode( serialize( $dataArray ) );
1031
		return $this;
1032
	}
1033
}
1034