src/Entity/Notes/Note.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Notes;
  3. use App\Entity\Adresses\Adresse;
  4. use App\Entity\Articles\Article;
  5. use App\Entity\Clients\Client;
  6. use App\Entity\Fournisseurs\Fournisseur;
  7. use App\Entity\GestionComerciale\Commande;
  8. use App\Entity\GestionComerciale\CommandeFournisseur;
  9. use App\Entity\Inventaires\Inventaire;
  10. use App\Entity\Kanban\Colonne;
  11. use App\Entity\Kanban\Fiche;
  12. use App\Entity\Projets\Tache;
  13. use App\Entity\Utilisateur\Contact;
  14. use App\Entity\Utilisateur\Utilisateur;
  15. use DateTime;
  16. use Doctrine\ORM\Mapping as ORM;
  17. use Gedmo\Mapping\Annotation as Gedmo;
  18. use Symfony\Component\Validator\Constraints as Assert;
  19. use App\Annotations\SecuredEntity;
  20. /**
  21.  * Note
  22.  *
  23.  * @ORM\Table("note__note")
  24.  * @ORM\Entity(repositoryClass="App\Repository\Notes\NoteRepository")
  25.   * @Gedmo\SoftDeleteable(fieldName="dateSuppression",timeAware=false)
  26.  * @SecuredEntity(name="Note", group="OUTILS")
  27.  */
  28. class Note
  29. {
  30.     /**
  31.      * @ORM\Column(name="id", type="integer")
  32.      * @ORM\Id
  33.      * @ORM\GeneratedValue(strategy="AUTO")
  34.      */
  35.     private $id;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity="App\Entity\Articles\Article")
  38.      * @ORM\JoinColumn(nullable=true)
  39.      * @Assert\Valid
  40.      */
  41.     private $article;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity="App\Entity\Inventaires\Inventaire")
  44.      * @ORM\JoinColumn(nullable=true)
  45.      * @Assert\Valid
  46.      */
  47.     private $inventaire;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\CommandeFournisseur")
  50.      * @ORM\JoinColumn(nullable=true)
  51.      * @Assert\Valid
  52.      */
  53.     private $commandeFournisseur;
  54.     /**
  55.      * @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\Commande", inversedBy="notes")
  56.      * @ORM\JoinColumn(nullable=true)
  57.      * @Assert\Valid
  58.      */
  59.     private $commande;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity="App\Entity\Notes\Note")
  62.      * @ORM\JoinColumn(nullable=true)
  63.      */
  64.     private $parent;
  65.     /**
  66.      * @ORM\Column(name="jeton", type="string", length=255, nullable=true)
  67.      */
  68.     private $jeton;
  69.     /**
  70.      * @ORM\ManyToOne(targetEntity="App\Entity\Adresses\Adresse")
  71.      * @ORM\JoinColumn(nullable=true)
  72.      */
  73.     private $adresse;
  74.     /**
  75.      * @ORM\Column(name="adresse_ville", type="string", length=255, nullable=true)
  76.      */
  77.     private $adresseVille;
  78.     /**
  79.      * @ORM\Column(name="adresse_numero", type="string", length=255, nullable=true)
  80.      */
  81.     private $adresseNumero;
  82.     /**
  83.      * @ORM\Column(name="adresse_rue", type="string", length=255, nullable=true)
  84.      */
  85.     private $adresseRue;
  86.     /**
  87.      * @ORM\Column(name="adresse_cp", type="string", length=255, nullable=true)
  88.      */
  89.     private $adresseCp;
  90.     /**
  91.      * @ORM\Column(name="adresse_complement", type="string", length=255, nullable=true)
  92.      */
  93.     private $adresseComplement;
  94.     /**
  95.      * @ORM\Column(name="adresse_complement2", type="string", length=255, nullable=true)
  96.      */
  97.     private $adresseComplement2;
  98.     /**
  99.      * @ORM\Column(name="libelle", type="string", length=255, nullable=true)
  100.      * @Assert\NotBlank(message="LibellĂ© obligatoire")
  101.      */
  102.     private $libelle;
  103.     /**
  104.      * @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Utilisateur", inversedBy="notes")
  105.      * @ORM\JoinColumn(nullable=true)
  106.      */
  107.     private $utilisateur;
  108.     /**
  109.      * @ORM\ManyToOne(targetEntity="App\Entity\Notes\Categorie")
  110.      * @ORM\JoinColumn(nullable=true)
  111.      */
  112.     private $categorie;
  113.     /**
  114.      * @ORM\ManyToOne(targetEntity="App\Entity\Notes\Statut")
  115.      * @ORM\JoinColumn(nullable=true)
  116.      */
  117.     private $statut;
  118.     /**
  119.      * @ORM\ManyToOne(targetEntity="App\Entity\Clients\Client", inversedBy="notes")
  120.      * @ORM\JoinColumn(nullable=true)
  121.      */
  122.     private $client;
  123.     /**
  124.      * @ORM\ManyToOne(targetEntity="App\Entity\Fournisseurs\Fournisseur")
  125.      * @ORM\JoinColumn(nullable=true)
  126.      */
  127.     private $fournisseur;
  128.     /**
  129.      * @ORM\ManyToOne(targetEntity="App\Entity\Projets\Tache", inversedBy="interventions")
  130.      * @ORM\JoinColumn(nullable=true)
  131.      */
  132.     private $tache;
  133.     /**
  134.      * @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Contact", inversedBy="notes")
  135.      * @ORM\JoinColumn(nullable=true)
  136.      */
  137.     private $contact;
  138.     /**
  139.      * @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Contact")
  140.      * @ORM\JoinColumn(nullable=true)
  141.      */
  142.     private $contactFournisseur;
  143.     /**
  144.      * @ORM\Column(name="message", type="text", nullable=true)
  145.      */
  146.     private $message;
  147.     /**
  148.      * @ORM\Column(name="finRecurrence", type="datetime", nullable=true)
  149.      */
  150.     private $finRecurrence;
  151.     /**
  152.      * @ORM\Column(name="recurrence", type="string", length=255, nullable=true)
  153.      */
  154.     private $recurrence;
  155.     /**
  156.      * @ORM\Column(name="alerte", type="string", length=255, nullable=true)
  157.      */
  158.     private $alerte;
  159.     /**
  160.      * @ORM\Column(name="date", type="datetime", nullable=true)
  161.      */
  162.     private $date;
  163.     /**
  164.      * @ORM\Column(name="dateSuppression", type="datetime", nullable=true)
  165.      */
  166.     private $dateSuppression;
  167.     /**
  168.      * @ORM\Column(name="dateRappel", type="datetime", nullable=true)
  169.      */
  170.     private $dateRappel;
  171.     /**
  172.      * @ORM\Column(name="dateDebut", type="datetime", nullable=true)
  173.      */
  174.     private $dateDebut;
  175.     /**
  176.      * @ORM\Column(name="dateFin", type="datetime", nullable=true)
  177.      */
  178.     private $dateFin;
  179.     /**
  180.      * @ORM\Column(name="termine", type="boolean", nullable=true)
  181.      */
  182.     private $termine;
  183.     /**
  184.      * @ORM\Column(name="mail_rappel_envoye", type="boolean", nullable=true)
  185.      */
  186.     private $mailRappelEnvoye;
  187.     /**
  188.      * @ORM\Column(name="prive", type="boolean", nullable=true)
  189.      */
  190.     private $prive;
  191.     /**
  192.      * @ORM\Column(name="dateSaisie", type="datetime", nullable=true)
  193.      */
  194.     private $dateSaisie;
  195.     /**
  196.      * @ORM\Column(name="temps_trajet", type="integer", nullable=true)
  197.      */
  198.     private $tempsTrajet;
  199.     /**
  200.      * @ORM\Column(name="id_import", type="string",length=255, nullable=true)
  201.      */
  202.     private $idImport;
  203.     /**
  204.      * @ORM\Column(name="id_import_2", type="string",length=255, nullable=true)
  205.      */
  206.     private $idImport2;
  207.     /**
  208.      * @ORM\Column(name="modifiable", type="boolean", nullable=true)
  209.      */
  210.     private $modifiable;
  211.     /**
  212.      * @ORM\Column(name="date_maj", type="datetime", nullable=true)
  213.      * @Gedmo\Timestampable(on="update")
  214.      */
  215.     private $dateMaj;
  216.     /**
  217.      * @ORM\Column(name="date_maj_google", type="datetime", nullable=true)
  218.      */
  219.     private $dateMajGoogle;
  220.     /**
  221.      * @ORM\Column(name="id_fusion", type="integer", nullable=true)
  222.      */
  223.     private $idFusion;
  224.     /**
  225.      * @ORM\ManyToOne(targetEntity="App\Entity\Kanban\Fiche" , inversedBy="notes")
  226.      * @ORM\JoinColumn(nullable=true)
  227.      */
  228.     private $fiche;  
  229.     
  230.     /**
  231.      * @ORM\ManyToOne(targetEntity="App\Entity\Kanban\Colonne")
  232.      * @ORM\JoinColumn(nullable=true)
  233.      */
  234.     private $colonne;
  235.     public function __construct()
  236.     {
  237.         $this->date = new Datetime();
  238.         $this->dateDebut = new Datetime();
  239.         $this->dateSaisie = new Datetime();
  240.         $this->termine false;
  241.         $this->prive 0;
  242.         $this->jeton $this->generateRandomString();
  243.     }    
  244.     public function getId(): ?int
  245.     {
  246.         return $this->id;
  247.     }
  248.     public function setMessage(?string $message): Note
  249.     {
  250.         $this->message $message;
  251.         return $this;
  252.     }
  253.     public function getMessage(): ?string
  254.     {
  255.         return $this->message;
  256.     }
  257.     public function setDate(?DateTime $date): Note
  258.     {
  259.         $this->date $date;
  260.         return $this;
  261.     }
  262.     public function getDate(): ?DateTime
  263.     {
  264.         return $this->date;
  265.     }
  266.     public function setDateSuppression(?DateTime $dateSuppression): Note
  267.     {
  268.         $this->dateSuppression $dateSuppression;
  269.         return $this;
  270.     }
  271.     public function getDateSuppression(): ?DateTime
  272.     {
  273.         return $this->dateSuppression;
  274.     }
  275.     public function setDateRappel(?DateTime $dateRappel): Note
  276.     {
  277.         $this->dateRappel $dateRappel;
  278.         return $this;
  279.     }
  280.     public function getDateRappel(): ?DateTime
  281.     {
  282.         return $this->dateRappel;
  283.     }
  284.     public function setTermine(?bool $termine): Note
  285.     {
  286.         $this->termine $termine;
  287.         return $this;
  288.     }
  289.     public function getTermine(): ?bool
  290.     {
  291.         return $this->termine;
  292.     }
  293.     public function setDateSaisie(?DateTime $dateSaisie): Note
  294.     {
  295.         $this->dateSaisie $dateSaisie;
  296.         return $this;
  297.     }
  298.     public function getDateSaisie(): ?DateTime
  299.     {
  300.         return $this->dateSaisie;
  301.     }
  302.     public function setUtilisateur(?Utilisateur $utilisateur): Note
  303.     {
  304.         $this->utilisateur $utilisateur;
  305.         return $this;
  306.     }
  307.     public function getUtilisateur(): ?Utilisateur
  308.     {
  309.         return $this->utilisateur;
  310.     }
  311.     public function setClient(?Client $client): Note
  312.     {
  313.         $this->client $client;
  314.         return $this;
  315.     }
  316.     public function getClient(): ?Client
  317.     {
  318.         return $this->client;
  319.     }
  320.     public function setContact(?Contact $contact): Note
  321.     {
  322.         $this->contact $contact;
  323.         return $this;
  324.     }
  325.     public function getContact(): ?Contact
  326.     {
  327.         return $this->contact;
  328.     }
  329.     public function setPrive(?bool $prive): Note
  330.     {
  331.         $this->prive $prive;
  332.         return $this;
  333.     }
  334.     public function getPrive(): ?bool
  335.     {
  336.         return $this->prive;
  337.     }
  338.     public function setCategorie(?Categorie $categorie): Note
  339.     {
  340.         $this->categorie $categorie;
  341.         return $this;
  342.     }
  343.     public function getCategorie(): ?Categorie
  344.     {
  345.         return $this->categorie;
  346.     }
  347.     public function setStatut(?Statut $statut): Note
  348.     {
  349.         $this->statut $statut;
  350.         return $this;
  351.     }
  352.     public function getStatut(): ?Statut
  353.     {
  354.         return $this->statut;
  355.     }
  356.     public function setLibelle(?string $libelle): Note
  357.     {
  358.         $this->libelle $libelle;
  359.         return $this;
  360.     }
  361.     public function getLibelle(): ?string
  362.     {
  363.         return $this->libelle;
  364.     }
  365.     public function setDateDebut(?DateTime $dateDebut): Note
  366.     {
  367.         $this->dateDebut $dateDebut;
  368.         return $this;
  369.     }
  370.     public function getDateDebut(): ?DateTime
  371.     {
  372.         return $this->dateDebut;
  373.     }
  374.     public function setDateFin(?DateTime $dateFin): Note
  375.     {
  376.         $this->dateFin $dateFin;
  377.         return $this;
  378.     }
  379.     public function getDateFin(): ?DateTime
  380.     {
  381.         return $this->dateFin;
  382.     }
  383.     public function setIdImport(?string $idImport): Note
  384.     {
  385.         $this->idImport $idImport;
  386.         return $this;
  387.     }
  388.     public function getIdImport(): ?string
  389.     {
  390.         return $this->idImport;
  391.     }
  392.     public function getEcheance(): float
  393.     {
  394.         $now =  time();// or your date as well
  395.         $your_date strtotime($this->getDateDebut()->format("Y-m-d"));
  396.         $datediff $your_date-$now;
  397.         $tempsRestant round($datediff / (60 60 24));
  398.         return $tempsRestant;
  399.     }
  400.     public function setParent(?Note $parent): Note
  401.     {
  402.         $this->parent $parent;
  403.         return $this;
  404.     }
  405.     public function getParent(): ?Note
  406.     {
  407.         return $this->parent;
  408.     }
  409.     public function setFinRecurrence(?DateTime $finRecurrence): Note
  410.     {
  411.         $this->finRecurrence $finRecurrence;
  412.         return $this;
  413.     }
  414.     public function getFinRecurrence(): ?DateTime
  415.     {
  416.         return $this->finRecurrence;
  417.     }
  418.     public function setRecurrence(?string $recurrence): Note
  419.     {
  420.         $this->recurrence $recurrence;
  421.         return $this;
  422.     }
  423.     public function getRecurrence(): ?string
  424.     {
  425.         return $this->recurrence;
  426.     }
  427.     public function setTempsTrajet(?int $tempsTrajet): Note
  428.     {
  429.         $this->tempsTrajet $tempsTrajet;
  430.         return $this;
  431.     }
  432.     public function getTempsTrajet(): ?int
  433.     {
  434.         return $this->tempsTrajet;
  435.     }
  436.     public function setAlerte(?string $alerte): Note
  437.     {
  438.         $this->alerte $alerte;
  439.         return $this;
  440.     }
  441.     public function getAlerte(): ?string
  442.     {
  443.         return $this->alerte;
  444.     }
  445.     public function setMailRappelEnvoye(?bool $mailRappelEnvoye): Note
  446.     {
  447.         $this->mailRappelEnvoye $mailRappelEnvoye;
  448.         return $this;
  449.     }
  450.     public function getMailRappelEnvoye(): ?bool
  451.     {
  452.         return $this->mailRappelEnvoye;
  453.     }
  454.     public function setJeton(?string $jeton): Note
  455.     {
  456.         $this->jeton $jeton;
  457.         return $this;
  458.     }
  459.     public function getJeton(): ?string
  460.     {
  461.         return $this->jeton;
  462.     }
  463.     public function generateRandomString($length 30): string
  464.     {
  465.         $characters '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  466.         $charactersLength strlen($characters);
  467.         $randomString '';
  468.         for ($i 0$i $length$i++) {
  469.             $randomString .= $characters[rand(0$charactersLength 1)];
  470.         }
  471.         return $randomString;
  472.     }
  473.     public function setModifiable(?bool $modifiable): Note
  474.     {
  475.         $this->modifiable $modifiable;
  476.         return $this;
  477.     }
  478.     public function getModifiable(): ?bool
  479.     {
  480.         return $this->modifiable;
  481.     }
  482.     public function setCommandeFournisseur(?CommandeFournisseur $commandeFournisseur): Note
  483.     {
  484.         $this->commandeFournisseur $commandeFournisseur;
  485.         return $this;
  486.     }
  487.     public function getCommandeFournisseur(): ?CommandeFournisseur
  488.     {
  489.         return $this->commandeFournisseur;
  490.     }
  491.     public function setCommande(?Commande $commande): Note
  492.     {
  493.         $this->commande $commande;
  494.         return $this;
  495.     }
  496.     public function getCommande(): ?Commande
  497.     {
  498.         return $this->commande;
  499.     }
  500.     public function setFournisseur(?Fournisseur $fournisseur): Note
  501.     {
  502.         $this->fournisseur $fournisseur;
  503.         return $this;
  504.     }
  505.     public function getFournisseur(): ?Fournisseur
  506.     {
  507.         return $this->fournisseur;
  508.     }
  509.     public function setArticle(?Article $article): Note
  510.     {
  511.         $this->article $article;
  512.         return $this;
  513.     }
  514.     public function getArticle(): ?Article
  515.     {
  516.         return $this->article;
  517.     }
  518.     public function setInventaire(?Inventaire $inventaire): Note
  519.     {
  520.         $this->inventaire $inventaire;
  521.         return $this;
  522.     }
  523.     public function getInventaire(): ?Inventaire
  524.     {
  525.         return $this->inventaire;
  526.     }
  527.     public function setDateMaj(?DateTime $dateMaj): Note
  528.     {
  529.         $this->dateMaj $dateMaj;
  530.         return $this;
  531.     }
  532.     public function getDateMaj(): ?DateTime
  533.     {
  534.         return $this->dateMaj;
  535.     }
  536.     public function setDateMajGoogle(?DateTime $dateMajGoogle): Note
  537.     {
  538.         $this->dateMajGoogle $dateMajGoogle;
  539.         return $this;
  540.     }
  541.     public function getDateMajGoogle(): ?DateTime
  542.     {
  543.         return $this->dateMajGoogle;
  544.     }
  545.     public function setIdImport2(?string $idImport2): Note
  546.     {
  547.         $this->idImport2 $idImport2;
  548.         return $this;
  549.     }
  550.     public function getIdImport2(): ?string
  551.     {
  552.         return $this->idImport2;
  553.     }
  554.     public function setAdresseVille(?string $adresseVille): Note
  555.     {
  556.         $this->adresseVille $adresseVille;
  557.         return $this;
  558.     }
  559.     public function getAdresseVille(): ?string
  560.     {
  561.         return $this->adresseVille;
  562.     }
  563.     public function setAdresseNumero(?string $adresseNumero): Note
  564.     {
  565.         $this->adresseNumero $adresseNumero;
  566.         return $this;
  567.     }
  568.     public function getAdresseNumero(): ?string
  569.     {
  570.         return $this->adresseNumero;
  571.     }
  572.     public function setAdresseRue(?string $adresseRue): Note
  573.     {
  574.         $this->adresseRue $adresseRue;
  575.         return $this;
  576.     }
  577.     public function getAdresseRue(): ?string
  578.     {
  579.         return $this->adresseRue;
  580.     }
  581.     public function setAdresseCp(?string $adresseCp): Note
  582.     {
  583.         $this->adresseCp $adresseCp;
  584.         return $this;
  585.     }
  586.     public function getAdresseCp(): ?string
  587.     {
  588.         return $this->adresseCp;
  589.     }
  590.     public function setAdresseComplement(?string $adresseComplement): Note
  591.     {
  592.         $this->adresseComplement $adresseComplement;
  593.         return $this;
  594.     }
  595.     public function getAdresseComplement(): ?string
  596.     {
  597.         return $this->adresseComplement;
  598.     }
  599.     public function setAdresseComplement2(?string $adresseComplement2): Note
  600.     {
  601.         $this->adresseComplement2 $adresseComplement2;
  602.         return $this;
  603.     }
  604.     public function getAdresseComplement2(): ?string
  605.     {
  606.         return $this->adresseComplement2;
  607.     }
  608.     public function setAdresse(?Adresse $adresse): Note
  609.     {
  610.         $this->adresse $adresse;
  611.         return $this;
  612.     }
  613.     public function getAdresse(): ?Adresse
  614.     {
  615.         return $this->adresse;
  616.     }
  617.     public function setIdFusion(?int $idFusion): Note
  618.     {
  619.         $this->idFusion $idFusion;
  620.         return $this;
  621.     }
  622.     public function getIdFusion(): ?int
  623.     {
  624.         return $this->idFusion;
  625.     }
  626.     public function setContactFournisseur(?Contact $contactFournisseur): Note
  627.     {
  628.         $this->contactFournisseur $contactFournisseur;
  629.         return $this;
  630.     }
  631.     public function getContactFournisseur(): ?Contact
  632.     {
  633.         return $this->contactFournisseur;
  634.     }
  635.     public function setFiche(?Fiche $fiche): Note
  636.     {
  637.         $this->fiche $fiche;
  638.         return $this;
  639.     }
  640.     public function getFiche(): ?Fiche
  641.     {
  642.         return $this->fiche;
  643.     }
  644.     public function setColonne(?Colonne $colonne): Note
  645.     {
  646.         $this->colonne $colonne;
  647.         return $this;
  648.     }
  649.     public function getColonne(): ?Colonne
  650.     {
  651.         return $this->colonne;
  652.     }
  653.     public function getTache(): ?Tache
  654.     {
  655.         return $this->tache;
  656.     }
  657.     public function setTache(?Tache $tache): Note
  658.     {
  659.         $this->tache $tache;
  660.         return $this;
  661.     }
  662. }