<?php
/**
* Created by PhpStorm.
* User: sbrun
* Date: 2018-03-28
* Time: 12:28 PM
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity
* @ORM\Table(name="tclients")
*/
class Clients
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="cnom", type="string", length=255)
*/
protected $nom;
/**
* @ORM\Column(name="crue", type="string", length=100, nullable=true)
*/
protected $rue;
/**
* @ORM\Column(name="crue2", type="string", length=100, nullable=true)
*/
protected $rue2;
/**
* @ORM\Column(name="cville", type="string", length=100, nullable=true)
*/
protected $ville;
/**
* @ORM\Column(name="ccodepostal", type="string", length=25, nullable=true)
*/
protected $codepostal;
/**
* @ORM\Column(name="ctelephone", type="string", length=150, nullable=true)
*/
protected $telephone;
/**
* @ORM\Column(name="cetat", type="integer", nullable=true)
*/
protected $etat;
/**
* @ORM\Column(name="cdateinscription", type="datetime", nullable=true)
*/
protected $dateInscription;
/**
* @ORM\Column(name="cescompte", type="integer")
*/
protected $escompte = 0;
/**
* @ORM\Column(name="cescomptealternatif", type="integer")
*/
protected $escompteAlternatif = 0;
/**
* @ORM\Column(name="cremiseminimal", type="integer")
*/
protected $remiseMinimal = 0;
/**
* @ORM\Column(name="cbloque", type="boolean", nullable=true)
*/
protected $bloque = false;
/**
* @ORM\Column(name="commandePermise", type="boolean", nullable=true)
*/
protected $commandePermise = true;
/**
* @ORM\Column(name="ccommentaire", type="text", nullable=true)
*/
protected $commentaire;
/**
* @ORM\Column(name="cacompterecu", type="float")
*/
protected $acompteRecu = 0;
/**
* @ORM\Column(name="ctemp", type="integer", nullable=true)
*/
protected $temp;
/**
* @ORM\Column(name="cfax", type="string", length=100, nullable=true)
*/
protected $fax;
/**
* @ORM\Column(name="cdateexpiration", type="datetime", nullable=true)
*/
protected $dateExpiration;
/**
* @ORM\Column(name="clocked", type="string", length=150, nullable=true)
*/
protected $locked;
/**
* @ORM\Column(name="cexempttps", type="boolean", nullable=true)
*/
protected $exemptTps;
/**
* @ORM\Column(name="cexemptTvq", type="boolean", nullable=true)
*/
protected $exemptTvq;
/**
* @ORM\Column(name="cexemptnumero", type="string", length=45, nullable=true)
*/
protected $exemptNumero;
/**
* @ORM\Column(name="bc_annuel", type="string", length=255, nullable=true)
*/
protected $bcAnnuel;
/**
* @ORM\Column(name="clivraison", type="integer", nullable=true)
*/
protected $livraison;
/**
* One Clients has many ClientsAdressesLivraison
*
* @ORM\OneToMany(targetEntity="App\Entity\ClientsAdressesLivraison", mappedBy="client")
*/
protected $adressesLivraison;
/**
* has one ClientsType
*
* @ORM\ManyToOne(targetEntity="App\Entity\ClientsType")
* @ORM\JoinColumn(name="cetat", referencedColumnName="id")
*/
protected $type;
/**
* has one Company (Succursale)
*
* @ORM\ManyToOne(targetEntity="App\Entity\Company")
* @ORM\JoinColumn(name="succursale_id", referencedColumnName="id", nullable=true)
*/
protected $succursale;
/**
* @ORM\Column(name="mail", type="string", nullable=true)
*/
protected $mail;
/**
* @ORM\OneToMany(targetEntity="App\Entity\ClientsContacts", mappedBy="client")
*/
protected $clientsContacts;
/**
* One Client has Many mailHistory.
* @ORM\OneToMany(targetEntity="Mail", mappedBy="receivers")
*/
protected $mailsReceive;
public function __construct()
{
$this->adressesLivraison = new ArrayCollection();
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getNom()
{
if (!empty($this->nom)) {
return mb_strtoupper($this->nom);
}
return $this->nom;
}
/**
* @param mixed $nom
*/
public function setNom($nom)
{
$this->nom = $nom;
}
/**
* @return mixed
*/
public function getRue()
{
return $this->rue;
}
/**
* @param mixed $rue
*/
public function setRue($rue)
{
$this->rue = $rue;
}
/**
* @return mixed
*/
public function getRue2()
{
return $this->rue2;
}
/**
* @param mixed $rue2
*/
public function setRue2($rue2)
{
$this->rue2 = $rue2;
}
/**
* @return mixed
*/
public function getVille()
{
return $this->ville;
}
/**
* @param mixed $ville
*/
public function setVille($ville)
{
$this->ville = $ville;
}
/**
* @return mixed
*/
public function getCodepostal()
{
return $this->codepostal;
}
/**
* @param mixed $codepostal
*/
public function setCodepostal($codepostal)
{
$this->codepostal = $codepostal;
}
/**
* @return mixed
*/
public function getTelephone()
{
return $this->telephone;
}
/**
* @param mixed $telephone
*/
public function setTelephone($telephone)
{
$this->telephone = $telephone;
}
/**
* @return mixed
*/
public function getEtat()
{
return $this->etat;
}
/**
* @param mixed $etat
*/
public function setEtat($etat)
{
$this->etat = $etat;
}
/**
* @return mixed
*/
public function getDateInscription()
{
return $this->dateInscription;
}
/**
* @param mixed $dateInscription
*/
public function setDateInscription($dateInscription)
{
$this->dateInscription = $dateInscription;
}
/**
* @return mixed
*/
public function getEscompte()
{
return $this->escompte;
}
/**
* @param mixed $escompte
*/
public function setEscompte($escompte)
{
$this->escompte = $escompte;
}
/**
* @return mixed
*/
public function getEscompteAlternatif()
{
return $this->escompteAlternatif;
}
/**
* @param mixed $escompteAlternatif
*/
public function setEscompteAlternatif($escompteAlternatif)
{
$this->escompteAlternatif = $escompteAlternatif;
}
/**
* @return mixed
*/
public function getRemiseMinimal()
{
return $this->remiseMinimal;
}
/**
* @param mixed $remiseMinimal
*/
public function setRemiseMinimal($remiseMinimal)
{
$this->remiseMinimal = $remiseMinimal;
}
/**
* @return mixed
*/
public function isBloque()
{
return $this->getBloque()?true:false;
}
/**
* @return mixed
*/
public function getBloque()
{
return $this->bloque;
}
/**
* @param mixed $bloque
*/
public function setBloque($bloque)
{
$this->bloque = $bloque;
}
/**
* @return mixed
*/
public function getCommandePermise()
{
return $this->commandePermise;
}
/**
* @param mixed $val
*/
public function setCommandePermise($val)
{
$this->commandePermise = $val;
}
/**
* @return mixed
*/
public function getCommentaire()
{
return $this->commentaire;
}
/**
* @param mixed $commentaire
*/
public function setCommentaire($commentaire)
{
$this->commentaire = $commentaire;
}
/**
* @return mixed
*/
public function getAcompteRecu()
{
return $this->acompteRecu;
}
/**
* @param mixed $acompteRecu
*/
public function setAcompteRecu($acompteRecu)
{
$this->acompteRecu = $acompteRecu;
}
/**
* @return mixed
*/
public function getTemp()
{
return $this->temp;
}
/**
* @param mixed $temp
*/
public function setTemp($temp)
{
$this->temp = $temp;
}
/**
* @return mixed
*/
public function getFax()
{
return $this->fax;
}
/**
* @param mixed $fax
*/
public function setFax($fax)
{
$this->fax = $fax;
}
/**
* @return mixed
*/
public function getDateExpiration()
{
return $this->dateExpiration;
}
/**
* @param mixed $dateExpiration
*/
public function setDateExpiration($dateExpiration)
{
$this->dateExpiration = $dateExpiration;
}
/**
* @return mixed
*/
public function getLocked()
{
return $this->locked;
}
/**
* @param mixed $locked
*/
public function setLocked($locked)
{
$this->locked = $locked;
}
/**
* @return mixed
*/
public function getExemptTps()
{
return $this->exemptTps;
}
/**
* @param mixed $exemptTps
*/
public function setExemptTps($exemptTps)
{
$this->exemptTps = $exemptTps;
}
/**
* @return mixed
*/
public function getExemptTvq()
{
return $this->exemptTvq;
}
/**
* @param mixed $exemptTvq
*/
public function setExemptTvq($exemptTvq)
{
$this->exemptTvq = $exemptTvq;
}
/**
* @return mixed
*/
public function getExemptNumero()
{
return $this->exemptNumero;
}
/**
* @param mixed $exemptNumero
*/
public function setExemptNumero($exemptNumero)
{
$this->exemptNumero = $exemptNumero;
}
/**
* @return mixed
*/
public function getLivraison()
{
return $this->livraison;
}
/**
* @param mixed $livraison
*/
public function setLivraison($livraison)
{
$this->livraison = $livraison;
}
/**
* @return ArrayCollection
*/
public function getAdressesLivraison()
{
return $this->adressesLivraison;
}
/**
* @param ClientsAdressesLivraison $adressesLivraison
* @return $this
*/
public function addAdressesLivraison(ClientsAdressesLivraison $adressesLivraison)
{
$this->adressesLivraison->add($adressesLivraison);
return $this;
}
/**
* @param ArrayCollection $collection
* @return $this
*/
public function setAdressesLivraison(ArrayCollection $collection)
{
$this->adressesLivraison = $collection;
return $this;
}
/**
* @return mixed
*/
public function getType()
{
return $this->type;
}
/**
* @param ClientsType $type
*/
public function setType(ClientsType $type)
{
$this->type = $type;
}
/**
* @return mixed
*/
public function getBcAnnuel()
{
return $this->bcAnnuel;
}
/**
* @param mixed $bcAnnuel
* @return Clients
*/
public function setBcAnnuel($bcAnnuel)
{
$this->bcAnnuel = $bcAnnuel;
return $this;
}
/**
* @return mixed
*/
public function getSuccursale()
{
return $this->succursale;
}
/**
* @param Company $succursale
* @return Clients
*/
public function setSuccursale(Company $succursale)
{
$this->succursale = $succursale;
return $this;
}
/**
* @return mixed
*/
public function getMail()
{
return $this->mail;
}
/**
* @param mixed $mail
*/
public function setMail($mail)
{
$this->mail = $mail;
}
/**
* @return bool
*/
public function isNonClientType()
{
/** @var ClientsType $type */
$type = $this->getType();
if (!empty($type)) {
if ($type->getId() == ClientsType::CLIENT) {
return false;
}
}
return true;
}
/**
* @return mixed
*/
public function getClientsContacts()
{
return $this->clientsContacts;
}
/**
* @return mixed
*/
public function getMailsReceive()
{
return $this->mailsReceive;
}
/**
* @param mixed $mailsReceive
*/
public function setMailsReceive($mailsReceive)
{
$this->mailsReceive = $mailsReceive;
}
public function __toString()
{
return (string)$this->getNom();
}
}