ContactPoint.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. <?php
  2. namespace AppBundle\Entity\Core;
  3. use AppBundle\Annotation\ExportFilter;
  4. use AppBundle\Annotation\ExportSplitFields;
  5. use AppBundle\Entity\Organization\Organization;
  6. use AppBundle\Entity\Person\Person;
  7. use AppBundle\Entity\Place\Place;
  8. use AppBundle\Enum\Core\ContactPointTypeEnum;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Dunglas\ApiBundle\Annotation\Iri;
  11. use libphonenumber\PhoneNumber;
  12. use libphonenumber\PhoneNumberUtil;
  13. use Symfony\Component\Serializer\Annotation\Groups;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15. use AppBundle\Entity\Traits\TimestampableEntity;
  16. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  17. use AppBundle\Validator\Constraints as OpentalentAssert;
  18. use AppBundle\Annotation\Confidentiality;
  19. use Misd\PhoneNumberBundle\Validator\Constraints\PhoneNumber as AssertPhoneNumber;
  20. /**
  21. * Données de contact d'une Person ou d'une Organization
  22. *
  23. * @Iri("http://schema.org/ContactPoint")
  24. */
  25. #[ORM\Entity(repositoryClass: 'AppBundle\Entity\Core\Repository\ContactPointRepository')]
  26. #[Assert\Callback(['AppBundle\Validator\Constraints\Core\ContactPointValidator', 'validate'])]
  27. #[ORM\Table(name: 'ContactPoint')]
  28. #[ORM\Index(name: 'email', columns: ['email'])]
  29. class ContactPoint
  30. {
  31. use TimestampableEntity;
  32. use CreatorUpdaterEntity;
  33. /**
  34. * @var int
  35. *
  36. * })
  37. */
  38. #[ORM\Column(type: 'integer')]
  39. #[ORM\Id]
  40. #[ORM\GeneratedValue(strategy: 'AUTO')]
  41. #[Groups(['contactpoint', 'othercontact_list_person', 'place_list', 'student_registration_person', 'student_registration_guardians', 'network_list', 'federations_list', 'networkmanagers_list_person', 'network_artist_school_list', 'organization_details', 'organization_cotisation_steps', 'online_registration_access_details_person', 'cmf_network_organizations'])]
  42. private $id;
  43. /**
  44. * @var string A person or organization can have different contact points, for different purposes. For example, a sales contact point, a PR contact point and so on. This property is used to specify the kind of contact point.
  45. *
  46. * @Iri("https://schema.org/contactType")
  47. */
  48. #[ORM\Column(type: 'string')]
  49. #[Assert\Type(type: 'string')]
  50. #[Assert\NotBlank(message: 'not-blank')]
  51. #[Assert\Choice(callback: ['\AppBundle\Enum\Core\ContactPointTypeEnum', 'toArray'], message: 'invalid-choice')]
  52. #[Groups(['contactpoint', 'access_details_person', 'access_details_guardians', 'report_card_person', 'report_card_guardians', 'student_registration_person', 'student_registration_guardians', 'network_list_contactpoint', 'federations_list_contactpoint', 'networkmanagers_list_person', 'network_artist_school_list_contactpoint', 'network_list_adminaccess', 'access_mail_person', 'student_list_guardians', 'access_mail_guardians', 'organization_details_contactpoint', 'payer_list_person', 'access_duplicate_control_list_person', 'organization_cotisation_steps_contactpoint', 'template', 'view_from_manager_create_person', 'online_registration_access_details_person', 'onlineregistration_infos_organization', 'accesses_no_reregistred_list_person', 'accesses_no_reregistred_list_guardians', 'cmf_network_organizations_contactpoint'])]
  53. private $contactType;
  54. /**
  55. * @var string Email address.
  56. *
  57. * @Iri("https://schema.org/email")
  58. * @Confidentiality(visibility=\AppBundle\Enum\Confidentiality\ConfidentialityTypeEnum::VISIBILITY_ORGANIZATION)
  59. */
  60. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  61. #[Assert\Email(strict: true, message: 'invalid-email-format')]
  62. #[Assert\Email(checkMX: true, message: 'invalid-email-domain')]
  63. #[Assert\Regex(pattern: '/^[a-zA-Z0-9._%-]{1,64}@[a-zA-Z0-9.-]{2,249}\.[a-zA-Z]{2,20}$/', message: 'email-error')]
  64. #[Groups(['contactpoint', 'access_details_person', 'access_details_guardians', 'student_list_person', 'guardians_list_person', 'all_accesses_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'morals_list_person', 'ca_list_person', 'accesses_list_person', 'othercontact_list_person', 'place_list_contactpoint', 'report_card_person', 'report_card_guardians', 'student_registration_person', 'student_registration_guardians', 'board_list_person', 'network_list_contactpoint', 'federations_list_contactpoint', 'networkmanagers_list_person', 'network_artist_school_list_contactpoint', 'network_list_adminaccess', 'adherent_contact_person', 'adherent_contact_guardians', 'access_mail_person', 'student_list_guardians', 'access_mail_guardians', 'organization_details_contactpoint', 'payer_list_person', 'access_duplicate_control_list_person', 'organization_cotisation_steps_contactpoint', 'template', 'view_from_manager_create_person', 'online_registration_access_details_person', 'onlineregistration_infos_organization', 'accesses_no_reregistred_list_person', 'accesses_no_reregistred_list_guardians', 'cmf_network_organizations_contactpoint'])]
  65. private $email;
  66. /**
  67. * @var string Invalid Email address.
  68. *
  69. * @Iri("https://schema.org/email")
  70. */
  71. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  72. #[Groups(['contactpoint'])]
  73. private $emailInvalid;
  74. /**
  75. * @var string The fax number.
  76. *
  77. * @AssertPhoneNumber
  78. * @Iri("https://schema.org/faxNumber")
  79. */
  80. #[ORM\Column(type: 'phone_number', nullable: true)]
  81. #[Groups(['contactpoint', 'access_details_person', 'access_duplicate_control_list_person', 'organization_cotisation_steps_contactpoint', 'organization_details_contactpoint'])]
  82. private $faxNumber;
  83. /**
  84. * @var string The invalid fax number.
  85. *
  86. * @Iri("https://schema.org/faxNumber")
  87. */
  88. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  89. #[Groups(['contactpoint'])]
  90. private $faxNumberInvalid;
  91. /**
  92. * @var string
  93. *
  94. * @AssertPhoneNumber
  95. * @Confidentiality(visibility=\AppBundle\Enum\Confidentiality\ConfidentialityTypeEnum::VISIBILITY_ORGANIZATION)
  96. */
  97. #[ORM\Column(type: 'phone_number', nullable: true)]
  98. #[Groups(['contactpoint', 'access_details_person', 'access_details_guardians', 'student_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'morals_list_person', 'ca_list_person', 'accesses_list_person', 'othercontact_list_person', 'place_list_contactpoint', 'student_registration_person', 'student_registration_guardians', 'board_list_person', 'all_accesses_list_person', 'network_list_contactpoint', 'federations_list_contactpoint', 'networkmanagers_list_person', 'network_artist_school_list_contactpoint', 'adherent_contact_person', 'adherent_contact_guardians', 'student_list_guardians', 'organization_details_contactpoint', 'payer_list_person', 'access_duplicate_control_list_person', 'organization_cotisation_steps_contactpoint', 'view_from_manager_create_person', 'online_registration_access_details_person', 'onlineregistration_infos_organization', 'accesses_no_reregistred_list_person', 'accesses_no_reregistred_list_guardians', 'cmf_network_organizations_contactpoint'])]
  99. private $telphone;
  100. /**
  101. * @var string
  102. */
  103. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  104. #[Groups(['contactpoint'])]
  105. private $telphoneInvalid;
  106. /**
  107. * @var string
  108. *
  109. * @AssertPhoneNumber
  110. * @Confidentiality(visibility=\AppBundle\Enum\Confidentiality\ConfidentialityTypeEnum::VISIBILITY_ORGANIZATION)
  111. */
  112. #[ORM\Column(type: 'phone_number', nullable: true)]
  113. #[Groups(['contactpoint', 'access_details_person', 'access_details_guardians', 'student_registration_person', 'student_registration_guardians', 'student_list_person', 'accesses_list_person', 'guardians_list_person', 'teachers_list_person', 'adherent_list_person', 'personnels_list_person', 'morals_list_person', 'ca_list_person', 'all_accesses_list_person', 'othercontact_list_person', 'board_list_person', 'student_list_guardians', 'network_list_contactpoint', 'federations_list_contactpoint', 'networkmanagers_list_person', 'organization_details_contactpoint', 'payer_list_person', 'adherent_contact_person', 'access_duplicate_control_list_person', 'organization_cotisation_steps_contactpoint', 'view_from_manager_create_person', 'online_registration_access_details_person', 'onlineregistration_infos_organization', 'accesses_no_reregistred_list_person', 'accesses_no_reregistred_list_guardians', 'cmf_network_organizations_contactpoint'])]
  114. private $mobilPhone;
  115. /**
  116. * @var string
  117. */
  118. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  119. #[Groups(['contactpoint'])]
  120. private $mobilPhoneInvalid;
  121. /**
  122. * @var string
  123. * @ExportSplitFields({"email","telphoneTemplate","mobilPhoneTemplate"})
  124. */
  125. #[Groups(['template', 'place_list_contactpoint'])]
  126. private $fullLabelTemplate;
  127. /**
  128. * @var string
  129. */
  130. #[Groups(['template'])]
  131. private $telphoneTemplate;
  132. /**
  133. * @var string
  134. */
  135. #[Groups(['template'])]
  136. private $mobilPhoneTemplate;
  137. /**
  138. * @var Organization
  139. */
  140. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Organization\Organization', mappedBy: 'contactPoint')]
  141. private $organization;
  142. /**
  143. * @var Person
  144. */
  145. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Person\Person', mappedBy: 'contactPoint')]
  146. private $person;
  147. /**
  148. * @var Place
  149. */
  150. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Place\Place', mappedBy: 'contactpoint')]
  151. private $place;
  152. /**
  153. *
  154. * @var string
  155. */
  156. #[ORM\Column(type: 'text', nullable: true)]
  157. #[Assert\Type(type: 'string')]
  158. #[Groups(['contactpoint'])]
  159. private $invalidReason;
  160. /**
  161. *
  162. * @var string
  163. */
  164. #[ORM\Column(type: 'text', nullable: true)]
  165. #[Assert\Type(type: 'string')]
  166. private $invalidEmailBody;
  167. /**
  168. *
  169. * @var string
  170. */
  171. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  172. #[Assert\Type(type: 'string')]
  173. private $invalidCat;
  174. /**
  175. *
  176. * @var string
  177. */
  178. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  179. #[Assert\Type(type: 'string')]
  180. private $invalidStatus;
  181. /**
  182. * @var string
  183. * @ExportFilter({"contactType","PRINCIPAL"})
  184. * @ExportSplitFields({"email","telphoneTemplate","mobilPhoneTemplate"})
  185. */
  186. #[Groups(['template'])]
  187. private $fullLabelPrincipalTemplate;
  188. /**
  189. * @var string
  190. * @ExportFilter({"contactType","CONTACT"})
  191. * @ExportSplitFields({"email","telphoneTemplate","mobilPhoneTemplate"})
  192. */
  193. #[Groups(['template'])]
  194. private $fullLabelContactTemplate;
  195. /**
  196. * @var string
  197. * @ExportFilter({"contactType","BILL"})
  198. * @ExportSplitFields({"email","telphoneTemplate","mobilPhoneTemplate"})
  199. */
  200. #[Groups(['template'])]
  201. private $fullLabelBillTemplate;
  202. /**
  203. * Constructor
  204. */
  205. public function __construct()
  206. {
  207. $this->organization = new \Doctrine\Common\Collections\ArrayCollection();
  208. $this->person = new \Doctrine\Common\Collections\ArrayCollection();
  209. $this->place = new \Doctrine\Common\Collections\ArrayCollection();
  210. }
  211. /**
  212. * Sets id.
  213. *
  214. * @param int $id
  215. *
  216. * @return $this
  217. */
  218. public function setId($id)
  219. {
  220. $this->id = $id;
  221. return $this;
  222. }
  223. /**
  224. * Gets id.
  225. *
  226. * @return int
  227. */
  228. public function getId()
  229. {
  230. return $this->id;
  231. }
  232. /**
  233. * Get organization
  234. *
  235. * @return \Doctrine\Common\Collections\Collection
  236. */
  237. public function getOrganization()
  238. {
  239. return $this->organization;
  240. }
  241. /**
  242. * Get person
  243. *
  244. * @return \Doctrine\Common\Collections\Collection
  245. */
  246. public function getPerson()
  247. {
  248. return $this->person;
  249. }
  250. /**
  251. * Get place
  252. *
  253. * @return \Doctrine\Common\Collections\Collection
  254. */
  255. public function getPlace()
  256. {
  257. return $this->place;
  258. }
  259. /**
  260. * Sets contactType.
  261. *
  262. * @param string $contactType
  263. *
  264. * @return $this
  265. */
  266. public function setContactType($contactType)
  267. {
  268. $this->contactType = $contactType;
  269. return $this;
  270. }
  271. /**
  272. * Gets contactType.
  273. *
  274. * @return string
  275. */
  276. public function getContactType()
  277. {
  278. return $this->contactType;
  279. }
  280. /**
  281. * Sets email.
  282. *
  283. * @param string $email
  284. *
  285. * @return $this
  286. */
  287. public function setEmail($email)
  288. {
  289. $this->email = $email;
  290. if(!is_null($email) && !is_null($this->getEmailInvalid()))
  291. $this->setEmailInvalid(NULL);
  292. return $this;
  293. }
  294. /**
  295. * Gets email.
  296. *
  297. * @return string
  298. */
  299. public function getEmail()
  300. {
  301. return $this->email;
  302. }
  303. /**
  304. * Sets email Invalid.
  305. *
  306. * @param string $emailInvalid
  307. *
  308. * @return $this
  309. */
  310. public function setEmailInvalid($emailInvalid)
  311. {
  312. $this->emailInvalid = is_null($this->email) ? $emailInvalid : NULL;
  313. return $this;
  314. }
  315. /**
  316. * Gets email Invalid.
  317. *
  318. * @return string
  319. */
  320. public function getEmailInvalid()
  321. {
  322. return $this->emailInvalid;
  323. }
  324. /**
  325. * Sets faxNumber.
  326. *
  327. * @param string $faxNumber
  328. *
  329. * @return $this
  330. */
  331. public function setFaxNumber($faxNumber)
  332. {
  333. if(empty($faxNumber))$faxNumber = null;
  334. if(is_null($faxNumber)) $this->faxNumber = $faxNumber;
  335. else{
  336. $phoneUtil = PhoneNumberUtil::getInstance();
  337. $phoneNumber = $phoneUtil->parse($faxNumber, PhoneNumberUtil::UNKNOWN_REGION);
  338. $this->faxNumber = $phoneNumber;
  339. }
  340. if(!is_null($this->faxNumber) && !is_null($this->getFaxNumberInvalid()))
  341. $this->setFaxNumberInvalid(NULL);
  342. return $this;
  343. }
  344. /**
  345. * Gets faxNumber.
  346. *
  347. * @return string
  348. */
  349. public function getFaxNumber()
  350. {
  351. return $this->faxNumber;
  352. }
  353. /**
  354. * Sets faxNumber Invalid.
  355. *
  356. * @param string $faxNumberInvalid
  357. *
  358. * @return $this
  359. */
  360. public function setFaxNumberInvalid($faxNumberInvalid)
  361. {
  362. $this->faxNumberInvalid = is_null($this->faxNumber) ? $faxNumberInvalid : NULL;
  363. return $this;
  364. }
  365. /**
  366. * Gets faxNumber Invalid.
  367. *
  368. * @return string
  369. */
  370. public function getFaxNumberInvalid()
  371. {
  372. return $this->faxNumberInvalid;
  373. }
  374. /**
  375. * Sets telphone.
  376. *
  377. * @param string $telphone
  378. *
  379. * @return $this
  380. */
  381. public function setTelphone($telphone)
  382. {
  383. if(empty($telphone))$telphone = null;
  384. if(is_null($telphone)) $this->telphone = $telphone;
  385. else{
  386. $phoneUtil = PhoneNumberUtil::getInstance();
  387. $phoneNumber = $phoneUtil->parse($telphone, PhoneNumberUtil::UNKNOWN_REGION);
  388. $this->telphone = $phoneNumber;
  389. }
  390. if(!is_null($this->telphone) && !is_null($this->getTelphoneInvalid()))
  391. $this->setTelphoneInvalid(NULL);
  392. return $this;
  393. }
  394. public function setPhoneNumberTelphone(PhoneNumber $phoneNumberTelphone)
  395. {
  396. $this->telphone = $phoneNumberTelphone;
  397. }
  398. /**
  399. * Gets telphone.
  400. *
  401. * @return string
  402. */
  403. public function getTelphone()
  404. {
  405. return $this->telphone;
  406. }
  407. /**
  408. * Sets telphone Invalid.
  409. *
  410. * @param string $telphoneInvalid
  411. *
  412. * @return $this
  413. */
  414. public function setTelphoneInvalid($telphoneInvalid)
  415. {
  416. $this->telphoneInvalid = is_null($this->telphone) ? $telphoneInvalid : NULL;
  417. return $this;
  418. }
  419. /**
  420. * Gets telphone Invalid.
  421. *
  422. * @return string
  423. */
  424. public function getTelphoneInvalid()
  425. {
  426. return $this->telphoneInvalid;
  427. }
  428. /**
  429. * Sets mobilPhone.
  430. *
  431. * @param string $mobilPhone
  432. *
  433. * @return $this
  434. */
  435. public function setMobilPhone($mobilPhone)
  436. {
  437. if(empty($mobilPhone))$mobilPhone = null;
  438. if(is_null($mobilPhone)) $this->mobilPhone = $mobilPhone;
  439. else{
  440. $phoneUtil = PhoneNumberUtil::getInstance();
  441. $phoneNumber = $phoneUtil->parse($mobilPhone, PhoneNumberUtil::UNKNOWN_REGION);
  442. $this->mobilPhone = $phoneNumber;
  443. }
  444. if(!is_null($this->mobilPhone) && !is_null($this->getMobilPhoneInvalid()))
  445. $this->setMobilPhoneInvalid(NULL);
  446. return $this;
  447. }
  448. public function setPhoneNumberMobilPhone(PhoneNumber $phoneNumberMobilPhone){
  449. $this->mobilPhone = $phoneNumberMobilPhone;
  450. }
  451. /**
  452. * Gets mobilPhone.
  453. *
  454. * @return string
  455. */
  456. public function getMobilPhone()
  457. {
  458. return $this->mobilPhone;
  459. }
  460. /**
  461. * Sets mobilPhone Invalid .
  462. *
  463. * @param string $mobilPhoneInvalid
  464. *
  465. * @return $this
  466. */
  467. public function setMobilPhoneInvalid($mobilPhoneInvalid)
  468. {
  469. $this->mobilPhoneInvalid = is_null($this->mobilPhone) ? $mobilPhoneInvalid : NULL;
  470. return $this;
  471. }
  472. /**
  473. * Gets mobilPhone Invalid.
  474. *
  475. * @return string
  476. */
  477. public function getMobilPhoneInvalid()
  478. {
  479. return $this->mobilPhoneInvalid;
  480. }
  481. /**
  482. * Gets full label.
  483. *
  484. * @return array
  485. */
  486. public function getFullLabelTemplate()
  487. {
  488. return [
  489. $this->getEmail(),
  490. $this->getTelphoneTemplate()[0],
  491. $this->getMobilPhoneTemplate()[0]
  492. ];
  493. }
  494. /**
  495. * Gets full label.
  496. *
  497. * @return array
  498. */
  499. public function getTelphoneTemplate()
  500. {
  501. return [
  502. ['type' => 'phone_number', 'value' => $this->getTelphone(), 'separator' => ' / ']
  503. ];
  504. }
  505. /**
  506. * Gets full label.
  507. *
  508. * @return array
  509. */
  510. public function getMobilPhoneTemplate()
  511. {
  512. return [
  513. ['type' => 'phone_number', 'value' => $this->getMobilPhone(), 'separator' => ' / ']
  514. ];
  515. }
  516. /**
  517. * Add organization
  518. *
  519. * @param \AppBundle\Entity\Organization\Organization $organization
  520. *
  521. * @return ContactPoint
  522. */
  523. public function addOrganization(\AppBundle\Entity\Organization\Organization $organization)
  524. {
  525. $this->organization[] = $organization;
  526. return $this;
  527. }
  528. /**
  529. * Remove organization
  530. *
  531. * @param \AppBundle\Entity\Organization\Organization $organization
  532. */
  533. public function removeOrganization(\AppBundle\Entity\Organization\Organization $organization)
  534. {
  535. $this->organization->removeElement($organization);
  536. }
  537. /**
  538. * Add person
  539. *
  540. * @param \AppBundle\Entity\Person\Person $person
  541. *
  542. * @return ContactPoint
  543. */
  544. public function addPerson(\AppBundle\Entity\Person\Person $person)
  545. {
  546. $this->person[] = $person;
  547. return $this;
  548. }
  549. /**
  550. * Remove person
  551. *
  552. * @param \AppBundle\Entity\Person\Person $person
  553. */
  554. public function removePerson(\AppBundle\Entity\Person\Person $person)
  555. {
  556. $person->removeContactPoint($this);
  557. $this->person->removeElement($person);
  558. }
  559. /**
  560. * Add place
  561. *
  562. * @param \AppBundle\Entity\Place\Place $place
  563. *
  564. * @return ContactPoint
  565. */
  566. public function addPlace(\AppBundle\Entity\Place\Place $place)
  567. {
  568. $this->place[] = $place;
  569. return $this;
  570. }
  571. /**
  572. * Remove place
  573. *
  574. * @param \AppBundle\Entity\Place\Place $place
  575. */
  576. public function removePlace(\AppBundle\Entity\Place\Place $place)
  577. {
  578. $this->place->removeElement($place);
  579. }
  580. /**
  581. * Gets invalidReason.
  582. *
  583. * @return string
  584. */
  585. public function getInvalidReason()
  586. {
  587. return $this->invalidReason;
  588. }
  589. /**
  590. * Sets invalidReason
  591. *
  592. * @param string $invalidReason
  593. *
  594. * @return $this
  595. */
  596. public function setInvalidReason($invalidReason)
  597. {
  598. $this->invalidReason = $invalidReason;
  599. return $this;
  600. }
  601. /**
  602. * @return string
  603. */
  604. public function getInvalidStatus()
  605. {
  606. return $this->invalidStatus;
  607. }
  608. /**
  609. * @param string $invalidStatus
  610. */
  611. public function setInvalidStatus($invalidStatus)
  612. {
  613. $this->invalidStatus = $invalidStatus;
  614. }
  615. /**
  616. * Gets full label.
  617. *
  618. * @return array
  619. */
  620. public function getFullLabelPrincipalTemplate()
  621. {
  622. return $this->getFullLabelTemplateByType(ContactPointTypeEnum::PRINCIPAL);
  623. }
  624. /**
  625. * Gets full label.
  626. *
  627. * @return array
  628. */
  629. public function getFullLabelContactTemplate()
  630. {
  631. return $this->getFullLabelTemplateByType(ContactPointTypeEnum::CONTACT);
  632. }
  633. /**
  634. * Gets full label.
  635. *
  636. * @return string
  637. */
  638. public function getFullLabelBillTemplate()
  639. {
  640. return $this->getFullLabelTemplateByType(ContactPointTypeEnum::BILL);
  641. }
  642. /**
  643. * @param $contactPointTypeEnum
  644. * @return array
  645. */
  646. private function getFullLabelTemplateByType($contactPointTypeEnum)
  647. {
  648. $label = [];
  649. if($this->contactType === $contactPointTypeEnum){
  650. $label = [
  651. $this->getEmail(),
  652. ['type' => 'phone_number', 'value' => $this->getTelphone()],
  653. ['type' => 'phone_number', 'value' => $this->getMobilPhone()]
  654. ];
  655. }
  656. return $label;
  657. }
  658. /**
  659. * @return string
  660. */
  661. public function getInvalidEmailBody()
  662. {
  663. return $this->invalidEmailBody;
  664. }
  665. /**
  666. * @param string $invalidEmailBody
  667. */
  668. public function setInvalidEmailBody($invalidEmailBody)
  669. {
  670. $this->invalidEmailBody = $invalidEmailBody;
  671. }
  672. /**
  673. * @return string
  674. */
  675. public function getInvalidCat()
  676. {
  677. return $this->invalidCat;
  678. }
  679. /**
  680. * @param string $invalidCat
  681. */
  682. public function setInvalidCat($invalidCat)
  683. {
  684. $this->invalidCat = $invalidCat;
  685. }
  686. }