<?php
namespace App\Entity\System;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\System\CustomerInvoiceAddressRepository")
*
* @ORM\Table(indexes={
*
* @ORM\Index(name="iso_vat_number", columns={"iso_vat_number"}),
* @ORM\Index(name="vat_number", columns={"vat_number"}),
* },
* uniqueConstraints={
*
* @ORM\UniqueConstraint(name="uk_vat_number", columns={"iso_vat_number", "vat_number"})
* })
*/
class CustomerInvoiceAddress implements InvoiceAddressInterface, AddressInterface
{
/**
* @var int
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var Country
*
* @ORM\ManyToOne(targetEntity="App\Entity\System\Country")
*
* @ORM\JoinColumn(referencedColumnName="id_country", nullable=false)
*/
private $country;
/**
* @var State|null
*
* @ORM\ManyToOne(targetEntity="App\Entity\System\State")
*
* @ORM\JoinColumn(referencedColumnName="id_state", nullable=true)
*/
private $state;
/**
* @var string|null
*
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $stateName;
/**
* @var string|null
*
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $company;
/**
* @var string|null
*
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $vatNumber;
/**
* @var \DateTime
*
* @ORM\Column(type="datetime")
*/
private $dateAdd;
/**
* @var \DateTime
*
* @ORM\Column(type="datetime")
*/
private $dateUpd;
/**
* @ORM\Column(type="boolean", options={"default" : 0})
*/
private bool $vise;
/**
* @var bool|null
*
* @ORM\Column(type="boolean", length=4, nullable=true, options={"default" : 0})
*/
private $re;
/**
* @var string|null
*
* @ORM\Column(name="comercial_name", type="string", length=128, nullable=true)
*/
private $commercialName;
/**
* @var int|null
*
* @ORM\Column(type="integer",length=1, nullable=true, options={"default" : 1}))
*/
private $typeCustomer;
/**
* @var string|null
*
* @ORM\Column(type="string", length=50, nullable=true, options={"default" : "1"})
*/
private $contactName;
/**
* @var string|null
*
* @ORM\Column(type="string", length=50, nullable=true, options={"default" : "1"})
*/
private $url;
/**
* @var int
*
* @ORM\Column(type="integer", length=10, options={"default" : 0})
*/
private $phonePrefix;
/**
* @var int
*
* @ORM\Column(type="integer", length=10, options={"default" : 0})
*/
private $phoneMobilePrefix;
/**
* @var string|null
*
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $companyName;
/**
* @var string|null
*
* @ORM\Column(type="string", length=3, nullable=true)
*/
private $isoVatNumber;
/**
* @var Customer
*
* @ORM\OneToOne(targetEntity="App\Entity\System\Customer", inversedBy="customerInvoiceAddress")
*
* @ORM\JoinColumn(referencedColumnName="id_customer", nullable=false)
*/
private $customer;
/**
* @ORM\Column(type="boolean", options={"default" : 0})
*/
private bool $companyVerified = false;
/**
* @var string|null
*
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $eori;
/**
* @var string|null
*
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $voec;
/**
* @var Address
*
* @ORM\OneToOne(targetEntity="App\Entity\System\Address", inversedBy="customerInvoiceAddress")
*
* @ORM\JoinColumn(referencedColumnName="id_address", nullable=false, name="old_address_id")
*/
private $deliveryAddress;
/**
* @ORM\OneToOne(targetEntity="App\Entity\System\CustomerInvoiceAddressEncrypted", cascade={"persist", "remove"})
*
* @ORM\JoinColumn(name="customer_invoice_address_encrypted", referencedColumnName="id")
*/
private ?CustomerInvoiceAddressEncrypted $customerInvoiceAddressEncrypted = null;
private ?string $plainEmail = null;
private ?string $plainName = null;
private ?string $plainSurnames = null;
private ?string $plainPhone = null;
private ?string $plainPhoneMobile = null;
private ?string $plainAddress1 = null;
private ?string $plainAddress2 = null;
private ?string $plainPostcode = null;
private ?string $plainCity = null;
private ?string $plainVatNumber = null;
public function __construct()
{
$this->dateUpd = new \DateTime();
$this->vise = false;
$this->re = false;
$this->typeCustomer = 1;
$this->contactName = '1';
$this->phonePrefix = 0;
$this->phoneMobilePrefix = 0;
$this->dateAdd = new \DateTime();
}
public function getId(): int
{
return $this->id;
}
public function setId(int $id): CustomerInvoiceAddress
{
$this->id = $id;
return $this;
}
/**
* @return Country
*/
public function getCountry(): Country
{
return $this->country;
}
public function setCountry(Country $country): CustomerInvoiceAddress
{
$this->country = $country;
return $this;
}
public function getState(): ?State
{
if ($this->state && $this->state->getId() === 0) {
return null;
}
return $this->state;
}
public function setState(?State $state): CustomerInvoiceAddress
{
$this->state = $state;
return $this;
}
public function getStateName(): ?string
{
return $this->stateName;
}
public function setStateName(?string $stateName): CustomerInvoiceAddress
{
$this->stateName = $stateName;
return $this;
}
public function getCompany(): ?string
{
return $this->company;
}
public function setCompany(?string $company): CustomerInvoiceAddress
{
$this->company = $company;
return $this;
}
public function getPlainName(): ?string
{
return $this->plainName;
}
public function setPlainName(?string $plainName): CustomerInvoiceAddress
{
$this->plainName = $plainName;
return $this;
}
public function getPlainEmail(): ?string
{
return $this->plainEmail;
}
public function setPlainEmail(?string $plainEmail): CustomerInvoiceAddress
{
$this->plainEmail = $plainEmail;
return $this;
}
public function getPlainSurnames(): ?string
{
return $this->plainSurnames;
}
public function setPlainSurnames(?string $plainSurnames): CustomerInvoiceAddress
{
$this->plainSurnames = $plainSurnames;
return $this;
}
public function getPlainAddress1(): ?string
{
return $this->plainAddress1;
}
public function setPlainAddress1(?string $plainAddress1): CustomerInvoiceAddress
{
$this->plainAddress1 = $plainAddress1;
return $this;
}
public function getPlainAddress2(): ?string
{
return $this->plainAddress2;
}
public function setPlainAddress2(?string $plainAddress2): CustomerInvoiceAddress
{
$this->plainAddress2 = $plainAddress2;
return $this;
}
public function getPlainPostcode(): ?string
{
return $this->plainPostcode;
}
public function setPlainPostcode(?string $plainPostcode): CustomerInvoiceAddress
{
$this->plainPostcode = $plainPostcode;
return $this;
}
public function getPlainCity(): ?string
{
return $this->plainCity;
}
public function setPlainCity(?string $plainCity): CustomerInvoiceAddress
{
$this->plainCity = $plainCity;
return $this;
}
public function getPlainPhone(): ?string
{
return $this->plainPhone;
}
public function setPlainPhone(?string $plainPhone): CustomerInvoiceAddress
{
$this->plainPhone = $plainPhone;
return $this;
}
public function getPlainPhoneMobile(): ?string
{
return $this->plainPhoneMobile;
}
public function setPlainPhoneMobile(?string $plainPhoneMobile): CustomerInvoiceAddress
{
$this->plainPhoneMobile = $plainPhoneMobile;
return $this;
}
public function getVatNumber(): ?string
{
return $this->vatNumber;
}
public function setVatNumber(?string $vatNumber): CustomerInvoiceAddress
{
$this->vatNumber = preg_replace('/[^A-Za-z0-9]/i', '', $vatNumber);
return $this;
}
public function getPlainVatNumber(): ?string
{
return $this->plainVatNumber;
}
public function setPlainVatNumber(?string $plainVatNumber): CustomerInvoiceAddress
{
$this->plainVatNumber = $plainVatNumber;
return $this;
}
/**
* @return \DateTime
*/
public function getDateAdd(): \DateTime
{
return $this->dateAdd;
}
public function setDateAdd(\DateTime $dateAdd): CustomerInvoiceAddress
{
$this->dateAdd = $dateAdd;
return $this;
}
public function getDateUpd(): \DateTime
{
return $this->dateUpd;
}
public function setDateUpd(\DateTime $dateUpd): CustomerInvoiceAddress
{
$this->dateUpd = $dateUpd;
return $this;
}
public function getVise(): ?bool
{
return $this->vise;
}
public function setVise(?bool $vise): CustomerInvoiceAddress
{
$this->vise = $vise;
return $this;
}
public function getRe(): ?bool
{
return $this->re;
}
public function setRe(?bool $re): CustomerInvoiceAddress
{
$this->re = $re;
return $this;
}
public function getCommercialName(): ?string
{
return $this->commercialName;
}
public function setCommercialName(?string $commercialName): CustomerInvoiceAddress
{
$this->commercialName = $commercialName;
return $this;
}
public function getTypeCustomer(): ?int
{
return $this->typeCustomer;
}
public function setTypeCustomer(int $typeCustomer): CustomerInvoiceAddress
{
$this->typeCustomer = $typeCustomer;
return $this;
}
public function getContactName(): ?string
{
return $this->contactName;
}
public function setContactName(?string $contactName): CustomerInvoiceAddress
{
$this->contactName = $contactName;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): CustomerInvoiceAddress
{
$this->url = $url;
return $this;
}
public function getPhonePrefix(): int
{
return $this->phonePrefix;
}
public function setPhonePrefix(int $phonePrefix): CustomerInvoiceAddress
{
$this->phonePrefix = $phonePrefix;
return $this;
}
public function getPhoneMobilePrefix(): int
{
return $this->phoneMobilePrefix;
}
public function setPhoneMobilePrefix(int $phoneMobilePrefix): CustomerInvoiceAddress
{
$this->phoneMobilePrefix = $phoneMobilePrefix;
return $this;
}
public function getCompanyName(): ?string
{
return $this->companyName;
}
public function setCompanyName(?string $companyName): CustomerInvoiceAddress
{
$this->companyName = $companyName;
return $this;
}
public function getCustomer(): Customer
{
return $this->customer;
}
public function setCustomer(Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function getIsoVatNumber(): ?string
{
return $this->isoVatNumber;
}
public function setIsoVatNumber(?string $isoVatNumber): self
{
$this->isoVatNumber = $isoVatNumber;
return $this;
}
public function isCompanyVerified(): bool
{
return $this->companyVerified;
}
public function setCompanyVerified(bool $companyVerified): CustomerInvoiceAddress
{
$this->companyVerified = $companyVerified;
return $this;
}
public function getEori(): ?string
{
return $this->eori;
}
public function setEori(?string $eori): CustomerInvoiceAddress
{
$this->eori = $eori;
return $this;
}
public function getVoec(): ?string
{
return $this->voec;
}
public function setVoec(?string $voec): CustomerInvoiceAddress
{
$this->voec = $voec;
return $this;
}
public function getDeliveryAddress(): Address
{
return $this->deliveryAddress;
}
public function setDeliveryAddress(Address $deliveryAddress): CustomerInvoiceAddress
{
$this->deliveryAddress = $deliveryAddress;
return $this;
}
public function isB2C(): bool
{
return $this->typeCustomer === self::TYPE_INDIVIDUAL;
}
public function getCustomerInvoiceAddressEncrypted(): ?CustomerInvoiceAddressEncrypted
{
return $this->customerInvoiceAddressEncrypted;
}
public function setCustomerInvoiceAddressEncrypted(?CustomerInvoiceAddressEncrypted $customerInvoiceAddressEncrypted): self
{
$this->customerInvoiceAddressEncrypted = $customerInvoiceAddressEncrypted;
return $this;
}
}