src/JuridicusBundle/Entity/Kunde.php line 18

Open in your IDE?
  1. <?php
  2. namespace JF\JuridicusBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use JF\JuridicusBundle\Validator\Constraints as JfAssert;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. /**
  9. * @ORM\Entity
  10. * @UniqueEntity(fields={"email","examen"}, message="Die Kombination aus E-Mail und Examen wird bereits verwendet.")
  11. * @UniqueEntity(fields={"kennziffer","examen"}, message="Die Kombination aus Kennziffer und Examen wird bereits verwendet.")
  12. * @UniqueEntity(fields={"handynummer","examen"}, message="Die Kombination aus Handynummer und Examen wird bereits verwendet.")
  13. */
  14. class Kunde extends InitModeEntity
  15. {
  16. const CLASSNAME = __CLASS__;
  17. /**
  18. * @var integer
  19. */
  20. private $id;
  21. /**
  22. * @var string
  23. * @Assert\NotBlank(message="Der Vorname darf nicht leer sein.")
  24. * @Assert\Length(max="255")
  25. */
  26. private $vorname;
  27. /**
  28. * @var string
  29. * @Assert\NotBlank(message="Der Nachname darf nicht leer sein.")
  30. * @Assert\Length(max="255")
  31. */
  32. private $nachname;
  33. /**
  34. * @var string
  35. * @Assert\NotBlank(message="Die E-Mail-Adresse darf nicht leer sein.")
  36. * @Assert\Email
  37. * @Assert\Length(max="128")
  38. * @JfAssert\EmailRole
  39. */
  40. private $email;
  41. /**
  42. * @var string
  43. * @Assert\NotBlank(message="Die Straße darf nicht leer sein.")
  44. * @Assert\Length(max="48")
  45. */
  46. private $strasse;
  47. /**
  48. * @var string
  49. * @Assert\NotBlank(message="Die Hausnummer darf nicht leer sein.")
  50. * @Assert\Length(max="6")
  51. */
  52. private $hausnummer;
  53. /**
  54. * @var string
  55. * @Assert\NotBlank(message="Die PLZ darf nicht leer sein.")
  56. * @Assert\Regex(pattern="/^\d{5}$/", message = "Die PLZ muss aus 5 Ziffern bestehen.")
  57. */
  58. private $plz;
  59. /**
  60. * @var string
  61. * @Assert\NotBlank(message="Der Ort darf nicht leer sein.")
  62. * @Assert\Length(max="48")
  63. */
  64. private $ort;
  65. /**
  66. * @var string
  67. * @Assert\NotBlank(message="Die Handynummer darf nicht leer sein.")
  68. * @Assert\Length(max="20")
  69. */
  70. private $handynummer;
  71. /**
  72. * @var integer
  73. * @Assert\NotBlank(groups={"Default","step-1"})
  74. */
  75. private $examen;
  76. /**
  77. * @var \DateTimeInterface|null
  78. * @Assert\Type(\DateTimeInterface::class)
  79. */
  80. private $geburtsdatum;
  81. /**
  82. * @var string
  83. * @Assert\Length(max="20")
  84. */
  85. private $telefonnummer;
  86. /**
  87. * @var string
  88. * @Assert\Length(max="8")
  89. */
  90. private $kennziffer;
  91. /**
  92. * @var boolean
  93. */
  94. private $export_erlaubt = false;
  95. /**
  96. * @var boolean
  97. */
  98. private $anruf_erlaubt = false;
  99. /**
  100. * @var boolean
  101. */
  102. private $logged_in = false;
  103. /**
  104. * @var \DateTime
  105. * @Assert\Type(\DateTimeInterface::class)
  106. */
  107. private $sms_send_at;
  108. /**
  109. * @var integer
  110. */
  111. private $sms_status_id;
  112. /**
  113. *
  114. * @var string
  115. */
  116. private $sms_status_message = 'Unbekannt';
  117. /**
  118. * @var boolean
  119. */
  120. private $verkaeufer = false;
  121. /**
  122. * @var string
  123. */
  124. private $notiz;
  125. /**
  126. * @var string
  127. */
  128. private $kontoinhaber;
  129. /**
  130. * @var string
  131. */
  132. private $kontonummer;
  133. /**
  134. * @var string
  135. */
  136. private $bank;
  137. /**
  138. * @var string
  139. */
  140. private $blz;
  141. /**
  142. * @var string
  143. */
  144. private $iban;
  145. /**
  146. * @var string
  147. */
  148. private $bic;
  149. /**
  150. * @var \JF\JuridicusBundle\Entity\Bundesland
  151. * @Assert\NotBlank(groups={"Default","step-1"})
  152. * @Assert\Valid
  153. */
  154. private $bundesland;
  155. /**
  156. * @var float
  157. */
  158. private $betrag_strafe;
  159. /**
  160. * @var boolean
  161. */
  162. private $strafe_bezahlt = false;
  163. /**
  164. * @var \JF\JuridicusBundle\Entity\User
  165. * @Assert\Valid
  166. */
  167. private $user;
  168. /**
  169. * @var \DateTime
  170. */
  171. private $created_at;
  172. /**
  173. * @var \JF\JuridicusBundle\Entity\PdfStempel
  174. */
  175. private $pdf_stempel;
  176. /**
  177. * @var \Doctrine\Common\Collections\Collection
  178. */
  179. private $downloads;
  180. /**
  181. * @var \Doctrine\Common\Collections\Collection
  182. */
  183. private $emails;
  184. /**
  185. * @var \Doctrine\Common\Collections\Collection
  186. */
  187. private $empfehlungen;
  188. /**
  189. * @var \Doctrine\Common\Collections\Collection
  190. */
  191. private $exporte;
  192. /**
  193. * @var \Doctrine\Common\Collections\Collection
  194. */
  195. private $kunde_kenntnisse;
  196. /**
  197. * @var string
  198. */
  199. private $kunde_englisch_kenntniss;
  200. /**
  201. * @var string
  202. */
  203. private $kunde_wunsch_arbeitsort;
  204. /**
  205. * @var \Doctrine\Common\Collections\Collection
  206. */
  207. private $kunde_pruefungen;
  208. /**
  209. * @var \Doctrine\Common\Collections\Collection
  210. */
  211. private $rechnungen;
  212. /**
  213. * @var \DateTime
  214. */
  215. private $sperrdatum;
  216. /**
  217. * @var boolean
  218. */
  219. private $pdf_need_update = true;
  220. /**
  221. * @var \JF\JuridicusBundle\Entity\Abo
  222. */
  223. private $abo;
  224. /**
  225. *
  226. * @var boolean
  227. */
  228. private $klausurprotokollpflicht = true;
  229. /**
  230. * @var boolean
  231. */
  232. private $pflicht_facebook_post = false;
  233. /**
  234. *
  235. * @var boolean
  236. */
  237. private $notenpflicht = true;
  238. /**
  239. * Constructor
  240. */
  241. public function __construct()
  242. {
  243. $this->exporte = new ArrayCollection();
  244. $this->downloads = new ArrayCollection();
  245. $this->emails = new ArrayCollection();
  246. $this->empfehlungen = new ArrayCollection();
  247. $this->kunde_kenntnisse = new ArrayCollection();
  248. $this->kunde_pruefungen = new ArrayCollection();
  249. $this->rechnungen = new ArrayCollection();
  250. }
  251. /**
  252. * Get id
  253. *
  254. * @return integer
  255. */
  256. public function getId()
  257. {
  258. return $this->id;
  259. }
  260. /**
  261. * Add exporte
  262. *
  263. * @param \JF\JuridicusBundle\Entity\Export $exporte
  264. * @return Kunde
  265. */
  266. public function addExporte(Export $exporte)
  267. {
  268. $this->exporte[] = $exporte;
  269. return $this;
  270. }
  271. /**
  272. * Remove exporte
  273. *
  274. * @param \JF\JuridicusBundle\Entity\Export $exporte
  275. */
  276. public function removeExporte(Export $exporte)
  277. {
  278. $this->exporte->removeElement($exporte);
  279. }
  280. /**
  281. * Get exporte
  282. *
  283. * @return \Doctrine\Common\Collections\Collection
  284. */
  285. public function getExporte()
  286. {
  287. return $this->exporte;
  288. }
  289. /**
  290. * Set kennziffer
  291. *
  292. * @param string $kennziffer
  293. * @return Kunde
  294. */
  295. public function setKennziffer($kennziffer)
  296. {
  297. $this->kennziffer = $kennziffer;
  298. return $this;
  299. }
  300. /**
  301. * Get kennziffer
  302. *
  303. * @return string
  304. */
  305. public function getKennziffer()
  306. {
  307. return $this->kennziffer;
  308. }
  309. /**
  310. * Set export_erlaubt
  311. *
  312. * @param boolean $exportErlaubt
  313. * @return Kunde
  314. */
  315. public function setExportErlaubt($exportErlaubt)
  316. {
  317. $this->export_erlaubt = (bool) $exportErlaubt;
  318. return $this;
  319. }
  320. /**
  321. * Get export_erlaubt
  322. *
  323. * @return boolean
  324. */
  325. public function getExportErlaubt()
  326. {
  327. return $this->export_erlaubt;
  328. }
  329. /**
  330. * Set user [OWNING SIDE]
  331. *
  332. * @param User $user
  333. * @return Kunde
  334. */
  335. public function setUser(User $user = null)
  336. {
  337. $this->user = $user;
  338. return $this;
  339. }
  340. /**
  341. * Get user
  342. *
  343. * @return User
  344. */
  345. public function getUser()
  346. {
  347. return $this->user;
  348. }
  349. /**
  350. * Add downloads [INVERSE SIDE]
  351. *
  352. * @param \JF\JuridicusBundle\Entity\Download $downloads
  353. * @return Kunde
  354. */
  355. public function addDownload(Download $downloads)
  356. {
  357. $this->downloads[] = $downloads;
  358. $downloads->setKunde($this);
  359. return $this;
  360. }
  361. /**
  362. * Remove downloads [INVERSE SIDE]
  363. *
  364. * @param \JF\JuridicusBundle\Entity\Download $downloads
  365. */
  366. public function removeDownload(Download $downloads)
  367. {
  368. $this->downloads->removeElement($downloads);
  369. $downloads->setKunde(null);
  370. }
  371. /**
  372. * Get downloads
  373. *
  374. * @return \Doctrine\Common\Collections\Collection
  375. */
  376. public function getDownloads()
  377. {
  378. return $this->downloads;
  379. }
  380. /**
  381. * Add email
  382. *
  383. * @param \JF\JuridicusBundle\Entity\Email $email
  384. * @return Kunde
  385. */
  386. public function addEmail(Email $email)
  387. {
  388. $this->emails[] = $email;
  389. return $this;
  390. }
  391. /**
  392. * Remove email
  393. *
  394. * @param \JF\JuridicusBundle\Entity\Email $emails
  395. */
  396. public function removeEmail(Email $email)
  397. {
  398. $this->emails->removeElement($email);
  399. }
  400. /**
  401. * Get emails
  402. *
  403. * @return \Doctrine\Common\Collections\Collection
  404. */
  405. public function getEmails()
  406. {
  407. return $this->emails;
  408. }
  409. /**
  410. * Add empfehlungen [INVERSE SIDE]
  411. *
  412. * @param \JF\JuridicusBundle\Entity\Empfehlung $empfehlung
  413. * @return Kunde
  414. */
  415. public function addEmpfehlungen(Empfehlung $empfehlung)
  416. {
  417. $this->empfehlungen[] = $empfehlung;
  418. return $this;
  419. }
  420. /**
  421. * Remove empfehlungen [INVERSE SIDE]
  422. *
  423. * @param \JF\JuridicusBundle\Entity\Empfehlung $empfehlung
  424. */
  425. public function removeEmpfehlungen(Empfehlung $empfehlung)
  426. {
  427. $this->empfehlungen->removeElement($empfehlungen);
  428. }
  429. /**
  430. * Get empfehlungen
  431. *
  432. * @return \Doctrine\Common\Collections\Collection
  433. */
  434. public function getEmpfehlungen()
  435. {
  436. return $this->empfehlungen;
  437. }
  438. /**
  439. * Add kunde_kenntnisse [INVERSE SIDE]
  440. *
  441. * @param \JF\JuridicusBundle\Entity\KundeKenntnis $kundeKenntnis
  442. * @return Kunde
  443. */
  444. public function addKundeKenntnisse(KundeKenntnis $kundeKenntnis)
  445. {
  446. $this->kunde_kenntnisse[] = $kundeKenntnis;
  447. $kundeKenntnis->setKunde($this);
  448. return $this;
  449. }
  450. /**
  451. * Remove kunde_kenntnisse [INVERSE SIDE]
  452. *
  453. * @param \JF\JuridicusBundle\Entity\KundeKenntnis $kundeKenntnis
  454. */
  455. public function removeKundeKenntnisse(KundeKenntnis $kundeKenntnis)
  456. {
  457. $this->kunde_kenntnisse->removeElement($kundeKenntnis);
  458. $kundeKenntnis->setKunde(null);
  459. }
  460. /**
  461. * Get kunde_kenntnisse
  462. *
  463. * @return \Doctrine\Common\Collections\Collection
  464. */
  465. public function getKundeKenntnisse()
  466. {
  467. return $this->kunde_kenntnisse;
  468. }
  469. /**
  470. * Set kunde_englisch_kenntniss
  471. *
  472. * @param string $bundesland
  473. * @return Kunde
  474. */
  475. public function setKundeEnglischKenntniss(String $kunde_englisch_kenntniss)
  476. {
  477. $this->kunde_englisch_kenntniss = $kunde_englisch_kenntniss;
  478. return $this;
  479. }
  480. /**
  481. * Get kunde_englisch_kenntniss
  482. *
  483. * @return string
  484. */
  485. public function getKundeEnglischKenntniss()
  486. {
  487. return $this->kunde_englisch_kenntniss;
  488. }
  489. /**
  490. * Set kunde_wunsch_arbeitsort
  491. *
  492. * @param string $bundesland
  493. * @return Kunde
  494. */
  495. public function setKundeWunschArbeitsort(String $kunde_wunsch_arbeitsort)
  496. {
  497. $this->kunde_wunsch_arbeitsort = $kunde_wunsch_arbeitsort;
  498. return $this;
  499. }
  500. /**
  501. * Get kunde_wunsch_arbeitsort
  502. *
  503. * @return string
  504. */
  505. public function getKundeWunschArbeitsort()
  506. {
  507. return $this->kunde_wunsch_arbeitsort;
  508. }
  509. /**
  510. * Set bundesland [OWNING SIDE]
  511. *
  512. * @param \JF\JuridicusBundle\Entity\Bundesland $bundesland
  513. * @return Kunde
  514. */
  515. public function setBundesland(Bundesland $bundesland = null)
  516. {
  517. $this->bundesland = $bundesland;
  518. return $this;
  519. }
  520. /**
  521. * Get bundesland
  522. *
  523. * @return \JF\JuridicusBundle\Entity\Bundesland
  524. */
  525. public function getBundesland()
  526. {
  527. return $this->bundesland;
  528. }
  529. /**
  530. * __toString
  531. *
  532. * @return string String-Repräsentation des Kunden
  533. */
  534. public function __toString()
  535. {
  536. if ($this->getId()) {
  537. return $this->getEmail();
  538. } else {
  539. return 'Neuer Kunde';
  540. }
  541. }
  542. /**
  543. * Set pdf_stempel [INVERSE SIDE]
  544. *
  545. * @param \JF\JuridicusBundle\Entity\PdfStempel $pdfStempel
  546. * @return Kunde
  547. */
  548. public function setPdfStempel(PdfStempel $pdfStempel = null)
  549. {
  550. $this->pdf_stempel = $pdfStempel;
  551. return $this;
  552. }
  553. /**
  554. * Get pdf_stempel
  555. *
  556. * @return \JF\JuridicusBundle\Entity\PdfStempel
  557. */
  558. public function getPdfStempel()
  559. {
  560. return $this->pdf_stempel;
  561. }
  562. /**
  563. *
  564. * @return string
  565. */
  566. public function getStempelText()
  567. {
  568. return sprintf(
  569. 'Persönliche Kopie für %s %s %s- %s - %s',
  570. $this->vorname,
  571. $this->nachname,
  572. $this->kennziffer ? sprintf('(%s) ', $this->kennziffer ) : '',
  573. $this->email,
  574. $this->handynummer
  575. );
  576. }
  577. /**
  578. * Add kunde_pruefungen [INVERSE SIDE]
  579. *
  580. * @param \JF\JuridicusBundle\Entity\KundePruefung $kundePruefungen
  581. * @return Kunde
  582. */
  583. public function addKundePruefungen(KundePruefung $kundePruefungen)
  584. {
  585. $this->kunde_pruefungen[] = $kundePruefungen;
  586. return $this;
  587. }
  588. /**
  589. * Remove kunde_pruefungen [INVERSE SIDE]
  590. *
  591. * @param \JF\JuridicusBundle\Entity\KundePruefung $kundePruefung
  592. */
  593. public function removeKundePruefungen(KundePruefung $kundePruefung)
  594. {
  595. $this->kunde_pruefungen->removeElement($kundePruefung);
  596. }
  597. /**
  598. * Get kunde_pruefungen
  599. *
  600. * @return \Doctrine\Common\Collections\Collection
  601. */
  602. public function getKundePruefungen()
  603. {
  604. return $this->kunde_pruefungen;
  605. }
  606. /**
  607. *
  608. * @return int
  609. */
  610. public function getAnzahlBuchungen()
  611. {
  612. return $this->getKundePruefungen()->count();
  613. }
  614. /**
  615. *
  616. * @param \JF\JuridicusBundle\Entity\Pruefung $pruefung
  617. * @return boolean
  618. */
  619. public function isGebucht(Pruefung $pruefung)
  620. {
  621. foreach ($this->getKundePruefungen() as $buchung) {
  622. /* @var $buchung \JF\JuridicusBundle\Entity\KundePruefung */
  623. if ($buchung->getPruefung()->getId() == $pruefung->getId()) {
  624. return true;
  625. }
  626. }
  627. return false;
  628. }
  629. /**
  630. *
  631. * @param \JF\JuridicusBundle\Entity\Pruefung $pruefung
  632. * @return \JF\JuridicusBundle\Entity\KundePruefung|null
  633. */
  634. public function findBuchung(Pruefung $pruefung)
  635. {
  636. foreach ($this->getKundePruefungen() as $buchung) {
  637. /* @var $buchung \JF\JuridicusBundle\Entity\KundePruefung */
  638. if ($buchung->getPruefung()->getId() == $pruefung->getId()) {
  639. return $buchung;
  640. }
  641. }
  642. return null;
  643. }
  644. /**
  645. * ermittelt das Datum, das für die Bereitstellung der letzten 3 ZA-Ausgaben verwendet wird
  646. * @return \DateTime
  647. */
  648. public function getZAStichtag()
  649. {
  650. $newest_date = $this->getCreatedAt();
  651. foreach ($this->getKundePruefungen() as $buchung) {
  652. $date = $buchung->getDatumBuchung();
  653. if ($date && $date > $newest_date) {
  654. $newest_date = $date;
  655. }
  656. }
  657. return $newest_date;
  658. }
  659. /**
  660. *
  661. * @return boolean
  662. */
  663. public function hasBuchung()
  664. {
  665. return ! $this->getKundePruefungen()->isEmpty();
  666. }
  667. /**
  668. * Set strasse
  669. *
  670. * @param string $strasse
  671. * @return Kunde
  672. */
  673. public function setStrasse($strasse)
  674. {
  675. $this->strasse = $strasse;
  676. return $this;
  677. }
  678. /**
  679. * Get strasse
  680. *
  681. * @return string
  682. */
  683. public function getStrasse()
  684. {
  685. return $this->strasse;
  686. }
  687. /**
  688. * Set hausnummer
  689. *
  690. * @param string $hausnummer
  691. * @return Kunde
  692. */
  693. public function setHausnummer($hausnummer)
  694. {
  695. $this->hausnummer = $hausnummer;
  696. return $this;
  697. }
  698. /**
  699. * Get hausnummer
  700. *
  701. * @return string
  702. */
  703. public function getHausnummer()
  704. {
  705. return $this->hausnummer;
  706. }
  707. /**
  708. * Get Strasse und Hausnummer
  709. *
  710. * @return string
  711. */
  712. public function getStrasseAndHausnummer()
  713. {
  714. return sprintf( '%s %s', $this->strasse, $this->hausnummer);
  715. }
  716. /**
  717. * Set plz
  718. *
  719. * @param string $plz
  720. * @return Kunde
  721. */
  722. public function setPlz($plz)
  723. {
  724. $this->plz = $plz;
  725. return $this;
  726. }
  727. /**
  728. * Get plz
  729. *
  730. * @return string
  731. */
  732. public function getPlz()
  733. {
  734. return $this->plz;
  735. }
  736. /**
  737. * Set ort
  738. *
  739. * @param string $ort
  740. * @return Kunde
  741. */
  742. public function setOrt($ort)
  743. {
  744. $this->ort = $ort;
  745. return $this;
  746. }
  747. /**
  748. * Get ort
  749. *
  750. * @return string
  751. */
  752. public function getOrt()
  753. {
  754. return $this->ort;
  755. }
  756. /**
  757. * Get PLZ and Ort
  758. *
  759. * @return string
  760. */
  761. public function getPlzAndOrt()
  762. {
  763. return sprintf('%s %s', $this->plz, $this->ort);
  764. }
  765. /**
  766. * Set handynummer
  767. *
  768. * @param string $handynummer
  769. * @return Kunde
  770. */
  771. public function setHandynummer($handynummer)
  772. {
  773. $this->handynummer = $handynummer;
  774. return $this;
  775. }
  776. /**
  777. * Get handynummer
  778. *
  779. * @return string
  780. */
  781. public function getHandynummer()
  782. {
  783. return $this->handynummer;
  784. }
  785. /**
  786. * Set examen
  787. *
  788. * @param integer $examen
  789. * @return Kunde
  790. */
  791. public function setExamen($examen)
  792. {
  793. $this->examen = $examen;
  794. return $this;
  795. }
  796. /**
  797. * Get examen
  798. *
  799. * @return integer
  800. */
  801. public function getExamen()
  802. {
  803. return $this->examen;
  804. }
  805. /**
  806. * Set logged_in
  807. *
  808. * @param boolean $loggedIn
  809. * @return Kunde
  810. */
  811. public function setLoggedIn($loggedIn)
  812. {
  813. $this->logged_in = (bool) $loggedIn;
  814. return $this;
  815. }
  816. /**
  817. * Get logged_in
  818. *
  819. * @return boolean
  820. */
  821. public function getLoggedIn()
  822. {
  823. return $this->logged_in;
  824. }
  825. /**
  826. * Set sms_send_at
  827. *
  828. * @param \DateTime $smsSendAt
  829. * @return Kunde
  830. */
  831. public function setSmsSendAt(\DateTime $smsSendAt = null)
  832. {
  833. $this->sms_send_at = $smsSendAt;
  834. return $this;
  835. }
  836. /**
  837. * Get sms_send_at
  838. *
  839. * @return \DateTime
  840. */
  841. public function getSmsSendAt()
  842. {
  843. return $this->sms_send_at;
  844. }
  845. /**
  846. * Set notiz
  847. *
  848. * @param string $notiz
  849. * @return Kunde
  850. */
  851. public function setNotiz($notiz)
  852. {
  853. $this->notiz = $notiz;
  854. return $this;
  855. }
  856. /**
  857. * Get notiz
  858. *
  859. * @return string
  860. */
  861. public function getNotiz()
  862. {
  863. return $this->notiz;
  864. }
  865. /**
  866. * Set vorname
  867. *
  868. * @param string $vorname
  869. * @return Kunde
  870. */
  871. public function setVorname($vorname)
  872. {
  873. $this->vorname = $vorname;
  874. return $this;
  875. }
  876. /**
  877. * Get vorname
  878. *
  879. * @return string
  880. */
  881. public function getVorname()
  882. {
  883. return $this->vorname;
  884. }
  885. /**
  886. * Set nachname
  887. *
  888. * @param string $nachname
  889. * @return Kunde
  890. */
  891. public function setNachname($nachname)
  892. {
  893. $this->nachname = $nachname;
  894. return $this;
  895. }
  896. /**
  897. * Get nachname
  898. *
  899. * @return string
  900. */
  901. public function getNachname()
  902. {
  903. return $this->nachname;
  904. }
  905. /**
  906. * Get name
  907. *
  908. * @return string
  909. */
  910. public function getName()
  911. {
  912. return sprintf( '%s %s', $this->vorname, $this->nachname);
  913. }
  914. /**
  915. * Set email
  916. *
  917. * @param string $email
  918. * @return Kunde
  919. */
  920. public function setEmail($email)
  921. {
  922. $this->email = $email;
  923. return $this;
  924. }
  925. /**
  926. * Get email
  927. *
  928. * @return string
  929. */
  930. public function getEmail()
  931. {
  932. return $this->email;
  933. }
  934. /**
  935. * Set geburtsdatum
  936. *
  937. * @param \DateTime $geburtsdatum
  938. * @return Kunde
  939. */
  940. public function setGeburtsdatum(\DateTime $geburtsdatum = null)
  941. {
  942. $this->geburtsdatum = $geburtsdatum;
  943. return $this;
  944. }
  945. /**
  946. * Get geburtsdatum
  947. *
  948. * @return \DateTime
  949. */
  950. public function getGeburtsdatum()
  951. {
  952. return $this->geburtsdatum;
  953. }
  954. /**
  955. * Set telefonnummer
  956. *
  957. * @param string $telefonnummer
  958. * @return Kunde
  959. */
  960. public function setTelefonnummer($telefonnummer)
  961. {
  962. $this->telefonnummer = $telefonnummer;
  963. return $this;
  964. }
  965. /**
  966. * Get telefonnummer
  967. *
  968. * @return string
  969. */
  970. public function getTelefonnummer()
  971. {
  972. return $this->telefonnummer;
  973. }
  974. /**
  975. * Get days since registration
  976. *
  977. * @return integer
  978. */
  979. public function getDaysSinceRegistration()
  980. {
  981. $now = new \DateTime();
  982. return $this->created_at->diff($now)->format('%r%a');
  983. }
  984. /**
  985. *
  986. * @return string
  987. */
  988. public function getCssClass()
  989. {
  990. if ($this->getAnzahlBuchungen() > 0)
  991. {
  992. return 'ok';
  993. }
  994. if ($this->betrag_strafe && $this->strafe_bezahlt === false && $this->getDaysSinceRegistration() > 28)
  995. {
  996. return 'unpaid';
  997. }
  998. return 'ok';
  999. }
  1000. /**
  1001. * Add to Pdf
  1002. *
  1003. * @param \TCPDF
  1004. */
  1005. public function addToPdf(\TCPDF & $pdf)
  1006. {
  1007. $txt = sprintf(
  1008. '© %s by Juridicus. Die Weitergabe dieser Kopie ist nicht erlaubt und wird strafrechtlich geahndet.',
  1009. date('Y')
  1010. );
  1011. $pdf->Cell(0, 0, $txt, 0, 1, 'L');
  1012. $pdf->Cell(0, 0, $this->getStempelText(), 0, 1, 'L');
  1013. }
  1014. /**
  1015. * Set created_at
  1016. *
  1017. * @param \DateTime $createdAt
  1018. * @return Kunde
  1019. */
  1020. public function setCreatedAt(\DateTime $createdAt = null)
  1021. {
  1022. $this->created_at = $createdAt;
  1023. return $this;
  1024. }
  1025. /**
  1026. * Get created_at
  1027. *
  1028. * @return \DateTime
  1029. */
  1030. public function getCreatedAt()
  1031. {
  1032. return $this->created_at;
  1033. }
  1034. /**
  1035. * Set anruf_erlaubt
  1036. *
  1037. * @param boolean $anrufErlaubt
  1038. * @return Kunde
  1039. */
  1040. public function setAnrufErlaubt($anrufErlaubt)
  1041. {
  1042. $this->anruf_erlaubt = (bool) $anrufErlaubt;
  1043. return $this;
  1044. }
  1045. /**
  1046. * Get anruf_erlaubt
  1047. *
  1048. * @return boolean
  1049. */
  1050. public function getAnrufErlaubt()
  1051. {
  1052. return $this->anruf_erlaubt;
  1053. }
  1054. /**
  1055. * Set kontoinhaber
  1056. *
  1057. * @param string $kontoinhaber
  1058. * @return Kunde
  1059. */
  1060. public function setKontoinhaber($kontoinhaber)
  1061. {
  1062. $this->kontoinhaber = $kontoinhaber;
  1063. return $this;
  1064. }
  1065. /**
  1066. * Get kontoinhaber
  1067. *
  1068. * @return string
  1069. */
  1070. public function getKontoinhaber()
  1071. {
  1072. return $this->kontoinhaber;
  1073. }
  1074. /**
  1075. * Set kontonummer
  1076. *
  1077. * @param string $kontonummer
  1078. * @return Kunde
  1079. */
  1080. public function setKontonummer($kontonummer)
  1081. {
  1082. $this->kontonummer = $kontonummer;
  1083. return $this;
  1084. }
  1085. /**
  1086. * Get kontonummer
  1087. *
  1088. * @return string
  1089. */
  1090. public function getKontonummer()
  1091. {
  1092. return $this->kontonummer;
  1093. }
  1094. /**
  1095. * Set bank
  1096. *
  1097. * @param string $bank
  1098. * @return Kunde
  1099. */
  1100. public function setBank($bank)
  1101. {
  1102. $this->bank = $bank;
  1103. return $this;
  1104. }
  1105. /**
  1106. * Get bank
  1107. *
  1108. * @return string
  1109. */
  1110. public function getBank()
  1111. {
  1112. return $this->bank;
  1113. }
  1114. /**
  1115. * Set blz
  1116. *
  1117. * @param string $blz
  1118. * @return Kunde
  1119. */
  1120. public function setBlz($blz)
  1121. {
  1122. $this->blz = $blz;
  1123. return $this;
  1124. }
  1125. /**
  1126. * Get blz
  1127. *
  1128. * @return string
  1129. */
  1130. public function getBlz()
  1131. {
  1132. return $this->blz;
  1133. }
  1134. /**
  1135. * Set verkaeufer
  1136. *
  1137. * @param boolean $verkaeufer
  1138. * @return Kunde
  1139. */
  1140. public function setVerkaeufer($verkaeufer)
  1141. {
  1142. $this->verkaeufer = (bool) $verkaeufer;
  1143. return $this;
  1144. }
  1145. /**
  1146. * Get verkaeufer
  1147. *
  1148. * @return boolean
  1149. */
  1150. public function getVerkaeufer()
  1151. {
  1152. return $this->verkaeufer;
  1153. }
  1154. /**
  1155. * Auswahlbereich für ein Prüfungsdatum. Bei Verkaüfern und Kunden von Prüfungsämtern ohne Vollbestand darf das
  1156. * Prüfungsdatum auch in der Vergangenheit liegen.
  1157. *
  1158. * @return string
  1159. */
  1160. public function getDatepickerClass()
  1161. {
  1162. if ($this->verkaeufer || $this->betrag_strafe) {
  1163. return 'free';
  1164. } else {
  1165. return 'future';
  1166. }
  1167. }
  1168. /**
  1169. * Set iban
  1170. *
  1171. * @param string $iban
  1172. * @return Kunde
  1173. */
  1174. public function setIban($iban)
  1175. {
  1176. $this->iban = $iban;
  1177. return $this;
  1178. }
  1179. /**
  1180. * Get iban
  1181. *
  1182. * @return string
  1183. */
  1184. public function getIban()
  1185. {
  1186. return $this->iban;
  1187. }
  1188. /**
  1189. * Set bic
  1190. *
  1191. * @param string $bic
  1192. * @return Kunde
  1193. */
  1194. public function setBic($bic)
  1195. {
  1196. $this->bic = $bic;
  1197. return $this;
  1198. }
  1199. /**
  1200. * Get bic
  1201. *
  1202. * @return string
  1203. */
  1204. public function getBic()
  1205. {
  1206. return $this->bic;
  1207. }
  1208. /**
  1209. * Set sms_status_id
  1210. *
  1211. * @param integer $smsStatusId
  1212. * @return Kunde
  1213. */
  1214. public function setSmsStatusId($smsStatusId)
  1215. {
  1216. $this->sms_status_id = $smsStatusId;
  1217. return $this;
  1218. }
  1219. /**
  1220. * Get sms_status_id
  1221. *
  1222. * @return integer
  1223. */
  1224. public function getSmsStatusId()
  1225. {
  1226. return $this->sms_status_id;
  1227. }
  1228. /**
  1229. *
  1230. * @param string $message
  1231. * @return \JF\JuridicusBundle\Entity\Kunde
  1232. */
  1233. public function setSmsStatusMessage($message)
  1234. {
  1235. $this->sms_status_message = $message;
  1236. return $this;
  1237. }
  1238. /**
  1239. *
  1240. * @return string
  1241. */
  1242. public function getSmsStatusMessage()
  1243. {
  1244. return $this->sms_status_message;
  1245. }
  1246. /**
  1247. * Set betrag_strafe
  1248. *
  1249. * @param float $betragStrafe
  1250. * @return Kunde
  1251. */
  1252. public function setBetragStrafe($betragStrafe)
  1253. {
  1254. $this->betrag_strafe = $betragStrafe;
  1255. return $this;
  1256. }
  1257. /**
  1258. * Get betrag_strafe
  1259. *
  1260. * @return float
  1261. */
  1262. public function getBetragStrafe()
  1263. {
  1264. return $this->betrag_strafe;
  1265. }
  1266. /**
  1267. * Set strafe_bezahlt
  1268. *
  1269. * @param boolean $strafeBezahlt
  1270. * @return Kunde
  1271. */
  1272. public function setStrafeBezahlt($strafeBezahlt)
  1273. {
  1274. $this->strafe_bezahlt = (bool) $strafeBezahlt;
  1275. $rechnung = $this->getRechnungOhneBuchung(Gebuehr::TYP_STRAFGEBUEHR);
  1276. if ($rechnung) {
  1277. $rechnung->setBezahlt($this->strafe_bezahlt ? $this->betrag_strafe : 0.0);
  1278. }
  1279. return $this;
  1280. }
  1281. /**
  1282. * Get strafe_bezahlt
  1283. *
  1284. * @return boolean
  1285. */
  1286. public function getStrafeBezahlt()
  1287. {
  1288. return $this->strafe_bezahlt;
  1289. }
  1290. /**
  1291. * Add rechnung
  1292. *
  1293. * @param \JF\JuridicusBundle\Entity\Rechnung $rechnung
  1294. * @return Kunde
  1295. */
  1296. public function addRechnungen(Rechnung $rechnung)
  1297. {
  1298. $this->rechnungen[] = $rechnung;
  1299. return $this;
  1300. }
  1301. /**
  1302. * Remove rechnung
  1303. *
  1304. * @param \JF\JuridicusBundle\Entity\Rechnung $rechnung
  1305. */
  1306. public function removeRechnungen(Rechnung $rechnung)
  1307. {
  1308. $this->rechnungen->removeElement($rechnung);
  1309. }
  1310. /**
  1311. * Get rechnungen
  1312. *
  1313. * @return \Doctrine\Common\Collections\Collection
  1314. */
  1315. public function getRechnungen()
  1316. {
  1317. return $this->rechnungen;
  1318. }
  1319. /**
  1320. *
  1321. *
  1322. * @param integer $gebuehr_typ
  1323. * @return Rechnung|null
  1324. */
  1325. public function getRechnungOhneBuchung($gebuehr_typ)
  1326. {
  1327. foreach ($this->getRechnungen() as $rechnung) {
  1328. /* @var $rechnung \JF\JuridicusBundle\Entity\Rechnung */
  1329. if ($rechnung->getTyp() == $gebuehr_typ && ! $rechnung->getBuchung()) {
  1330. return $rechnung;
  1331. }
  1332. }
  1333. return null;
  1334. }
  1335. /**
  1336. * Set sperrdatum
  1337. *
  1338. * @param \DateTime $sperrdatum
  1339. * @return Kunde
  1340. */
  1341. public function setSperrdatum(\DateTime $sperrdatum = null)
  1342. {
  1343. $this->sperrdatum = $sperrdatum;
  1344. return $this;
  1345. }
  1346. /**
  1347. * Get sperrdatum
  1348. *
  1349. * @return \DateTime
  1350. */
  1351. public function getSperrdatum()
  1352. {
  1353. return $this->sperrdatum;
  1354. }
  1355. /**
  1356. * Set pdf_need_update
  1357. *
  1358. * @param boolean $pdfNeedUpdate
  1359. * @return Kunde
  1360. */
  1361. public function setPdfNeedUpdate($pdfNeedUpdate = true)
  1362. {
  1363. $this->pdf_need_update = (bool) $pdfNeedUpdate;
  1364. return $this;
  1365. }
  1366. /**
  1367. * Get pdf_need_update
  1368. *
  1369. * @return boolean
  1370. */
  1371. public function getPdfNeedUpdate()
  1372. {
  1373. return $this->pdf_need_update;
  1374. }
  1375. /**
  1376. * Set abo
  1377. *
  1378. * @param \JF\JuridicusBundle\Entity\Abo $abo
  1379. * @return Kunde
  1380. */
  1381. public function setAbo(Abo $abo = null)
  1382. {
  1383. $this->abo = $abo;
  1384. return $this;
  1385. }
  1386. /**
  1387. * Get abo
  1388. *
  1389. * @return \JF\JuridicusBundle\Entity\Abo
  1390. */
  1391. public function getAbo()
  1392. {
  1393. return $this->abo;
  1394. }
  1395. /**
  1396. *
  1397. * @return \JF\JuridicusBundle\Entity\Pruefungsamt|null
  1398. */
  1399. public function getPruefungsamt()
  1400. {
  1401. foreach($this->getBundesland()->getPruefungsaemter() as $pruefungsamt) {
  1402. /* @var $pruefungsamt \JF\JuridicusBundle\Entity\Pruefungsamt */
  1403. if ($pruefungsamt->getExamen() == $this->getExamen()) {
  1404. return $pruefungsamt;
  1405. }
  1406. }
  1407. return null;
  1408. }
  1409. /**
  1410. * Set klausurprotokollpflicht
  1411. *
  1412. * @param boolean $klausurprotokollpflicht
  1413. * @return Kunde
  1414. */
  1415. public function setKlausurprotokollpflicht($klausurprotokollpflicht = true)
  1416. {
  1417. $this->klausurprotokollpflicht = (bool) $klausurprotokollpflicht;
  1418. return $this;
  1419. }
  1420. /**
  1421. * Get klausurprotokollpflicht
  1422. *
  1423. * @return boolean
  1424. */
  1425. public function getKlausurprotokollpflicht()
  1426. {
  1427. return $this->klausurprotokollpflicht;
  1428. }
  1429. /**
  1430. * Set pflicht_facebook_post
  1431. *
  1432. * @param boolean $pflichtFacebookPost
  1433. * @return Kunde
  1434. */
  1435. public function setPflichtFacebookPost($pflichtFacebookPost = true)
  1436. {
  1437. $this->pflicht_facebook_post = (bool) $pflichtFacebookPost;
  1438. return $this;
  1439. }
  1440. /**
  1441. * Get pflicht_facebook_post
  1442. *
  1443. * @return boolean
  1444. */
  1445. public function getPflichtFacebookPost()
  1446. {
  1447. return $this->pflicht_facebook_post;
  1448. }
  1449. /**
  1450. * Set notenpflicht
  1451. *
  1452. * @param boolean $notenpflicht
  1453. * @return \JF\JuridicusBundle\Entity\Kunde
  1454. */
  1455. public function setNotenpflicht($notenpflicht = true)
  1456. {
  1457. $this->notenpflicht = (bool) $notenpflicht;
  1458. return $this;
  1459. }
  1460. /**
  1461. * Get notenpflicht
  1462. *
  1463. * @return boolean
  1464. */
  1465. public function getNotenpflicht()
  1466. {
  1467. return $this->notenpflicht;
  1468. }
  1469. /**
  1470. * Virtuelles Feld für Admin-Bereich
  1471. */
  1472. public function getImpersonating(): string
  1473. {
  1474. return '';
  1475. }
  1476. public function isFertig(): bool
  1477. {
  1478. return false;
  1479. }
  1480. }