Completed
Push — master ( 9ac145...3dc5eb )
by Leszek
37s
created

MembershipApplication::getTimestamp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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