src/Entity/System/CustomerInvoiceAddress.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * @ORM\Entity(repositoryClass="App\Repository\System\CustomerInvoiceAddressRepository")
  6. *
  7. * @ORM\Table(indexes={
  8. *
  9. * @ORM\Index(name="iso_vat_number", columns={"iso_vat_number"}),
  10. * @ORM\Index(name="vat_number", columns={"vat_number"}),
  11. * },
  12. * uniqueConstraints={
  13. *
  14. * @ORM\UniqueConstraint(name="uk_vat_number", columns={"iso_vat_number", "vat_number"})
  15. * })
  16. */
  17. class CustomerInvoiceAddress implements InvoiceAddressInterface, AddressInterface
  18. {
  19. /**
  20. * @var int
  21. *
  22. * @ORM\Id
  23. *
  24. * @ORM\GeneratedValue(strategy="AUTO")
  25. *
  26. * @ORM\Column(type="integer")
  27. */
  28. private $id;
  29. /**
  30. * @var Country
  31. *
  32. * @ORM\ManyToOne(targetEntity="App\Entity\System\Country")
  33. *
  34. * @ORM\JoinColumn(referencedColumnName="id_country", nullable=false)
  35. */
  36. private $country;
  37. /**
  38. * @var State|null
  39. *
  40. * @ORM\ManyToOne(targetEntity="App\Entity\System\State")
  41. *
  42. * @ORM\JoinColumn(referencedColumnName="id_state", nullable=true)
  43. */
  44. private $state;
  45. /**
  46. * @var string|null
  47. *
  48. * @ORM\Column(type="string", length=50, nullable=true)
  49. */
  50. private $stateName;
  51. /**
  52. * @var string|null
  53. *
  54. * @ORM\Column(type="string", length=64, nullable=true)
  55. */
  56. private $company;
  57. /**
  58. * @var string|null
  59. *
  60. * @ORM\Column(type="string", length=32, nullable=true)
  61. */
  62. private $vatNumber;
  63. /**
  64. * @var \DateTime
  65. *
  66. * @ORM\Column(type="datetime")
  67. */
  68. private $dateAdd;
  69. /**
  70. * @var \DateTime
  71. *
  72. * @ORM\Column(type="datetime")
  73. */
  74. private $dateUpd;
  75. /**
  76. * @ORM\Column(type="boolean", options={"default" : 0})
  77. */
  78. private bool $vise;
  79. /**
  80. * @var bool|null
  81. *
  82. * @ORM\Column(type="boolean", length=4, nullable=true, options={"default" : 0})
  83. */
  84. private $re;
  85. /**
  86. * @var string|null
  87. *
  88. * @ORM\Column(name="comercial_name", type="string", length=128, nullable=true)
  89. */
  90. private $commercialName;
  91. /**
  92. * @var int|null
  93. *
  94. * @ORM\Column(type="integer",length=1, nullable=true, options={"default" : 1}))
  95. */
  96. private $typeCustomer;
  97. /**
  98. * @var string|null
  99. *
  100. * @ORM\Column(type="string", length=50, nullable=true, options={"default" : "1"})
  101. */
  102. private $contactName;
  103. /**
  104. * @var string|null
  105. *
  106. * @ORM\Column(type="string", length=50, nullable=true, options={"default" : "1"})
  107. */
  108. private $url;
  109. /**
  110. * @var int
  111. *
  112. * @ORM\Column(type="integer", length=10, options={"default" : 0})
  113. */
  114. private $phonePrefix;
  115. /**
  116. * @var int
  117. *
  118. * @ORM\Column(type="integer", length=10, options={"default" : 0})
  119. */
  120. private $phoneMobilePrefix;
  121. /**
  122. * @var string|null
  123. *
  124. * @ORM\Column(type="string", length=64, nullable=true)
  125. */
  126. private $companyName;
  127. /**
  128. * @var string|null
  129. *
  130. * @ORM\Column(type="string", length=3, nullable=true)
  131. */
  132. private $isoVatNumber;
  133. /**
  134. * @var Customer
  135. *
  136. * @ORM\OneToOne(targetEntity="App\Entity\System\Customer", inversedBy="customerInvoiceAddress")
  137. *
  138. * @ORM\JoinColumn(referencedColumnName="id_customer", nullable=false)
  139. */
  140. private $customer;
  141. /**
  142. * @ORM\Column(type="boolean", options={"default" : 0})
  143. */
  144. private bool $companyVerified = false;
  145. /**
  146. * @var string|null
  147. *
  148. * @ORM\Column(type="string", length=64, nullable=true)
  149. */
  150. private $eori;
  151. /**
  152. * @var string|null
  153. *
  154. * @ORM\Column(type="string", length=64, nullable=true)
  155. */
  156. private $voec;
  157. /**
  158. * @var Address
  159. *
  160. * @ORM\OneToOne(targetEntity="App\Entity\System\Address", inversedBy="customerInvoiceAddress")
  161. *
  162. * @ORM\JoinColumn(referencedColumnName="id_address", nullable=false, name="old_address_id")
  163. */
  164. private $deliveryAddress;
  165. /**
  166. * @ORM\OneToOne(targetEntity="App\Entity\System\CustomerInvoiceAddressEncrypted", cascade={"persist", "remove"})
  167. *
  168. * @ORM\JoinColumn(name="customer_invoice_address_encrypted", referencedColumnName="id")
  169. */
  170. private ?CustomerInvoiceAddressEncrypted $customerInvoiceAddressEncrypted = null;
  171. private ?string $plainEmail = null;
  172. private ?string $plainName = null;
  173. private ?string $plainSurnames = null;
  174. private ?string $plainPhone = null;
  175. private ?string $plainPhoneMobile = null;
  176. private ?string $plainAddress1 = null;
  177. private ?string $plainAddress2 = null;
  178. private ?string $plainPostcode = null;
  179. private ?string $plainCity = null;
  180. private ?string $plainVatNumber = null;
  181. public function __construct()
  182. {
  183. $this->dateUpd = new \DateTime();
  184. $this->vise = false;
  185. $this->re = false;
  186. $this->typeCustomer = 1;
  187. $this->contactName = '1';
  188. $this->phonePrefix = 0;
  189. $this->phoneMobilePrefix = 0;
  190. $this->dateAdd = new \DateTime();
  191. }
  192. public function getId(): int
  193. {
  194. return $this->id;
  195. }
  196. public function setId(int $id): CustomerInvoiceAddress
  197. {
  198. $this->id = $id;
  199. return $this;
  200. }
  201. /**
  202. * @return Country
  203. */
  204. public function getCountry(): Country
  205. {
  206. return $this->country;
  207. }
  208. public function setCountry(Country $country): CustomerInvoiceAddress
  209. {
  210. $this->country = $country;
  211. return $this;
  212. }
  213. public function getState(): ?State
  214. {
  215. if ($this->state && $this->state->getId() === 0) {
  216. return null;
  217. }
  218. return $this->state;
  219. }
  220. public function setState(?State $state): CustomerInvoiceAddress
  221. {
  222. $this->state = $state;
  223. return $this;
  224. }
  225. public function getStateName(): ?string
  226. {
  227. return $this->stateName;
  228. }
  229. public function setStateName(?string $stateName): CustomerInvoiceAddress
  230. {
  231. $this->stateName = $stateName;
  232. return $this;
  233. }
  234. public function getCompany(): ?string
  235. {
  236. return $this->company;
  237. }
  238. public function setCompany(?string $company): CustomerInvoiceAddress
  239. {
  240. $this->company = $company;
  241. return $this;
  242. }
  243. public function getPlainName(): ?string
  244. {
  245. return $this->plainName;
  246. }
  247. public function setPlainName(?string $plainName): CustomerInvoiceAddress
  248. {
  249. $this->plainName = $plainName;
  250. return $this;
  251. }
  252. public function getPlainEmail(): ?string
  253. {
  254. return $this->plainEmail;
  255. }
  256. public function setPlainEmail(?string $plainEmail): CustomerInvoiceAddress
  257. {
  258. $this->plainEmail = $plainEmail;
  259. return $this;
  260. }
  261. public function getPlainSurnames(): ?string
  262. {
  263. return $this->plainSurnames;
  264. }
  265. public function setPlainSurnames(?string $plainSurnames): CustomerInvoiceAddress
  266. {
  267. $this->plainSurnames = $plainSurnames;
  268. return $this;
  269. }
  270. public function getPlainAddress1(): ?string
  271. {
  272. return $this->plainAddress1;
  273. }
  274. public function setPlainAddress1(?string $plainAddress1): CustomerInvoiceAddress
  275. {
  276. $this->plainAddress1 = $plainAddress1;
  277. return $this;
  278. }
  279. public function getPlainAddress2(): ?string
  280. {
  281. return $this->plainAddress2;
  282. }
  283. public function setPlainAddress2(?string $plainAddress2): CustomerInvoiceAddress
  284. {
  285. $this->plainAddress2 = $plainAddress2;
  286. return $this;
  287. }
  288. public function getPlainPostcode(): ?string
  289. {
  290. return $this->plainPostcode;
  291. }
  292. public function setPlainPostcode(?string $plainPostcode): CustomerInvoiceAddress
  293. {
  294. $this->plainPostcode = $plainPostcode;
  295. return $this;
  296. }
  297. public function getPlainCity(): ?string
  298. {
  299. return $this->plainCity;
  300. }
  301. public function setPlainCity(?string $plainCity): CustomerInvoiceAddress
  302. {
  303. $this->plainCity = $plainCity;
  304. return $this;
  305. }
  306. public function getPlainPhone(): ?string
  307. {
  308. return $this->plainPhone;
  309. }
  310. public function setPlainPhone(?string $plainPhone): CustomerInvoiceAddress
  311. {
  312. $this->plainPhone = $plainPhone;
  313. return $this;
  314. }
  315. public function getPlainPhoneMobile(): ?string
  316. {
  317. return $this->plainPhoneMobile;
  318. }
  319. public function setPlainPhoneMobile(?string $plainPhoneMobile): CustomerInvoiceAddress
  320. {
  321. $this->plainPhoneMobile = $plainPhoneMobile;
  322. return $this;
  323. }
  324. public function getVatNumber(): ?string
  325. {
  326. return $this->vatNumber;
  327. }
  328. public function setVatNumber(?string $vatNumber): CustomerInvoiceAddress
  329. {
  330. $this->vatNumber = preg_replace('/[^A-Za-z0-9]/i', '', $vatNumber);
  331. return $this;
  332. }
  333. public function getPlainVatNumber(): ?string
  334. {
  335. return $this->plainVatNumber;
  336. }
  337. public function setPlainVatNumber(?string $plainVatNumber): CustomerInvoiceAddress
  338. {
  339. $this->plainVatNumber = $plainVatNumber;
  340. return $this;
  341. }
  342. /**
  343. * @return \DateTime
  344. */
  345. public function getDateAdd(): \DateTime
  346. {
  347. return $this->dateAdd;
  348. }
  349. public function setDateAdd(\DateTime $dateAdd): CustomerInvoiceAddress
  350. {
  351. $this->dateAdd = $dateAdd;
  352. return $this;
  353. }
  354. public function getDateUpd(): \DateTime
  355. {
  356. return $this->dateUpd;
  357. }
  358. public function setDateUpd(\DateTime $dateUpd): CustomerInvoiceAddress
  359. {
  360. $this->dateUpd = $dateUpd;
  361. return $this;
  362. }
  363. public function getVise(): ?bool
  364. {
  365. return $this->vise;
  366. }
  367. public function setVise(?bool $vise): CustomerInvoiceAddress
  368. {
  369. $this->vise = $vise;
  370. return $this;
  371. }
  372. public function getRe(): ?bool
  373. {
  374. return $this->re;
  375. }
  376. public function setRe(?bool $re): CustomerInvoiceAddress
  377. {
  378. $this->re = $re;
  379. return $this;
  380. }
  381. public function getCommercialName(): ?string
  382. {
  383. return $this->commercialName;
  384. }
  385. public function setCommercialName(?string $commercialName): CustomerInvoiceAddress
  386. {
  387. $this->commercialName = $commercialName;
  388. return $this;
  389. }
  390. public function getTypeCustomer(): ?int
  391. {
  392. return $this->typeCustomer;
  393. }
  394. public function setTypeCustomer(int $typeCustomer): CustomerInvoiceAddress
  395. {
  396. $this->typeCustomer = $typeCustomer;
  397. return $this;
  398. }
  399. public function getContactName(): ?string
  400. {
  401. return $this->contactName;
  402. }
  403. public function setContactName(?string $contactName): CustomerInvoiceAddress
  404. {
  405. $this->contactName = $contactName;
  406. return $this;
  407. }
  408. public function getUrl(): ?string
  409. {
  410. return $this->url;
  411. }
  412. public function setUrl(?string $url): CustomerInvoiceAddress
  413. {
  414. $this->url = $url;
  415. return $this;
  416. }
  417. public function getPhonePrefix(): int
  418. {
  419. return $this->phonePrefix;
  420. }
  421. public function setPhonePrefix(int $phonePrefix): CustomerInvoiceAddress
  422. {
  423. $this->phonePrefix = $phonePrefix;
  424. return $this;
  425. }
  426. public function getPhoneMobilePrefix(): int
  427. {
  428. return $this->phoneMobilePrefix;
  429. }
  430. public function setPhoneMobilePrefix(int $phoneMobilePrefix): CustomerInvoiceAddress
  431. {
  432. $this->phoneMobilePrefix = $phoneMobilePrefix;
  433. return $this;
  434. }
  435. public function getCompanyName(): ?string
  436. {
  437. return $this->companyName;
  438. }
  439. public function setCompanyName(?string $companyName): CustomerInvoiceAddress
  440. {
  441. $this->companyName = $companyName;
  442. return $this;
  443. }
  444. public function getCustomer(): Customer
  445. {
  446. return $this->customer;
  447. }
  448. public function setCustomer(Customer $customer): self
  449. {
  450. $this->customer = $customer;
  451. return $this;
  452. }
  453. public function getIsoVatNumber(): ?string
  454. {
  455. return $this->isoVatNumber;
  456. }
  457. public function setIsoVatNumber(?string $isoVatNumber): self
  458. {
  459. $this->isoVatNumber = $isoVatNumber;
  460. return $this;
  461. }
  462. public function isCompanyVerified(): bool
  463. {
  464. return $this->companyVerified;
  465. }
  466. public function setCompanyVerified(bool $companyVerified): CustomerInvoiceAddress
  467. {
  468. $this->companyVerified = $companyVerified;
  469. return $this;
  470. }
  471. public function getEori(): ?string
  472. {
  473. return $this->eori;
  474. }
  475. public function setEori(?string $eori): CustomerInvoiceAddress
  476. {
  477. $this->eori = $eori;
  478. return $this;
  479. }
  480. public function getVoec(): ?string
  481. {
  482. return $this->voec;
  483. }
  484. public function setVoec(?string $voec): CustomerInvoiceAddress
  485. {
  486. $this->voec = $voec;
  487. return $this;
  488. }
  489. public function getDeliveryAddress(): Address
  490. {
  491. return $this->deliveryAddress;
  492. }
  493. public function setDeliveryAddress(Address $deliveryAddress): CustomerInvoiceAddress
  494. {
  495. $this->deliveryAddress = $deliveryAddress;
  496. return $this;
  497. }
  498. public function isB2C(): bool
  499. {
  500. return $this->typeCustomer === self::TYPE_INDIVIDUAL;
  501. }
  502. public function getCustomerInvoiceAddressEncrypted(): ?CustomerInvoiceAddressEncrypted
  503. {
  504. return $this->customerInvoiceAddressEncrypted;
  505. }
  506. public function setCustomerInvoiceAddressEncrypted(?CustomerInvoiceAddressEncrypted $customerInvoiceAddressEncrypted): self
  507. {
  508. $this->customerInvoiceAddressEncrypted = $customerInvoiceAddressEncrypted;
  509. return $this;
  510. }
  511. }