src/Entity/Utilisateur.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Serializable;
  4. use App\Repository\UtilisateurRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Security\Core\User\UserInterface;
  9. use Doctrine\Persistence\ObjectManagerAware;
  10. use Doctrine\Persistence\Mapping\ClassMetadata;
  11. /**
  12. * @ORM\Entity(repositoryClass=UtilisateurRepository::class)
  13. */
  14. class Utilisateur implements UserInterface, ObjectManagerAware, \Serializable
  15. {
  16. /**
  17. * @ORM\Id()
  18. * @ORM\GeneratedValue()
  19. * @ORM\Column(type="integer")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\Column(type="string", length=180, unique=true)
  24. */
  25. private $email;
  26. /**
  27. * @ORM\Column(type="json")
  28. */
  29. private $roles = [];
  30. /**
  31. * @var string The hashed password
  32. * @ORM\Column(type="string")
  33. */
  34. private $password;
  35. /**
  36. * @ORM\Column(type="string", length=255)
  37. */
  38. private $nom;
  39. /**
  40. * @ORM\Column(type="string", length=255)
  41. */
  42. private $prenom;
  43. /**
  44. * @ORM\Column(type="string", length=255, nullable=true)
  45. */
  46. private $path_image;
  47. /**
  48. * @ORM\Column(type="integer",nullable=true, options={"default" : 0, "comment":"1 for connected user 0 for not connected "})
  49. */
  50. private $enligne;
  51. /**
  52. * @ORM\Column(type="integer", nullable=true)
  53. */
  54. private $extension;
  55. /**
  56. * @ORM\OneToMany(targetEntity=Actualite::class, mappedBy="createur")
  57. */
  58. private $actualites;
  59. /**
  60. * @ORM\OneToMany(targetEntity=Appel::class, mappedBy="agent")
  61. */
  62. private $appels;
  63. /**
  64. * @ORM\OneToMany(targetEntity=Communication::class, mappedBy="sup")
  65. */
  66. private $communications;
  67. /**
  68. * @ORM\OneToMany(targetEntity=Compagne::class, mappedBy="createur")
  69. */
  70. private $compagnes;
  71. /**
  72. * @ORM\OneToMany(targetEntity=Demande::class, mappedBy="createur")
  73. */
  74. private $demandes;
  75. /**
  76. * @ORM\OneToMany(targetEntity=Message::class, mappedBy="agent")
  77. */
  78. private $messages;
  79. /**
  80. * @ORM\OneToMany(targetEntity=Priorite::class, mappedBy="agent")
  81. */
  82. private $priorites;
  83. /**
  84. * @ORM\OneToMany(targetEntity=Projet::class, mappedBy="idCP")
  85. */
  86. private $projets;
  87. /**
  88. * @ORM\OneToMany(targetEntity=Rdv::class, mappedBy="agentEmetteur")
  89. */
  90. private $rdvs;
  91. /**
  92. * @ORM\OneToMany(targetEntity=Seance::class, mappedBy="agent")
  93. */
  94. private $seances;
  95. /**
  96. * @ORM\OneToMany(targetEntity=Suivi::class, mappedBy="user")
  97. */
  98. private $suivis;
  99. /**
  100. * @ORM\OneToMany(targetEntity=Tache::class, mappedBy="agent")
  101. */
  102. private $taches;
  103. /**
  104. * @ORM\OneToMany(targetEntity=UcmCdr::class, mappedBy="agent")
  105. */
  106. private $ucmCdrs;
  107. /**
  108. * @ORM\Column(name="crmServeraddress",type="string", length=255, nullable=true)
  109. */
  110. private $crmServeraddress;
  111. /**
  112. * @ORM\Column(name="crmUsername",type="string", length=255, nullable=true)
  113. */
  114. private $crmUsername;
  115. /**
  116. * @ORM\Column(name="crmPassword",type="string", length=255, nullable=true)
  117. */
  118. private $crmPassword;
  119. /**
  120. * @ORM\ManyToOne(targetEntity=Departement::class, inversedBy="utilisateurs")
  121. * @ORM\JoinColumn(name="id_departement",referencedColumnName="id")
  122. */
  123. private $departement;
  124. /**
  125. * @ORM\Column(name="agentMission",type="integer", nullable=true,options={"default" : 0,"comment":"(1=Emission) (2=Réception)"})
  126. */
  127. private $agentMission;
  128. /**
  129. * @ORM\OneToMany(targetEntity=Client::class, mappedBy="idUser")
  130. */
  131. private $clients;
  132. /**
  133. * @ORM\ManyToMany(targetEntity=Compagne::class, mappedBy="collaborateurs")
  134. */
  135. private $campagnes;
  136. /**
  137. * @ORM\Column(type="string", length=255)
  138. */
  139. private $username;
  140. /**
  141. * @ORM\Column(name="lastAccess",type="string", length=255, nullable=true)
  142. */
  143. private $lastAccess;
  144. /**
  145. * @ORM\Column(name="calendarId",type="string", length=255, nullable=true,options={"comment":"id google calendar sur le compte elearning@ideolearning.com"})
  146. */
  147. private $calendarId;
  148. /**
  149. * @ORM\Column(type="integer",nullable=true, options={"default" : 1,"comment":"(0=inactive) (1=active) (2=deleted)"})
  150. */
  151. private $status;
  152. /**
  153. * @ORM\ManyToMany(targetEntity="Projet", mappedBy="coaches")
  154. * @ORM\JoinTable(name="projet_coach")
  155. */
  156. private $coachProjects;
  157. /**
  158. * Init Object Manager
  159. */
  160. private $em;
  161. /**
  162. * Initialiser ObjectManager pour qu'on puisse utiliser Reporistory dans l'entity
  163. *
  164. * @param ObjectManager $objectManager
  165. * @param ClassMetadata $classMetadata
  166. * @return void
  167. */
  168. public function injectObjectManager(\Doctrine\Persistence\ObjectManager $objectManager, ClassMetadata $classMetadata = null)
  169. {
  170. $this->em = $objectManager;
  171. }
  172. public function __construct()
  173. {
  174. $this->actualites = new ArrayCollection();
  175. $this->appels = new ArrayCollection();
  176. $this->communications = new ArrayCollection();
  177. $this->compagnes = new ArrayCollection();
  178. $this->demandes = new ArrayCollection();
  179. $this->messages = new ArrayCollection();
  180. $this->priorites = new ArrayCollection();
  181. $this->projets = new ArrayCollection();
  182. $this->rdvs = new ArrayCollection();
  183. $this->seances = new ArrayCollection();
  184. $this->suivis = new ArrayCollection();
  185. $this->taches = new ArrayCollection();
  186. $this->ucmCdrs = new ArrayCollection();
  187. $this->clients = new ArrayCollection();
  188. $this->campagnes = new ArrayCollection();
  189. $this->coachProjects = new ArrayCollection();
  190. }
  191. public function getId(): ?int
  192. {
  193. return $this->id;
  194. }
  195. public function getEmail(): ?string
  196. {
  197. return $this->email;
  198. }
  199. public function setEmail(string $email): self
  200. {
  201. $this->email = $email;
  202. return $this;
  203. }
  204. /**
  205. * A visual identifier that represents this user.
  206. *
  207. * @see UserInterface
  208. */
  209. public function getUsername(): string
  210. {
  211. return (string) $this->email;
  212. }
  213. /**
  214. * @see UserInterface
  215. */
  216. public function getRoles(): array
  217. {
  218. $roles = $this->roles;
  219. // guarantee every user at least has ROLE_USER
  220. $roles[] = 'ROLE_USER';
  221. return array_unique($roles);
  222. }
  223. public function setRoles(array $roles): self
  224. {
  225. $this->roles = $roles;
  226. return $this;
  227. }
  228. /**
  229. * @see UserInterface
  230. */
  231. public function getPassword(): string
  232. {
  233. return (string) $this->password;
  234. }
  235. public function setPassword(string $password): self
  236. {
  237. $this->password = $password;
  238. return $this;
  239. }
  240. /**
  241. * @see UserInterface
  242. */
  243. public function getSalt()
  244. {
  245. // not needed when using the "bcrypt" algorithm in security.yaml
  246. }
  247. /**
  248. * @see UserInterface
  249. */
  250. public function eraseCredentials()
  251. {
  252. // If you store any temporary, sensitive data on the user, clear it here
  253. // $this->plainPassword = null;
  254. }
  255. public function getNom(): ?string
  256. {
  257. return $this->nom;
  258. }
  259. public function setNom(string $nom): self
  260. {
  261. $this->nom = $nom;
  262. return $this;
  263. }
  264. public function getPrenom(): ?string
  265. {
  266. return $this->prenom;
  267. }
  268. public function setPrenom(string $prenom): self
  269. {
  270. $this->prenom = $prenom;
  271. return $this;
  272. }
  273. public function getPathImage(): ?string
  274. {
  275. return $this->path_image;
  276. }
  277. public function setPathImage(?string $path_image): self
  278. {
  279. $this->path_image = $path_image;
  280. return $this;
  281. }
  282. public function getEnligne(): ?int
  283. {
  284. return $this->enligne;
  285. }
  286. public function setEnligne(int $enligne): self
  287. {
  288. $this->enligne = $enligne;
  289. return $this;
  290. }
  291. public function getStatus(): ?int
  292. {
  293. return $this->status;
  294. }
  295. public function setStatus(int $status): self
  296. {
  297. $this->status = $status;
  298. return $this;
  299. }
  300. public function getExtension(): ?int
  301. {
  302. return $this->extension;
  303. }
  304. public function setExtension(?int $extension): self
  305. {
  306. $this->extension = $extension;
  307. return $this;
  308. }
  309. /**
  310. * @return Collection|Actualite[]
  311. */
  312. public function getActualites(): Collection
  313. {
  314. return $this->actualites;
  315. }
  316. public function addActualite(Actualite $actualite): self
  317. {
  318. if (!$this->actualites->contains($actualite)) {
  319. $this->actualites[] = $actualite;
  320. $actualite->setCreateur($this);
  321. }
  322. return $this;
  323. }
  324. public function removeActualite(Actualite $actualite): self
  325. {
  326. if ($this->actualites->contains($actualite)) {
  327. $this->actualites->removeElement($actualite);
  328. // set the owning side to null (unless already changed)
  329. if ($actualite->getCreateur() === $this) {
  330. $actualite->setCreateur(null);
  331. }
  332. }
  333. return $this;
  334. }
  335. /**
  336. * @return Collection|Appel[]
  337. */
  338. public function getAppels(): Collection
  339. {
  340. return $this->appels;
  341. }
  342. public function addAppel(Appel $appel): self
  343. {
  344. if (!$this->appels->contains($appel)) {
  345. $this->appels[] = $appel;
  346. $appel->setAgent($this);
  347. }
  348. return $this;
  349. }
  350. public function removeAppel(Appel $appel): self
  351. {
  352. if ($this->appels->contains($appel)) {
  353. $this->appels->removeElement($appel);
  354. // set the owning side to null (unless already changed)
  355. if ($appel->getAgent() === $this) {
  356. $appel->setAgent(null);
  357. }
  358. }
  359. return $this;
  360. }
  361. /**
  362. * @return Collection|Communication[]
  363. */
  364. public function getCommunications(): Collection
  365. {
  366. return $this->communications;
  367. }
  368. public function addCommunication(Communication $communication): self
  369. {
  370. if (!$this->communications->contains($communication)) {
  371. $this->communications[] = $communication;
  372. $communication->setSup($this);
  373. }
  374. return $this;
  375. }
  376. public function removeCommunication(Communication $communication): self
  377. {
  378. if ($this->communications->contains($communication)) {
  379. $this->communications->removeElement($communication);
  380. // set the owning side to null (unless already changed)
  381. if ($communication->getSup() === $this) {
  382. $communication->setSup(null);
  383. }
  384. }
  385. return $this;
  386. }
  387. /**
  388. * @return Collection|Compagne[]
  389. */
  390. public function getCompagnes(): Collection
  391. {
  392. return $this->compagnes;
  393. }
  394. public function addCompagne(Compagne $compagne): self
  395. {
  396. if (!$this->compagnes->contains($compagne)) {
  397. $this->compagnes[] = $compagne;
  398. $compagne->setCreateur($this);
  399. }
  400. return $this;
  401. }
  402. public function removeCompagne(Compagne $compagne): self
  403. {
  404. if ($this->compagnes->contains($compagne)) {
  405. $this->compagnes->removeElement($compagne);
  406. // set the owning side to null (unless already changed)
  407. if ($compagne->getCreateur() === $this) {
  408. $compagne->setCreateur(null);
  409. }
  410. }
  411. return $this;
  412. }
  413. /**
  414. * @return Collection|Demande[]
  415. */
  416. public function getDemandes(): Collection
  417. {
  418. return $this->demandes;
  419. }
  420. public function addDemande(Demande $demande): self
  421. {
  422. if (!$this->demandes->contains($demande)) {
  423. $this->demandes[] = $demande;
  424. $demande->setCreateur($this);
  425. }
  426. return $this;
  427. }
  428. public function removeDemande(Demande $demande): self
  429. {
  430. if ($this->demandes->contains($demande)) {
  431. $this->demandes->removeElement($demande);
  432. // set the owning side to null (unless already changed)
  433. if ($demande->getCreateur() === $this) {
  434. $demande->setCreateur(null);
  435. }
  436. }
  437. return $this;
  438. }
  439. /**
  440. * @return Collection|Message[]
  441. */
  442. public function getMessages(): Collection
  443. {
  444. return $this->messages;
  445. }
  446. public function addMessage(Message $message): self
  447. {
  448. if (!$this->messages->contains($message)) {
  449. $this->messages[] = $message;
  450. $message->setAgent($this);
  451. }
  452. return $this;
  453. }
  454. public function removeMessage(Message $message): self
  455. {
  456. if ($this->messages->contains($message)) {
  457. $this->messages->removeElement($message);
  458. // set the owning side to null (unless already changed)
  459. if ($message->getAgent() === $this) {
  460. $message->setAgent(null);
  461. }
  462. }
  463. return $this;
  464. }
  465. /**
  466. * @return Collection|Priorite[]
  467. */
  468. public function getPriorites(): Collection
  469. {
  470. return $this->priorites;
  471. }
  472. public function addPriorite(Priorite $priorite): self
  473. {
  474. if (!$this->priorites->contains($priorite)) {
  475. $this->priorites[] = $priorite;
  476. $priorite->setAgent($this);
  477. }
  478. return $this;
  479. }
  480. public function removePriorite(Priorite $priorite): self
  481. {
  482. if ($this->priorites->contains($priorite)) {
  483. $this->priorites->removeElement($priorite);
  484. // set the owning side to null (unless already changed)
  485. if ($priorite->getAgent() === $this) {
  486. $priorite->setAgent(null);
  487. }
  488. }
  489. return $this;
  490. }
  491. /**
  492. * @return Collection|Projet[]
  493. */
  494. public function getProjets(): Collection
  495. {
  496. return $this->projets;
  497. }
  498. public function addProjet(Projet $projet): self
  499. {
  500. if (!$this->projets->contains($projet)) {
  501. $this->projets[] = $projet;
  502. $projet->setIdCP($this);
  503. }
  504. return $this;
  505. }
  506. public function removeProjet(Projet $projet): self
  507. {
  508. if ($this->projets->contains($projet)) {
  509. $this->projets->removeElement($projet);
  510. // set the owning side to null (unless already changed)
  511. if ($projet->getIdCP() === $this) {
  512. $projet->setIdCP(null);
  513. }
  514. }
  515. return $this;
  516. }
  517. /**
  518. * @return Collection|Rdv[]
  519. */
  520. public function getRdvs(): Collection
  521. {
  522. return $this->rdvs;
  523. }
  524. public function addRdv(Rdv $rdv): self
  525. {
  526. if (!$this->rdvs->contains($rdv)) {
  527. $this->rdvs[] = $rdv;
  528. $rdv->setAgentEmetteur($this);
  529. }
  530. return $this;
  531. }
  532. public function removeRdv(Rdv $rdv): self
  533. {
  534. if ($this->rdvs->contains($rdv)) {
  535. $this->rdvs->removeElement($rdv);
  536. // set the owning side to null (unless already changed)
  537. if ($rdv->getAgentEmetteur() === $this) {
  538. $rdv->setAgentEmetteur(null);
  539. }
  540. }
  541. return $this;
  542. }
  543. /**
  544. * @return Collection|Seance[]
  545. */
  546. public function getSeances(): Collection
  547. {
  548. return $this->seances;
  549. }
  550. public function addSeance(Seance $seance): self
  551. {
  552. if (!$this->seances->contains($seance)) {
  553. $this->seances[] = $seance;
  554. $seance->setAgent($this);
  555. }
  556. return $this;
  557. }
  558. public function removeSeance(Seance $seance): self
  559. {
  560. if ($this->seances->contains($seance)) {
  561. $this->seances->removeElement($seance);
  562. // set the owning side to null (unless already changed)
  563. if ($seance->getAgent() === $this) {
  564. $seance->setAgent(null);
  565. }
  566. }
  567. return $this;
  568. }
  569. /**
  570. * @return Collection|Suivi[]
  571. */
  572. public function getSuivis(): Collection
  573. {
  574. return $this->suivis;
  575. }
  576. public function addSuivi(Suivi $suivi): self
  577. {
  578. if (!$this->suivis->contains($suivi)) {
  579. $this->suivis[] = $suivi;
  580. $suivi->setUser($this);
  581. }
  582. return $this;
  583. }
  584. public function removeSuivi(Suivi $suivi): self
  585. {
  586. if ($this->suivis->contains($suivi)) {
  587. $this->suivis->removeElement($suivi);
  588. // set the owning side to null (unless already changed)
  589. if ($suivi->getUser() === $this) {
  590. $suivi->setUser(null);
  591. }
  592. }
  593. return $this;
  594. }
  595. /**
  596. * @return Collection|Tache[]
  597. */
  598. public function getTaches(): Collection
  599. {
  600. return $this->taches;
  601. }
  602. public function addTach(Tache $tach): self
  603. {
  604. if (!$this->taches->contains($tach)) {
  605. $this->taches[] = $tach;
  606. $tach->setAgent($this);
  607. }
  608. return $this;
  609. }
  610. public function removeTach(Tache $tach): self
  611. {
  612. if ($this->taches->contains($tach)) {
  613. $this->taches->removeElement($tach);
  614. // set the owning side to null (unless already changed)
  615. if ($tach->getAgent() === $this) {
  616. $tach->setAgent(null);
  617. }
  618. }
  619. return $this;
  620. }
  621. /**
  622. * @return Collection|UcmCdr[]
  623. */
  624. public function getUcmCdrs(): Collection
  625. {
  626. return $this->ucmCdrs;
  627. }
  628. public function addUcmCdr(UcmCdr $ucmCdr): self
  629. {
  630. if (!$this->ucmCdrs->contains($ucmCdr)) {
  631. $this->ucmCdrs[] = $ucmCdr;
  632. $ucmCdr->setAgent($this);
  633. }
  634. return $this;
  635. }
  636. public function removeUcmCdr(UcmCdr $ucmCdr): self
  637. {
  638. if ($this->ucmCdrs->contains($ucmCdr)) {
  639. $this->ucmCdrs->removeElement($ucmCdr);
  640. // set the owning side to null (unless already changed)
  641. if ($ucmCdr->getAgent() === $this) {
  642. $ucmCdr->setAgent(null);
  643. }
  644. }
  645. return $this;
  646. }
  647. public function getCrmServeraddress(): ?string
  648. {
  649. return $this->crmServeraddress;
  650. }
  651. public function setCrmServeraddress(?string $crmServeraddress): self
  652. {
  653. $this->crmServeraddress = $crmServeraddress;
  654. return $this;
  655. }
  656. public function getCrmUsername(): ?string
  657. {
  658. return $this->crmUsername;
  659. }
  660. public function setCrmUsername(?string $crmUsername): self
  661. {
  662. $this->crmUsername = $crmUsername;
  663. return $this;
  664. }
  665. public function getCrmPassword(): ?string
  666. {
  667. return $this->crmPassword;
  668. }
  669. public function setCrmPassword(?string $crmPassword): self
  670. {
  671. $this->crmPassword = $crmPassword;
  672. return $this;
  673. }
  674. public function getDepartement(): ?Departement
  675. {
  676. return $this->departement;
  677. }
  678. public function setDepartement(?Departement $departement): self
  679. {
  680. $this->departement = $departement;
  681. return $this;
  682. }
  683. public function getAgentMission(): ?int
  684. {
  685. return $this->agentMission;
  686. }
  687. public function setAgentMission(?int $agentMission): self
  688. {
  689. $this->agentMission = $agentMission;
  690. return $this;
  691. }
  692. /**
  693. * @return Collection|Client[]
  694. */
  695. public function getClients(): Collection
  696. {
  697. return $this->clients;
  698. }
  699. public function addClients(Client $clients): self
  700. {
  701. if (!$this->clients->contains($clients)) {
  702. $this->clients[] = $clients;
  703. $clients->setIdUser($this);
  704. }
  705. return $this;
  706. }
  707. public function removeClients(Client $clients): self
  708. {
  709. if ($this->clients->contains($clients)) {
  710. $this->clients->removeElement($clients);
  711. // set the owning side to null (unless already changed)
  712. if ($clients->getIdUser() === $this) {
  713. $clients->setIdUser(null);
  714. }
  715. }
  716. return $this;
  717. }
  718. public function addClient(Client $client): self
  719. {
  720. if (!$this->clients->contains($client)) {
  721. $this->clients[] = $client;
  722. $client->setIdUser($this);
  723. }
  724. return $this;
  725. }
  726. public function removeClient(Client $client): self
  727. {
  728. if ($this->clients->contains($client)) {
  729. $this->clients->removeElement($client);
  730. // set the owning side to null (unless already changed)
  731. if ($client->getIdUser() === $this) {
  732. $client->setIdUser(null);
  733. }
  734. }
  735. return $this;
  736. }
  737. /**
  738. * @return Collection|Compagne[]
  739. */
  740. public function getCampagnes(): Collection
  741. {
  742. return $this->campagnes;
  743. }
  744. public function addCampagne(Compagne $campagne): self
  745. {
  746. if (!$this->campagnes->contains($campagne)) {
  747. $this->campagnes[] = $campagne;
  748. $campagne->addCollaborateur($this);
  749. }
  750. return $this;
  751. }
  752. public function removeCampagne(Compagne $campagne): self
  753. {
  754. if ($this->campagnes->contains($campagne)) {
  755. $this->campagnes->removeElement($campagne);
  756. $campagne->removeCollaborateur($this);
  757. }
  758. return $this;
  759. }
  760. public function setUsername(string $username): self
  761. {
  762. $this->username = $username;
  763. return $this;
  764. }
  765. public function getLastAccess(): ?string
  766. {
  767. return $this->lastAccess;
  768. }
  769. public function setLastAccess(?string $lastAccess): self
  770. {
  771. $this->lastAccess = $lastAccess;
  772. return $this;
  773. }
  774. public function getCalendarId(): ?string
  775. {
  776. return $this->calendarId;
  777. }
  778. public function setCalendarId(?string $calendarId): self
  779. {
  780. $this->calendarId = $calendarId;
  781. return $this;
  782. }
  783. /**
  784. * @return Collection|Projet[]
  785. */
  786. public function getCoachProjects(): Collection
  787. {
  788. return $this->coachProjects;
  789. }
  790. public function addCoachProject(Projet $coachProject): self
  791. {
  792. if (!$this->coachProjects->contains($coachProject)) {
  793. $this->coachProjects[] = $coachProject;
  794. $coachProject->addCoach($this);
  795. }
  796. return $this;
  797. }
  798. public function removeCoachProject(Projet $coachProject): self
  799. {
  800. if ($this->coachProjects->removeElement($coachProject)) {
  801. $coachProject->removeCoach($this);
  802. }
  803. return $this;
  804. }
  805. /**
  806. * Get cdrs Inbound par date
  807. *
  808. * @param string $startDate
  809. * @param string $endDate
  810. * @param boolean $answered
  811. * @return void
  812. */
  813. public function getCdrsInbound($startDate = '', $endDate = '', $answered = false)
  814. {
  815. $cdrRepo = $this->em->getRepository(UcmCdr::class);
  816. $filters = [];
  817. $filters['start'] = $startDate;
  818. $filters['end'] = $endDate;
  819. $filters['idUtilisateur'] = $this->id;
  820. $filters['answered'] = $answered;
  821. $InboundCdrs = $cdrRepo->FindByInbound($filters);
  822. return $InboundCdrs;
  823. }
  824. /**
  825. * Get cdrs Outbound par date
  826. *
  827. * @param string $startDate
  828. * @param string $endDate
  829. * @param boolean $answered
  830. * @return void
  831. */
  832. public function getCdrsOutbound($startDate = '', $endDate = '', $answered = false)
  833. {
  834. $cdrRepo = $this->em->getRepository(UcmCdr::class);
  835. $filters = [];
  836. $filters['start'] = $startDate;
  837. $filters['end'] = $endDate;
  838. $filters['idUtilisateur'] = $this->id;
  839. $filters['answered'] = $answered;
  840. $OutboundCdrs = $cdrRepo->FindByOutbound($filters);
  841. return $OutboundCdrs;
  842. }
  843. /**
  844. * Get cdr occupation time (appel avec reponses et sans réponse)
  845. *
  846. * @param string $startDate
  847. * @param string $endDate
  848. * @param boolean $answered
  849. * @return void
  850. */
  851. public function getCdrsOccupationTime($startDate = '', $endDate = '', $inbound = 3)
  852. {
  853. $cdrRepo = $this->em->getRepository(UcmCdr::class);
  854. $filters = [];
  855. $filters['start'] = $startDate;
  856. $filters['end'] = $endDate;
  857. $filters['idUtilisateur'] = $this->id;
  858. $filters['inbound'] = $inbound;
  859. $occupationTime = $cdrRepo->FindByOccupationTime($filters);
  860. return $occupationTime;
  861. }
  862. /**
  863. * Get cdr occupation time (appel avec reponses et sans réponse)
  864. *
  865. * @param string $startDate
  866. * @param string $endDate
  867. * @param boolean $answered
  868. * @return void
  869. */
  870. public function getCdrsCommunicationTime($startDate = '', $endDate = '', $inbound = 3)
  871. {
  872. $cdrRepo = $this->em->getRepository(UcmCdr::class);
  873. $filters = [];
  874. $filters['start'] = $startDate;
  875. $filters['end'] = $endDate;
  876. $filters['idUtilisateur'] = $this->id;
  877. $filters['inbound'] = $inbound;
  878. $communicationTime = $cdrRepo->FindByCommunicationTime($filters);
  879. return $communicationTime;
  880. }
  881. /**
  882. * =============== implementer la class \Serializable pour regler le probleme : ==========
  883. * =============== Serialization of 'Closure' is not allowed ==========
  884. * =======================================================================================
  885. */
  886. public function serialize()
  887. {
  888. return serialize([
  889. $this->id,
  890. $this->email,
  891. $this->password,
  892. ]);
  893. }
  894. public function unserialize($data)
  895. {
  896. list(
  897. $this->id,
  898. $this->email,
  899. $this->password
  900. ) = unserialize($data);
  901. }
  902. }