<?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 $name;
/**
* @var string
*
* @ORM\Column(type="string", length=128)
*/
private $email;
/**
* @var string|null
*
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $surnames;
/**
* @var string
*
* @ORM\Column(type="string", length=128)
*/
private $address1;
/**
* @var string|null
*
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $address2;
/**
* @var string|null
*
* @ORM\Column(type="string", length=12, nullable=true)
*/
private $postcode;
/**
* @var string
*
* @ORM\Column(type="string", length=64)
*/
private $city;
/**
* @var string|null
*
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $phone;
/**
* @var string|null
*
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $phoneMobile;
/**
* @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(type="string", length=128, nullable=true)
*/
private $comercialName;
/**
* @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;
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->address1 = '';
$this->city = '';
$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 getName(): ?string
{
return $this->name;
}
public function setName(?string $name): CustomerInvoiceAddress
{
$this->name = $name;
return $this;
}
public function getEmail(): string
{
return $this->email;
}
public function setEmail(string $email): CustomerInvoiceAddress
{
$this->email = $email;
return $this;
}
public function getSurnames(): ?string
{
return $this->surnames;
}
public function setSurnames(?string $surnames): CustomerInvoiceAddress
{
$this->surnames = $surnames;
return $this;
}
public function getAddress1(): string
{
return $this->address1;
}
public function setAddress1(string $address1): CustomerInvoiceAddress
{
$this->address1 = $address1;
return $this;
}
public function getAddress2(): ?string
{
return $this->address2;
}
public function setAddress2(?string $address2): CustomerInvoiceAddress
{
$this->address2 = $address2;
return $this;
}
public function getPostcode(): ?string
{
return $this->postcode;
}
public function setPostcode(?string $postcode): CustomerInvoiceAddress
{
$this->postcode = $postcode;
return $this;
}
public function getCity(): string
{
return $this->city;
}
public function setCity(string $city): CustomerInvoiceAddress
{
$this->city = $city;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): CustomerInvoiceAddress
{
$this->phone = $phone;
return $this;
}
public function getPhoneMobile(): ?string
{
return $this->phoneMobile;
}
public function setPhoneMobile(?string $phoneMobile): CustomerInvoiceAddress
{
$this->phoneMobile = $phoneMobile;
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;
}
/**
* @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 getComercialName(): ?string
{
return $this->comercialName;
}
public function setComercialName(?string $comercialName): CustomerInvoiceAddress
{
$this->comercialName = $comercialName;
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 getFullName(): ?string
{
return $this->name.' '.$this->surnames;
}
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;
}
}