src/Entity/Clients.php line 18

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: sbrun
  5.  * Date: 2018-03-28
  6.  * Time: 12:28 PM
  7.  */
  8. namespace App\Entity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. /**
  12.  * @ORM\Entity
  13.  * @ORM\Table(name="tclients")
  14.  */
  15. class Clients
  16. {
  17.     /**
  18.      * @ORM\Column(type="integer")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     protected $id;
  23.     /**
  24.      * @ORM\Column(name="cnom", type="string", length=255)
  25.      */
  26.     protected $nom;
  27.     /**
  28.      * @ORM\Column(name="crue", type="string", length=100, nullable=true)
  29.      */
  30.     protected $rue;
  31.     /**
  32.      * @ORM\Column(name="crue2", type="string", length=100, nullable=true)
  33.      */
  34.     protected $rue2;
  35.     /**
  36.      * @ORM\Column(name="cville", type="string", length=100, nullable=true)
  37.      */
  38.     protected $ville;
  39.     /**
  40.      * @ORM\Column(name="ccodepostal", type="string", length=25, nullable=true)
  41.      */
  42.     protected $codepostal;
  43.     /**
  44.      * @ORM\Column(name="ctelephone", type="string", length=150, nullable=true)
  45.      */
  46.     protected $telephone;
  47.     /**
  48.      * @ORM\Column(name="cetat", type="integer", nullable=true)
  49.      */
  50.     protected $etat;
  51.     /**
  52.      * @ORM\Column(name="cdateinscription", type="datetime", nullable=true)
  53.      */
  54.     protected $dateInscription;
  55.     /**
  56.      * @ORM\Column(name="cescompte", type="integer")
  57.      */
  58.     protected $escompte 0;
  59.     /**
  60.      * @ORM\Column(name="cescomptealternatif", type="integer")
  61.      */
  62.     protected $escompteAlternatif 0;
  63.     /**
  64.      * @ORM\Column(name="cremiseminimal", type="integer")
  65.      */
  66.     protected $remiseMinimal 0;
  67.     /**
  68.      * @ORM\Column(name="cbloque", type="boolean", nullable=true)
  69.      */
  70.     protected $bloque false;
  71.     /**
  72.      * @ORM\Column(name="commandePermise", type="boolean", nullable=true)
  73.      */
  74.     protected $commandePermise true;
  75.     /**
  76.      * @ORM\Column(name="ccommentaire", type="text", nullable=true)
  77.      */
  78.     protected $commentaire;
  79.     /**
  80.      * @ORM\Column(name="cacompterecu", type="float")
  81.      */
  82.     protected $acompteRecu 0;
  83.     /**
  84.      * @ORM\Column(name="ctemp", type="integer", nullable=true)
  85.      */
  86.     protected $temp;
  87.     /**
  88.      * @ORM\Column(name="cfax", type="string", length=100, nullable=true)
  89.      */
  90.     protected $fax;
  91.     /**
  92.      * @ORM\Column(name="cdateexpiration", type="datetime", nullable=true)
  93.      */
  94.     protected $dateExpiration;
  95.     /**
  96.      * @ORM\Column(name="clocked", type="string", length=150, nullable=true)
  97.      */
  98.     protected $locked;
  99.     /**
  100.      * @ORM\Column(name="cexempttps", type="boolean", nullable=true)
  101.      */
  102.     protected $exemptTps;
  103.     /**
  104.      * @ORM\Column(name="cexemptTvq", type="boolean", nullable=true)
  105.      */
  106.     protected $exemptTvq;
  107.     /**
  108.      * @ORM\Column(name="cexemptnumero", type="string", length=45, nullable=true)
  109.      */
  110.     protected $exemptNumero;
  111.     /**
  112.      * @ORM\Column(name="bc_annuel", type="string", length=255, nullable=true)
  113.      */
  114.     protected $bcAnnuel;
  115.     /**
  116.      * @ORM\Column(name="clivraison", type="integer", nullable=true)
  117.      */
  118.     protected $livraison;
  119.     /**
  120.      * One Clients has many ClientsAdressesLivraison
  121.      *
  122.      * @ORM\OneToMany(targetEntity="App\Entity\ClientsAdressesLivraison", mappedBy="client")
  123.      */
  124.     protected $adressesLivraison;
  125.     /**
  126.      * has one ClientsType
  127.      *
  128.      * @ORM\ManyToOne(targetEntity="App\Entity\ClientsType")
  129.      * @ORM\JoinColumn(name="cetat", referencedColumnName="id")
  130.      */
  131.     protected $type;
  132.     /**
  133.      * has one Company (Succursale)
  134.      *
  135.      * @ORM\ManyToOne(targetEntity="App\Entity\Company")
  136.      * @ORM\JoinColumn(name="succursale_id", referencedColumnName="id", nullable=true)
  137.      */
  138.     protected $succursale;
  139.     /**
  140.      * @ORM\Column(name="mail", type="string", nullable=true)
  141.      */
  142.     protected $mail;
  143.     /**
  144.     * @ORM\OneToMany(targetEntity="App\Entity\ClientsContacts", mappedBy="client")
  145.     */
  146.     protected $clientsContacts;
  147.     /**
  148.      * One Client has Many mailHistory.
  149.      * @ORM\OneToMany(targetEntity="Mail", mappedBy="receivers")
  150.      */
  151.     protected $mailsReceive;
  152.     public function __construct()
  153.     {
  154.         $this->adressesLivraison = new ArrayCollection();
  155.     }
  156.     /**
  157.      * @return mixed
  158.      */
  159.     public function getId()
  160.     {
  161.         return $this->id;
  162.     }
  163.     /**
  164.      * @return mixed
  165.      */
  166.     public function getNom()
  167.     {
  168.         if (!empty($this->nom)) {
  169.             return mb_strtoupper($this->nom);
  170.         }
  171.         return $this->nom;
  172.     }
  173.     /**
  174.      * @param mixed $nom
  175.      */
  176.     public function setNom($nom)
  177.     {
  178.         $this->nom $nom;
  179.     }
  180.     /**
  181.      * @return mixed
  182.      */
  183.     public function getRue()
  184.     {
  185.         return $this->rue;
  186.     }
  187.     /**
  188.      * @param mixed $rue
  189.      */
  190.     public function setRue($rue)
  191.     {
  192.         $this->rue $rue;
  193.     }
  194.     /**
  195.      * @return mixed
  196.      */
  197.     public function getRue2()
  198.     {
  199.         return $this->rue2;
  200.     }
  201.     /**
  202.      * @param mixed $rue2
  203.      */
  204.     public function setRue2($rue2)
  205.     {
  206.         $this->rue2 $rue2;
  207.     }
  208.     /**
  209.      * @return mixed
  210.      */
  211.     public function getVille()
  212.     {
  213.         return $this->ville;
  214.     }
  215.     /**
  216.      * @param mixed $ville
  217.      */
  218.     public function setVille($ville)
  219.     {
  220.         $this->ville $ville;
  221.     }
  222.     /**
  223.      * @return mixed
  224.      */
  225.     public function getCodepostal()
  226.     {
  227.         return $this->codepostal;
  228.     }
  229.     /**
  230.      * @param mixed $codepostal
  231.      */
  232.     public function setCodepostal($codepostal)
  233.     {
  234.         $this->codepostal $codepostal;
  235.     }
  236.     /**
  237.      * @return mixed
  238.      */
  239.     public function getTelephone()
  240.     {
  241.         return $this->telephone;
  242.     }
  243.     /**
  244.      * @param mixed $telephone
  245.      */
  246.     public function setTelephone($telephone)
  247.     {
  248.         $this->telephone $telephone;
  249.     }
  250.     /**
  251.      * @return mixed
  252.      */
  253.     public function getEtat()
  254.     {
  255.         return $this->etat;
  256.     }
  257.     /**
  258.      * @param mixed $etat
  259.      */
  260.     public function setEtat($etat)
  261.     {
  262.         $this->etat $etat;
  263.     }
  264.     /**
  265.      * @return mixed
  266.      */
  267.     public function getDateInscription()
  268.     {
  269.         return $this->dateInscription;
  270.     }
  271.     /**
  272.      * @param mixed $dateInscription
  273.      */
  274.     public function setDateInscription($dateInscription)
  275.     {
  276.         $this->dateInscription $dateInscription;
  277.     }
  278.     /**
  279.      * @return mixed
  280.      */
  281.     public function getEscompte()
  282.     {
  283.         return $this->escompte;
  284.     }
  285.     /**
  286.      * @param mixed $escompte
  287.      */
  288.     public function setEscompte($escompte)
  289.     {
  290.         $this->escompte $escompte;
  291.     }
  292.     /**
  293.      * @return mixed
  294.      */
  295.     public function getEscompteAlternatif()
  296.     {
  297.         return $this->escompteAlternatif;
  298.     }
  299.     /**
  300.      * @param mixed $escompteAlternatif
  301.      */
  302.     public function setEscompteAlternatif($escompteAlternatif)
  303.     {
  304.         $this->escompteAlternatif $escompteAlternatif;
  305.     }
  306.     /**
  307.      * @return mixed
  308.      */
  309.     public function getRemiseMinimal()
  310.     {
  311.         return $this->remiseMinimal;
  312.     }
  313.     /**
  314.      * @param mixed $remiseMinimal
  315.      */
  316.     public function setRemiseMinimal($remiseMinimal)
  317.     {
  318.         $this->remiseMinimal $remiseMinimal;
  319.     }
  320.     /**
  321.      * @return mixed
  322.      */
  323.     public function isBloque()
  324.     {
  325.         return $this->getBloque()?true:false;
  326.     }
  327.     /**
  328.      * @return mixed
  329.      */
  330.     public function getBloque()
  331.     {
  332.         return $this->bloque;
  333.     }
  334.     /**
  335.      * @param mixed $bloque
  336.      */
  337.     public function setBloque($bloque)
  338.     {
  339.         $this->bloque $bloque;
  340.     }
  341.     /**
  342.      * @return mixed
  343.      */
  344.     public function getCommandePermise()
  345.     {
  346.         return $this->commandePermise;
  347.     }
  348.     /**
  349.      * @param mixed $val
  350.      */
  351.     public function setCommandePermise($val)
  352.     {
  353.         $this->commandePermise $val;
  354.     }
  355.     /**
  356.      * @return mixed
  357.      */
  358.     public function getCommentaire()
  359.     {
  360.         return $this->commentaire;
  361.     }
  362.     /**
  363.      * @param mixed $commentaire
  364.      */
  365.     public function setCommentaire($commentaire)
  366.     {
  367.         $this->commentaire $commentaire;
  368.     }
  369.     /**
  370.      * @return mixed
  371.      */
  372.     public function getAcompteRecu()
  373.     {
  374.         return $this->acompteRecu;
  375.     }
  376.     /**
  377.      * @param mixed $acompteRecu
  378.      */
  379.     public function setAcompteRecu($acompteRecu)
  380.     {
  381.         $this->acompteRecu $acompteRecu;
  382.     }
  383.     /**
  384.      * @return mixed
  385.      */
  386.     public function getTemp()
  387.     {
  388.         return $this->temp;
  389.     }
  390.     /**
  391.      * @param mixed $temp
  392.      */
  393.     public function setTemp($temp)
  394.     {
  395.         $this->temp $temp;
  396.     }
  397.     /**
  398.      * @return mixed
  399.      */
  400.     public function getFax()
  401.     {
  402.         return $this->fax;
  403.     }
  404.     /**
  405.      * @param mixed $fax
  406.      */
  407.     public function setFax($fax)
  408.     {
  409.         $this->fax $fax;
  410.     }
  411.     /**
  412.      * @return mixed
  413.      */
  414.     public function getDateExpiration()
  415.     {
  416.         return $this->dateExpiration;
  417.     }
  418.     /**
  419.      * @param mixed $dateExpiration
  420.      */
  421.     public function setDateExpiration($dateExpiration)
  422.     {
  423.         $this->dateExpiration $dateExpiration;
  424.     }
  425.     /**
  426.      * @return mixed
  427.      */
  428.     public function getLocked()
  429.     {
  430.         return $this->locked;
  431.     }
  432.     /**
  433.      * @param mixed $locked
  434.      */
  435.     public function setLocked($locked)
  436.     {
  437.         $this->locked $locked;
  438.     }
  439.     /**
  440.      * @return mixed
  441.      */
  442.     public function getExemptTps()
  443.     {
  444.         return $this->exemptTps;
  445.     }
  446.     /**
  447.      * @param mixed $exemptTps
  448.      */
  449.     public function setExemptTps($exemptTps)
  450.     {
  451.         $this->exemptTps $exemptTps;
  452.     }
  453.     /**
  454.      * @return mixed
  455.      */
  456.     public function getExemptTvq()
  457.     {
  458.         return $this->exemptTvq;
  459.     }
  460.     /**
  461.      * @param mixed $exemptTvq
  462.      */
  463.     public function setExemptTvq($exemptTvq)
  464.     {
  465.         $this->exemptTvq $exemptTvq;
  466.     }
  467.     /**
  468.      * @return mixed
  469.      */
  470.     public function getExemptNumero()
  471.     {
  472.         return $this->exemptNumero;
  473.     }
  474.     /**
  475.      * @param mixed $exemptNumero
  476.      */
  477.     public function setExemptNumero($exemptNumero)
  478.     {
  479.         $this->exemptNumero $exemptNumero;
  480.     }
  481.     /**
  482.      * @return mixed
  483.      */
  484.     public function getLivraison()
  485.     {
  486.         return $this->livraison;
  487.     }
  488.     /**
  489.      * @param mixed $livraison
  490.      */
  491.     public function setLivraison($livraison)
  492.     {
  493.         $this->livraison $livraison;
  494.     }
  495.     /**
  496.      * @return ArrayCollection
  497.      */
  498.     public function getAdressesLivraison()
  499.     {
  500.         return $this->adressesLivraison;
  501.     }
  502.     /**
  503.      * @param ClientsAdressesLivraison $adressesLivraison
  504.      * @return $this
  505.      */
  506.     public function addAdressesLivraison(ClientsAdressesLivraison $adressesLivraison)
  507.     {
  508.         $this->adressesLivraison->add($adressesLivraison);
  509.         return $this;
  510.     }
  511.     /**
  512.      * @param ArrayCollection $collection
  513.      * @return $this
  514.      */
  515.     public function setAdressesLivraison(ArrayCollection $collection)
  516.     {
  517.         $this->adressesLivraison $collection;
  518.         return $this;
  519.     }
  520.     /**
  521.      * @return mixed
  522.      */
  523.     public function getType()
  524.     {
  525.         return $this->type;
  526.     }
  527.     /**
  528.      * @param ClientsType $type
  529.      */
  530.     public function setType(ClientsType $type)
  531.     {
  532.         $this->type $type;
  533.     }
  534.     /**
  535.      * @return mixed
  536.      */
  537.     public function getBcAnnuel()
  538.     {
  539.         return $this->bcAnnuel;
  540.     }
  541.     /**
  542.      * @param mixed $bcAnnuel
  543.      * @return Clients
  544.      */
  545.     public function setBcAnnuel($bcAnnuel)
  546.     {
  547.         $this->bcAnnuel $bcAnnuel;
  548.         return $this;
  549.     }
  550.     /**
  551.      * @return mixed
  552.      */
  553.     public function getSuccursale()
  554.     {
  555.         return $this->succursale;
  556.     }
  557.     /**
  558.      * @param Company $succursale
  559.      * @return Clients
  560.      */
  561.     public function setSuccursale(Company $succursale)
  562.     {
  563.         $this->succursale $succursale;
  564.         return $this;
  565.     }
  566.     /**
  567.      * @return mixed
  568.      */
  569.     public function getMail()
  570.     {
  571.         return $this->mail;
  572.     }
  573.     /**
  574.      * @param mixed $mail
  575.      */
  576.     public function setMail($mail)
  577.     {
  578.         $this->mail $mail;
  579.     }
  580.     /**
  581.      * @return bool
  582.      */
  583.     public function isNonClientType()
  584.     {
  585.         /** @var ClientsType $type */
  586.         $type $this->getType();
  587.         if (!empty($type)) {
  588.             if ($type->getId() == ClientsType::CLIENT) {
  589.                 return false;
  590.             }
  591.         }
  592.         return true;
  593.     }
  594.     /**
  595.      * @return mixed
  596.      */
  597.     public function getClientsContacts()
  598.     {
  599.         return $this->clientsContacts;
  600.     }
  601.     /**
  602.      * @return mixed
  603.      */
  604.     public function getMailsReceive()
  605.     {
  606.         return $this->mailsReceive;
  607.     }
  608.     /**
  609.      * @param mixed $mailsReceive
  610.      */
  611.     public function setMailsReceive($mailsReceive)
  612.     {
  613.         $this->mailsReceive $mailsReceive;
  614.     }
  615.     public function __toString()
  616.     {
  617.         return (string)$this->getNom();
  618.     }
  619. }