src/Entity/Users.php line 425

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use App\Model\AppConstant;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\UsersQualification;
  8. use App\Exception\CustomException;
  9. use App\Repository\UsersRepository;
  10. use Doctrine\ORM\EntityManagerInterface;
  11. use Doctrine\Common\Collections\Collection;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Symfony\Component\Validator\Constraints\Date;
  14. use Symfony\Component\Security\Core\User\UserInterface;
  15. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  16. use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
  17. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  18. /**
  19.  * Users
  20.  *
  21.  * @ORM\Table(name="users")
  22.  * @ORM\Entity
  23.  */
  24. #[ORM\Entity(repositoryClassUsersRepository::class)]
  25. #[UniqueEntity(fields: ["username"], message"Cet identifiant d'utilisateur est déjà en cours d'utilisation")]
  26. #[UniqueEntity(fields: ["email"], message"Cet email est déjà en cours d'utilisation")]
  27. #[UniqueEntity(fields: ["phone"], message"Ce numéro est déjà en cours d'utilisation")]
  28. class Users  implements UserInterfacePasswordAuthenticatedUserInterface\JsonSerializable\Serializable
  29. {  
  30.   
  31.     public const GAUCHE 1;
  32.     public const DROITE 2;
  33.     public const ACTIVE 0;
  34.     public const INACTIVE = -1;
  35.     public const SUSPENDED = -2;
  36.     public const CREATED 1;
  37.  
  38.     public const USERS_PROFIL_PICTURE_DIRECTORY "files/users/img/";
  39.     public const COTE_FORM = [
  40.         'Gauche' =>   self::GAUCHE,
  41.         'Droite' =>  self::DROITE,
  42.     ];
  43.     public const TYPE_USER_FORM = [
  44.         'Particulier' =>   self::TYPE_USER_PARTICULIER,
  45.         'Entreprise' =>  self::TYPE_USER_ENTREPRISE,
  46.     ];
  47.     public const TYPE_USER_PARTICULIER 1;
  48.     public const TYPE_USER_ENTREPRISE 2;
  49.     public const KYC_CREATED 1;
  50.     public const KYC_VALIDATED 2;
  51.     public const KYC_DENIED = -1;
  52.     public const KYC_EMPTY 0;
  53.     public const CONTRAT_APPORTEUR_AFFAIRE_NOT_GIVEN 0;
  54.     public const CONTRAT_APPORTEUR_NEED_TO_SEND_MAIL 1;
  55.     public const CONTRAT_APPORTEUR_AFFAIRE_WAITING_SIGNATURE 2;
  56.     public const CONTRAT_APPORTEUR_AFFAIRE_SUBMITTED_WITH_SIGNATURE 3;
  57.     public const CONTRAT_APPORTEUR_AFFAIRE_VALIDATED 4;
  58.     public const CONTRAT_APPORTEUR_AFFAIRE_REJECTED = -1;
  59.     public const ROLE_ADMIN_STAT 'ROLE_ADMIN_STAT';
  60.     public const ROLE_ADMIN_VALIDATION 'ROLE_ADMIN_VALIDATION';
  61.     public const ROLE_ADMIN_CLIENT_ACCESS 'ROLE_ADMIN_CLIENT_ACCESS' ;
  62.     
  63.     public const ADMIN_ROLES_ARRAY = [ 
  64.         self::ROLE_ADMIN_STAT,
  65.         self::ROLE_ADMIN_VALIDATION,
  66.         self::ROLE_ADMIN_CLIENT_ACCESS
  67.     ];
  68.     public const BO_FIRST_LEVEL 1;
  69.     public const BO_SECOND_LEVEL 2;
  70.     public const BO_THIRD_LEVEL 3;
  71.     public const BO_MAX_LEVEL 99;
  72.     /**
  73.      * @var int
  74.      *
  75.      * @ORM\Column(name="ID", type="integer", nullable=false)
  76.      * @ORM\Id
  77.      * @ORM\GeneratedValue(strategy="IDENTITY")
  78.      */
  79.     #[ORM\Id]
  80.     #[ORM\GeneratedValue]
  81.     #[ORM\Column(type'integer')]
  82.     private $id;
  83.     #[ORM\ManyToOne(targetEntityUsers::class)]
  84.     #[ORM\JoinColumn(name"parent_id"referencedColumnName:"id"nullable:true)]
  85.     private $parent;
  86.     #[ORM\ManyToOne(targetEntityUsers::class)]
  87.     #[ORM\JoinColumn(name"upline_id"referencedColumnName:"id"nullable:true)]
  88.     private $upline;
  89.     /**
  90.      * @var int|null
  91.      *
  92.      * @ORM\Column(name="lado", type="integer", nullable=true, options={"default"="1"})
  93.      */
  94.     #[ORM\Column(type'integer',name:'lado',nullable:true,options: ['default' => 1])]
  95.     private $side 1;
  96.     /**
  97.      * @var string|null
  98.      *
  99.      * @ORM\Column(name="name", type="string", length=200, nullable=true)
  100.      */
  101.     #[ORM\Column(type'string',length:200,nullable:true)]
  102.     private $name;
  103.     /**
  104.      * @var string|null
  105.      *
  106.      * @ORM\Column(name="surname", type="string", length=200, nullable=true)
  107.      */
  108.     #[ORM\Column(type'string',length:200,nullable:true)]
  109.     private $surname;
  110.     /**
  111.      * @var string|null
  112.      *
  113.      * @ORM\Column(name="username", type="string", length=200, nullable=true)
  114.      */
  115.     #[ORM\Column(type'string',length:200,nullable:false,unique:true)]
  116.     private $username;
  117.     /**
  118.      * @var string|null
  119.      *
  120.      * @ORM\Column(name="email", type="string", length=300, nullable=true)
  121.      */
  122.     #[ORM\Column(type'string',length:300,nullable:true)]
  123.     private $email;
  124.     /**
  125.      * @var string|null
  126.      *
  127.      * @ORM\Column(name="password", type="string", length=300, nullable=true)
  128.      */
  129.     #[ORM\Column(type'string',length:300,nullable:true)]
  130.     private $password;
  131.     /**
  132.      * @var string|null
  133.      *
  134.      * @ORM\Column(name="phone", type="string", length=200, nullable=true)
  135.      */
  136.     #[ORM\Column(type'string',length:200,nullable:true)]
  137.     private $phone;
  138.     /**
  139.      * @var string|null
  140.      *
  141.      * @ORM\Column(name="address", type="string", length=300, nullable=true)
  142.      */
  143.     #[ORM\Column(type'string',length:300,nullable:true)]
  144.     private $address;
  145.     #[ORM\ManyToOne(targetEntityCountry::class)]
  146.     #[ORM\JoinColumn(name"country"nullablefalse)]
  147.     private $country;
  148.     /**
  149.      * @var string
  150.      *
  151.      * @ORM\Column(name="pic", type="string", length=300, nullable=false, options={"default"="assets/img/users/default.webp"})
  152.      */
  153.     #[ORM\Column(type'string',length:300,nullable:false,options:['default'=>"default.webp"])]
  154.     private $pic 'default.webp';
  155.     /**
  156.      * @var int|null
  157.      *
  158.      * @ORM\Column(name="rango", type="integer", nullable=true)
  159.      */
  160.     #[ORM\Column(type'integer',nullable:true)]
  161.     private $rango;
  162.     /**
  163.      * @var int|null
  164.      *
  165.      * @ORM\Column(name="star", type="integer", nullable=true)
  166.      */
  167.     #[ORM\Column(type'integer',nullable:true)]
  168.     private $star '0';
  169.     /**
  170.      * @var int|null
  171.      *
  172.      * @ORM\Column(name="derrame", type="integer", nullable=true, options={"default"="1"})
  173.      */
  174.     #[ORM\Column(type'integer',nullable:true,options:['default'=>1])]
  175.     private $derrame 1;
  176.     /**
  177.      * @var int|null
  178.      *
  179.      * @ORM\Column(name="permisos", type="integer", nullable=true, options={"default"="2"})
  180.      */
  181.     #[ORM\Column(type'integer',nullable:true,options:['default'=>2])]
  182.     private $permisos 2;
  183.     /**
  184.      * @var int|null
  185.      *
  186.      * @ORM\Column(name="verificado", type="integer", nullable=true)
  187.      */
  188.     #[ORM\Column(type'integer',nullable:true)]
  189.     private $verificado '0';
  190.     /**
  191.      * @var int|null
  192.      *
  193.      * @ORM\Column(name="activo", type="integer", nullable=true)
  194.      */
  195.     #[ORM\Column(type'integer',nullable:true)]
  196.     private $activo '0';
  197.     #[ORM\Column(type'json'nullable:true)]
  198.     private $roles = [];
  199.     #[ORM\Column(type'date',options: ['default' => '2000-01-01'])]
  200.     private $birthdate;
  201.     #[ORM\Column(type'string'length20nullable:true)]
  202.     private $postalCode;
  203.     #[ORM\Column(type'string'length255nullable:true)]
  204.     private $city
  205.     #[ORM\Column(type'integer'nullable:true)]
  206.     private $type 1;
  207.     #[ORM\Column(type'string'length255nullable:true)]
  208.     private $nomSociete
  209.     #[ORM\Column(type'string'length255nullable:true)]
  210.     private $siret
  211.     
  212.     private $plainPassword;
  213.     #[ORM\Column(type'integer',nullabletrue,options: ['default' => '0'])]
  214.     private $countLeftSideUser 0;
  215.     #[ORM\Column(type'integer',nullabletrue,options: ['default' => '0'])]
  216.     private $countRightSideUser 0;
  217.     #[ORM\Column(type'integer',nullable:true,options: ['default' => '0'])]
  218.     private $kycVerification 0;
  219.     #[ORM\OneToMany(targetEntityUsersDocs::class, mappedBy'user')]
  220.     private $docs;
  221.     #[ORM\OneToOne(targetEntityUsersQualification::class, mappedBy'user')]
  222.     private $qualification;
  223.     #[ORM\Column(type'datetime',options: ['default' => '2000-01-01'])]
  224.     private $createdAt;
  225.     #[ORM\Column(type'string',length:200nullable:true,options: ['default' => '0'])]
  226.     private $numero 0;
  227.     #[ORM\Column(type'string',length:200,unique:false,nullable:true)]
  228.     private $pieceIdentite;
  229.     #[ORM\Column(type'integer',nullable:true,options: ['default' => '0'])]
  230.     private $typePieceIdentite 0;
  231.     #[ORM\Column(type'integer',nullable:true,options:['default'=>self::CREATED])]
  232.     private $state self::CREATED;
  233.     
  234.     public $oldPassword;
  235.     public $newPassword;
  236.     public $retypePassword;
  237.     #[ORM\ManyToOne]
  238.     private ?Country $nationality null;
  239.     #[ORM\ManyToOne]
  240.     private ?TypeIdentityDoc $typeIdentityDoc null;
  241.     #[ORM\ManyToOne]
  242.     private ?Country $documentIssueCountry null;
  243.     #[ORM\Column(length255nullabletrue)]
  244.     private ?string $docIdRecto null;
  245.     #[ORM\Column(length255nullabletrue)]
  246.     private ?string $docIdVerso null;
  247.     #[ORM\ManyToOne]
  248.     private ?KycVerificationStatus $kycVerificationStatus null;
  249.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  250.     private ?\DateTimeInterface $dateLastVerification null;
  251.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  252.     private ?string $rejectionReason null;
  253.     #[ORM\Column(length255nullabletrue)]
  254.     private ?string $identity_photo null;
  255.     #[ORM\Column(length255nullabletrue)]
  256.     private ?string $statutSociete null;
  257.     #[ORM\Column(length255nullabletrue)]
  258.     private ?string $pieceJustificativeDomicile null;
  259.     #[ORM\Column(nullabletrue)]
  260.     private ?bool $originKyc null;
  261.     
  262.     #[ORM\Column(type'integer',nullable:true,options: ['default' => '0'])]
  263.     private $contratApporteurAffaireState 0;
  264.     #[ORM\Column(type'string',length:200,unique:false,nullable:true)]
  265.     private $signature;
  266.     #[ORM\Column(type'string',length:200,unique:false,nullable:true)]
  267.     private $cz;
  268.     #[ORM\Column(type'string',length:200,unique:false,nullable:true)]
  269.     private $aml;
  270.     #[ORM\Column(type'string',length:200,unique:false,nullable:true)]
  271.     private $qualifiedInvestisorDocument;
  272.     #[ORM\Column(type'string',length:200,unique:false,nullable:true)]
  273.     private $contrat;
  274.     #[ORM\Column(type'string',length:200,unique:false,nullable:true)]
  275.     private $termeEtCondition;
  276.     #[ORM\Column(nullabletrue,options: ['default' => false])]
  277.     private ?bool $waitingUserRankingRewardChoice false;
  278.     #[ORM\Column(type'datetime',nullable:true)]
  279.     private $endOfSuspension;
  280.    
  281.     private ?int $countryId null;
  282.     private ?int $uplineId null;
  283.     private ?int $parentId null;
  284.     #[ORM\Column(nullabletrue)]
  285.     private ?int $teamParentPosition null;
  286.     #[ORM\Column(nullabletrue)]
  287.     private ?bool $dataProtectionChecked null;
  288.     #[ORM\Column(type'string',length:200,nullable:true)]
  289.     private $numeroPieceIdentite;
  290.     #[ORM\Column(type'string',length:200,nullable:true)]
  291.     private $sexe;
  292.     #[ORM\Column(type'string',length:200,nullable:true)]
  293.     private $lieuDeNaissance;
  294.     #[ORM\Column(type'date',nullable:true)]
  295.     private $validiteDocument;
  296.     #[ORM\Column(type'string',length:200,nullable:true)]
  297.     private $siege;
  298.     #[ORM\Column(type'string',length:200,nullable:true)]
  299.     private $registre;
  300.     #[ORM\Column(type'string',length:200,nullable:true)]
  301.     private $numeroDeRegistre;
  302.     #[ORM\Column(type'string',length:255,unique:false,nullable:true)]
  303.     private $structureSociete;
  304.     #[ORM\ManyToOne(targetEntityUsers::class)]
  305.     #[ORM\JoinColumnnullabletrue)]
  306.     private $adminThatValidateKyc;
  307.     
  308.     #[ORM\Column(type'string',length:255,unique:false,nullable:true)]
  309.     private $nextStepKyc;
  310.     #[ORM\Column(type'integer',nullable:true,options: ['default' => self::BO_FIRST_LEVEL])]
  311.     private $backOfficeLevel self::BO_FIRST_LEVEL;
  312.     #[ORM\Column(type'string',length:5,options: ['default' => 'fr'])]
  313.     private $lang 'fr';
  314.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  315.     private ?string $refusalReasonAdmin null;
  316.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  317.     private ?\DateTimeInterface $dateKycValidation null;
  318.     #[ORM\Column(nullabletrue)]
  319.     private ?bool $hasSubmittedKycDocument false;
  320.     public function setUplineId($uplineId) { $this->uplineId $uplineId; return $this; }
  321.     public function getUplineId() { return $this->uplineId; }
  322.     public function setParentId($parentId) { $this->parentId $parentId; return $this; }
  323.     public function getParentId() { return $this->parentId; }
  324.     public function jsonSerialize()
  325.     {
  326.         return [
  327.             'id' => $this->getId(),
  328.             'name' => $this->getName(),
  329.             'surname' => $this->getSurname(),
  330.             'email' => $this->getEmail(),
  331.             'address' => $this->getAddress(),
  332.             'postalCode' => $this->getPostalCode(),
  333.             'city' => $this->getCity(),
  334.             'country' => $this->getCountry(),
  335.             'phone' => $this->getPhone(),
  336.             'name' => $this->getName(),
  337.             'nomSociete' => $this->getNomSociete(),
  338.             'pieceIdentite' => $this->getPieceIdentite(),
  339.             'type' => $this->getType(),
  340.             'siret' => $this->getSiret(),
  341.             'birthdate' => $this->getBirthdate()->format('Y-m-d')
  342.         ];
  343.     }
  344.     public function __construct()
  345.     {
  346.         $this->docs = new ArrayCollection();
  347.     }
  348.     public function getId(): ?int
  349.     {
  350.         return $this->id;
  351.     }
  352.     public function getCountryId(): ?int
  353.     {
  354.         return $this->countryId;
  355.     }
  356.    
  357.     public function getName(): ?string
  358.     {
  359.         return $this->name;
  360.     }
  361.     public function setName(?string $name): static
  362.     {
  363.         UsefulEntity::NotNull($name,"nom");
  364.         $this->name $name;
  365.         return $this;
  366.     }
  367.     public function getSurname(): ?string
  368.     {
  369.         
  370.         return $this->surname;
  371.     }
  372.     public function setSurname(?string $surname): static
  373.     {
  374.         UsefulEntity::NotNull($surname,"prénom");
  375.         $this->surname $surname;
  376.         return $this;
  377.     }
  378.     public function getUsername(): ?string
  379.     {
  380.         return $this->username;
  381.     }
  382.     public function setUsername(?string $username): static
  383.     {
  384.         UsefulEntity::NotNull($username,"nom d'utilisateur");
  385.         $this->username $username;
  386.         return $this;
  387.     }
  388.     public function getEmail(): ?string
  389.     {
  390.         return $this->email;
  391.     }
  392.     public function setEmail(?string $email): static
  393.     {
  394.         UsefulEntity::NotNull($email,"E-mail");
  395.         $this->email $email;
  396.         return $this;
  397.     }
  398.     public function getPassword(): ?string
  399.     {
  400.         return $this->password;
  401.     }
  402.     public function setPassword(?string $password): static
  403.     {
  404.         UsefulEntity::NotNull($password,"Mot de passe");
  405.         $this->password $password;
  406.         return $this;
  407.     }
  408.     public function getPhone(): ?string
  409.     {
  410.         return $this->phone;
  411.     }
  412.     public function setPhone(?string $phone): static
  413.     {
  414.         $this->phone $phone;
  415.         return $this;
  416.     }
  417.     public function getAddress(): ?string
  418.     {
  419.         return $this->address;
  420.     }
  421.     public function setAddress(?string $address): static
  422.     {
  423.         $this->address $address;
  424.         return $this;
  425.     }
  426.       /**
  427.      * Get the value of country
  428.      */ 
  429.     public function getCountry()
  430.     {
  431.         return $this->country;
  432.     }
  433.     /**
  434.      * Set the value of country
  435.      *
  436.      * @return  self
  437.      */ 
  438.     public function setCountry($country)
  439.     {
  440.         UsefulEntity::NotNull($country,"pays");
  441.         $this->country $country;
  442.         return $this;
  443.     }
  444.     
  445.     public function getPic(): ?string
  446.     {
  447.         return $this->pic;
  448.     }
  449.     public function setPic(string $pic): static
  450.     {
  451.         $this->pic $pic;
  452.         return $this;
  453.     }
  454.     public function getRango(): ?int
  455.     {
  456.         return $this->rango;
  457.     }
  458.     public function setRango(?int $rango): static
  459.     {
  460.         $this->rango $rango;
  461.         return $this;
  462.     }
  463.     public function getStar(): ?int
  464.     {
  465.         return $this->star;
  466.     }
  467.     public function setStar(?int $star): static
  468.     {
  469.         $this->star $star;
  470.         return $this;
  471.     }
  472.     public function getDerrame(): ?int
  473.     {
  474.         return $this->derrame;
  475.     }
  476.     public function setDerrame(?int $derrame): static
  477.     {
  478.         $this->derrame $derrame;
  479.         return $this;
  480.     }
  481.     public function getPermisos(): ?int
  482.     {
  483.         return $this->permisos;
  484.     }
  485.     public function setPermisos(?int $permisos): static
  486.     {
  487.         $this->permisos $permisos;
  488.         return $this;
  489.     }
  490.     public function getVerificado(): ?int
  491.     {
  492.         return $this->verificado;
  493.     }
  494.     public function setVerificado(?int $verificado): static
  495.     {
  496.         $this->verificado $verificado;
  497.         return $this;
  498.     }
  499.     public function getActivo(): ?int
  500.     {
  501.         return $this->activo;
  502.     }
  503.     public function setActivo(?int $activo): static
  504.     {
  505.         $this->activo $activo;
  506.         return $this;
  507.     }
  508.     public function getUserIdentifier(): string
  509.     {
  510.         return (string) $this->username;
  511.     }
  512.   
  513.     public function getSalt(): ?string
  514.     {
  515.         return null;
  516.     }
  517.    
  518.     public function eraseCredentials()
  519.     {
  520.         // If you store any temporary, sensitive data on the user, clear it here
  521.         // $this->plainPassword = null;
  522.     }
  523.     public function getRoles(): array
  524.     {
  525.         $roles $this->roles;
  526.         // guarantee every user at least has ROLE_USER
  527.         $roles[] = 'ROLE_USER';
  528.         return array_unique($roles);
  529.     }
  530.     public function setRoles(array $roles): self
  531.     {
  532.         $this->roles $roles;
  533.         return $this;
  534.     }
  535.     public function setParent(?Users $parent): self
  536.     {
  537.         $this->parent $parent;
  538.     
  539.         return $this;
  540.     }
  541.     
  542.     public function getParent(): ?Users
  543.     {
  544.         return $this->parent;
  545.     }
  546.       /**
  547.      * Get the value of birthdate
  548.      */ 
  549.     public function getBirthdate()
  550.     {
  551.         return $this->birthdate;
  552.     }
  553.     /**
  554.      * Set the value of birthdate
  555.      *
  556.      * @return  self
  557.      */ 
  558.     public function setBirthdate($birthdate)
  559.     {
  560.         UsefulEntity::getDate($birthdate,"Date d'anniversaire");
  561.         // Format of the date string
  562.         $format 'Y-m-d';
  563.         // Create a DateTime object from the string and format
  564.         $date $birthdate;
  565.         if (!($birthdate instanceof DateTime)){
  566.             $date DateTime::createFromFormat($format$birthdate);
  567.         }
  568.         $this->birthdate =$date;
  569.         return $this;
  570.     }
  571.       /**
  572.      * Get the value of postalCode
  573.      */ 
  574.     public function getPostalCode()
  575.     {
  576.         return $this->postalCode;
  577.     }
  578.     /**
  579.      * Set the value of postalCode
  580.      *
  581.      * @return  self
  582.      */ 
  583.     public function setPostalCode($postalCode)
  584.     {
  585.         $this->postalCode $postalCode;
  586.         return $this;
  587.     }
  588.     public function getPlainPassword()
  589.     {
  590.         return $this->plainPassword;
  591.     }
  592.     /**
  593.      * Set the value of plainPassword
  594.      *
  595.      * @return  self
  596.      */ 
  597.     public function setPlainPassword($plainPassword)
  598.     {
  599.         $this->plainPassword $plainPassword;
  600.         return $this;
  601.     }
  602.     public function getSide()
  603.     {
  604.         return $this->side;
  605.     }
  606.     /**
  607.      * Set the value of side
  608.      *
  609.      * @return  self
  610.      */ 
  611.     public function setSide($side)
  612.     {
  613.         $this->side $side;
  614.         return $this;
  615.     }
  616.     public function getCity()
  617.     {
  618.         return $this->city;
  619.     }
  620.     /**
  621.      * Set the value of city
  622.      *
  623.      * @return  self
  624.      */ 
  625.     public function setCity($city)
  626.     {
  627.         $this->city $city;
  628.         return $this;
  629.     }
  630.     /**
  631.      * Get the value of type
  632.      */ 
  633.     public function getType()
  634.     {
  635.         return $this->type;
  636.     }
  637.     /**
  638.      * Set the value of type
  639.      *
  640.      * @return  self
  641.      */ 
  642.     public function setType($type)
  643.     {
  644.         $this->type $type;
  645.         return $this;
  646.     }
  647.     public function setCountryId($countryId)
  648.     {
  649.         $this->countryId $countryId;
  650.         return $this;
  651.     }
  652.     public function getFullName(){
  653.         return ($this->getName() ? $this->getName(): '') . ' ' . ($this->getSurname() ? $this->getSurname() : '');
  654.     }
  655.     /**
  656.      * Get the value of upline
  657.      */ 
  658.     public function getUpline()
  659.     {
  660.         return $this->upline;
  661.     }
  662.     /**
  663.      * Set the value of upline
  664.      *
  665.      * @return  self
  666.      */ 
  667.     public function setUpline($upline)
  668.     {
  669.         $this->upline $upline;
  670.         return $this;
  671.     }
  672.     public function isDescendantOf(Users $ancestor): bool
  673.     {
  674.         if ($this->getUpline() === null) {
  675.             return false;
  676.         }
  677.         if ($this->getUpline()->getId() === $ancestor->getId()) {
  678.             return true;
  679.         }
  680.         return $this->getUpline()->isDescendantOf($ancestor);
  681.     }
  682.     /**
  683.      * Get the value of countLeftSideUser
  684.      */ 
  685.     public function getCountLeftSideUser()
  686.     {
  687.         return $this->countLeftSideUser;
  688.     }
  689.     /**
  690.      * Set the value of countLeftSideUser
  691.      *
  692.      * @return  self
  693.      */ 
  694.     public function setCountLeftSideUser($countLeftSideUser)
  695.     {
  696.         $this->countLeftSideUser $countLeftSideUser;
  697.         return $this;
  698.     }
  699.     /**
  700.      * Get the value of countRightSideUser
  701.      */ 
  702.     public function getCountRightSideUser()
  703.     {
  704.         return $this->countRightSideUser;
  705.     }
  706.     /**
  707.      * Set the value of countRightSideUser
  708.      *
  709.      * @return  self
  710.      */ 
  711.     public function setCountRightSideUser($countRightSideUser)
  712.     {
  713.         $this->countRightSideUser $countRightSideUser;
  714.         return $this;
  715.     }
  716.     /**
  717.      * Get the value of siret
  718.      */ 
  719.     public function getSiret()
  720.     {
  721.         return $this->siret;
  722.     }
  723.     /**
  724.      * Set the value of siret
  725.      *
  726.      * @return  self
  727.      */ 
  728.     public function setSiret($siret)
  729.     {
  730.         $this->siret $siret;
  731.         return $this;
  732.     }
  733.     /**
  734.      * Get the value of nomSociete
  735.      */ 
  736.     public function getNomSociete()
  737.     {
  738.         return $this->nomSociete;
  739.     }
  740.     /**
  741.      * Set the value of nomSociete
  742.      *
  743.      * @return  self
  744.      */ 
  745.     public function setNomSociete($nomSociete)
  746.     {
  747.         $this->nomSociete $nomSociete;
  748.         return $this;
  749.     }
  750.     /**
  751.      * Get the value of kycVerification
  752.      */ 
  753.     public function getKycVerification()
  754.     {
  755.         return $this->kycVerification;
  756.     }
  757.     /**
  758.      * Set the value of kycVerification
  759.      *
  760.      * @return  self
  761.      */ 
  762.     public function setKycVerification($kycVerification)
  763.     {
  764.         $this->kycVerification $kycVerification;
  765.         return $this;
  766.     }
  767.     /**
  768.      * Get the value of docs
  769.      */ 
  770.     public function getDocs()
  771.     {
  772.         return $this->docs;
  773.     }
  774.     /**
  775.      * Set the value of docs
  776.      *
  777.      * @return  self
  778.      */ 
  779.     public function setDocs($docs)
  780.     {
  781.         $this->docs $docs;
  782.         return $this;
  783.     }
  784.     public function getStringSide(){
  785.         foreach (self::COTE_FORM as $key => $value) {
  786.             if($this->getSide() == $value) return $key;
  787.         }
  788.         throw new CustomException ('Côté de l\'équipe invalide');
  789.     }
  790.     /**
  791.      * Get the value of createdAt
  792.      */ 
  793.     public function getCreatedAt()
  794.     {
  795.         return $this->createdAt;
  796.     }
  797.     /**
  798.      * Set the value of createdAt
  799.      *
  800.      * @return  self
  801.      */ 
  802.     public function setCreatedAt($createdAt)
  803.     {
  804.         $this->createdAt $createdAt;
  805.         return $this;
  806.     }
  807.     public function getTabUsersData(){
  808.         $rep=[];
  809.         $rep[]=$this->getId()!=null?$this->getId():"";
  810.         $rep[]=$this->getName()!=null?$this->getName():"";
  811.         $rep[]=$this->getSurname()!=null?$this->getSurname():"";
  812.         $rep[]=$this->getUsername()!=null?$this->getUsername():"";
  813.         $rep[]=$this->getBirthdate()!=null?$this->getBirthdate()->format('Y-m-d'):"";
  814.         $rep[]=$this->getEmail()!=null?$this->getEmail():"";
  815.         $rep[]=$this->getType()!=null?$this->getTypeLabel():"";
  816.         $rep[]=($this->getType() == Users::TYPE_USER_ENTREPRISE)? $this->getNomSociete() :"";
  817.         $rep[]=$this->getRango()!=nullAppConstant::getRankName($this->getRango()):"Aucune";
  818.         $rep[]=$this->getPhone()!=null?$this->getPhone():"";
  819.         $rep[]=$this->getAddress()!=null?$this->getAddress():"";
  820.         $rep[]=$this->getCountry()!=null?$this->getCountry()->getValue():"";
  821.         $rep[]=$this->getPostalCode()!=null?$this->getPostalCode():"";
  822.         return $rep;
  823.     }
  824.     public function addDoc(UsersDocs $doc): static
  825.     {
  826.         if (!$this->docs->contains($doc)) {
  827.             $this->docs->add($doc);
  828.             $doc->setUser($this);
  829.         }
  830.         return $this;
  831.     }
  832.     public function removeDoc(UsersDocs $doc): static
  833.     {
  834.         if ($this->docs->removeElement($doc)) {
  835.             // set the owning side to null (unless already changed)
  836.             if ($doc->getUser() === $this) {
  837.                 $doc->setUser(null);
  838.             }
  839.         }
  840.         return $this;
  841.     }
  842.     /**
  843.      * Get the value of numero
  844.      */ 
  845.     public function getNumero()
  846.     {
  847.         return $this->numero;
  848.     }
  849.     /**
  850.      * Set the value of numero
  851.      *
  852.      * @return  self
  853.      */ 
  854.     public function setNumero($numero)
  855.     {
  856.         $this->numero $numero;
  857.         return $this;
  858.     }
  859.         /**
  860.      * Get the value of qualification
  861.      */ 
  862.     public function getQualification()
  863.     {
  864.         return $this->qualification;
  865.     }
  866.     /**
  867.      * Set the value of qualification
  868.      *
  869.      * @return  self
  870.      */ 
  871.     public function setQualification($qualification)
  872.     {
  873.         $this->qualification $qualification;
  874.         return $this;
  875.     }
  876.     public function checkString(string $input): bool
  877.     {
  878.         // Vérifie la présence d'au moins un caractère spécial, un chiffre et une majuscule
  879.         $specialCharRegex '/[!@#$%^&*(),.?":{}|<>]/';
  880.         $digitRegex '/\d/';
  881.         $uppercaseRegex '/[A-Z]/';
  882.         $lowercaseRegex '/[a-z]/';
  883.         // Vérifie si le string contient au moins un caractère spécial, un chiffre et une majuscule
  884.         $containsSpecialChar preg_match($specialCharRegex$input);
  885.         $containsDigit preg_match($digitRegex$input);
  886.         $containsUppercase preg_match($uppercaseRegex$input);
  887.         $containsLowercase preg_match($lowercaseRegex$input);
  888.         return $containsSpecialChar && $containsDigit && $containsUppercase&&$containsLowercase;
  889.     }
  890.     //reset password
  891.     public function verificationResetPassword($oldPassword,$newPassword,$confirmPassword){
  892.         UsefulEntity::NotNull($oldPassword,"l'ancien mot de passe");
  893.         $this->oldPassword=$oldPassword;
  894.         UsefulEntity::NotNull($newPassword,"le nouveau mot de passe");
  895.         $this->newPassword=$newPassword;
  896.         UsefulEntity::NotNull($confirmPassword,"la confirmation du mot de passe");
  897.         $this->retypePassword=$confirmPassword;
  898.         
  899.         if($newPassword!=$confirmPassword)
  900.             throw new CustomException("le nouveau mot de passe et la confirmation doit être les mêmes");
  901.         if(!$this->checkString($newPassword)){
  902.             throw new CustomException("Le mot de passe doit contenir une majuscule, des minuscules, des nombres et un symbole");
  903.         }
  904.         
  905.     }
  906.     public function resetLabel(){
  907.         $this->oldPassword="";
  908.         $this->newPassword="";
  909.         $this->retypePassword="";
  910.     }
  911.     public function getKycStringStatus(){
  912.         switch ($this->getKycVerification()) {
  913.             case self::KYC_CREATED:
  914.                 return "En attente de validation";
  915.                 
  916.             case self::KYC_VALIDATED 
  917.                 return "Validé";
  918.             
  919.             case self::KYC_DENIED 
  920.                 return "Refusé";
  921.                 
  922.             default :
  923.                 return "Documents non fournis";
  924.         }
  925.     }
  926.     public function getPieceIdentite(): ?string
  927.     {
  928.         return $this->pieceIdentite;
  929.     }
  930.     public function setPieceIdentite($pieceIdentite): static
  931.     {
  932.         $this->pieceIdentite $pieceIdentite;
  933.         return $this;
  934.     }
  935.     public function getTypePieceIdentite()
  936.     {
  937.         return $this->typePieceIdentite;
  938.     }
  939.     public function setTypePieceIdentite($typePieceIdentite): static
  940.     {
  941.         $this->typePieceIdentite $typePieceIdentite;
  942.         return $this;
  943.     }
  944.     //fonction aidant à l'affichage
  945.     public function getKycStringStatusColor(){
  946.         switch ($this->getKycVerification()) {
  947.             case self::KYC_CREATED:
  948.                 return "on_hold";
  949.                 
  950.             case self::KYC_VALIDATED 
  951.                 return "completed";
  952.             
  953.             case self::KYC_DENIED 
  954.                 return "un_paid";
  955.                 
  956.             default :
  957.                 return "paid";
  958.         }
  959.     }
  960.     public function isDisabledForm(){
  961.         if($this->isValidatedKYC()){
  962.             return 'disabled';
  963.         }
  964.         else return '';
  965.     }
  966.     public function isValidatedKYC(){
  967.         return $this->getKycVerification()==self::KYC_VALIDATED;
  968.     }
  969.     
  970.     /**
  971.      * Get the value of state
  972.      */ 
  973.     public function getState()
  974.     {
  975.         return $this->state;
  976.     }
  977.     /**
  978.      * Set the value of state
  979.      *
  980.      * @return  self
  981.      */ 
  982.     public function setState($state)
  983.     {
  984.         $this->state $state;
  985.         return $this;
  986.     }
  987.     public function getUserStringStatus(){
  988.         switch ($this->getState()) {
  989.             case self::INACTIVE:
  990.                 return "Désactivé";
  991.                 
  992.             default :
  993.                 return "Activé";
  994.         }
  995.     }
  996.     public function getNationality(): ?Country
  997.     {
  998.         return $this->nationality;
  999.     }
  1000.     public function setNationality(?Country $nationality): static
  1001.     {
  1002.         $this->nationality $nationality;
  1003.         return $this;
  1004.     }
  1005.     public function getTypeIdentityDoc(): ?TypeIdentityDoc
  1006.     {
  1007.         return $this->typeIdentityDoc;
  1008.     }
  1009.     public function setTypeIdentityDoc(?TypeIdentityDoc $typeIdentityDoc): static
  1010.     {
  1011.         $this->typeIdentityDoc $typeIdentityDoc;
  1012.         return $this;
  1013.     }
  1014.     public function getDocumentIssueCountry(): ?Country
  1015.     {
  1016.         return $this->documentIssueCountry;
  1017.     }
  1018.     public function setDocumentIssueCountry(?Country $documentIssueCountry): static
  1019.     {
  1020.         $this->documentIssueCountry $documentIssueCountry;
  1021.         return $this;
  1022.     }
  1023.     public function getDocIdRecto(): ?string
  1024.     {
  1025.         return $this->docIdRecto;
  1026.     }
  1027.     public function setDocIdRecto(?string $docIdRecto): static
  1028.     {
  1029.         $this->docIdRecto $docIdRecto;
  1030.         return $this;
  1031.     }
  1032.     public function getDocIdVerso(): ?string
  1033.     {
  1034.         return $this->docIdVerso;
  1035.     }
  1036.     public function setDocIdVerso(?string $docIdVerso): static
  1037.     {
  1038.         $this->docIdVerso $docIdVerso;
  1039.         return $this;
  1040.     }
  1041.     
  1042.     public function checkKycStatus(KycVerificationStatus $kycVerificationStatusbool $ignoreNull true){
  1043.         if($this->getKycVerificationStatus()?->getId() !== KycVerificationStatus::NOT_VERIFIED || (($this->getKycVerificationStatus()?->getId() == null || $this->getKycVerificationStatus()?->getId() == KycVerificationStatus::NOT_VERIFIED) && !$ignoreNull)){
  1044.             $this->setKycVerificationStatus($kycVerificationStatus);
  1045.         }
  1046.     }
  1047.     public function getKycVerificationStatus(): ?KycVerificationStatus
  1048.     {
  1049.         return $this->kycVerificationStatus;
  1050.     }
  1051.     public function setKycVerificationStatus(?KycVerificationStatus $kycVerificationStatus): static
  1052.     {
  1053.         $this->kycVerificationStatus $kycVerificationStatus;
  1054.         return $this;
  1055.     }
  1056.     public function getDateLastVerification(): ?\DateTimeInterface
  1057.     {
  1058.         return $this->dateLastVerification;
  1059.     }
  1060.     public function setDateLastVerification(?\DateTimeInterface $dateLastVerification): static
  1061.     {
  1062.         $this->dateLastVerification $dateLastVerification;
  1063.         return $this;
  1064.     }
  1065.     public function getRejectionReason(): ?string
  1066.     {
  1067.         return $this->rejectionReason;
  1068.     }
  1069.     public function setRejectionReason(?string $rejectionReason): static
  1070.     {
  1071.         $this->rejectionReason $rejectionReason;
  1072.         return $this;
  1073.     }
  1074.     public function getIdentityPhoto(): ?string
  1075.     {
  1076.         return $this->identity_photo;
  1077.     }
  1078.     public function setIdentityPhoto(?string $identity_photo): static
  1079.     {
  1080.         $this->identity_photo $identity_photo;
  1081.         return $this;
  1082.     }
  1083.     public function getStatutSociete(): ?string
  1084.     {
  1085.         return $this->statutSociete;
  1086.     }
  1087.     public function setStatutSociete(?string $statutSociete): static
  1088.     {
  1089.         $this->statutSociete $statutSociete;
  1090.         return $this;
  1091.     }
  1092.     public function getPieceJustificativeDomicile(): ?string
  1093.     {
  1094.         return $this->pieceJustificativeDomicile;
  1095.     }
  1096.     public function setPieceJustificativeDomicile(?string $pieceJustificativeDomicile): static
  1097.     {
  1098.         $this->pieceJustificativeDomicile $pieceJustificativeDomicile;
  1099.         return $this;
  1100.     }
  1101.     public function getTypeLabel(){
  1102.         return $this->getType() === self::TYPE_USER_ENTREPRISE 'Entreprise' 'Particulier';
  1103.     }
  1104.     public function isOriginKyc(): ?bool
  1105.     {
  1106.         return $this->originKyc;
  1107.     }
  1108.     public function setOriginKyc(?bool $originKyc): static
  1109.     {
  1110.         $this->originKyc $originKyc;
  1111.         return $this;
  1112.     }
  1113.     public function serialize()
  1114.     {
  1115.         return serialize([
  1116.             'id' => $this->getId(),
  1117.             'name' => $this->getName(),
  1118.             'surname' => $this->getSurname(),
  1119.             'email' => $this->getEmail(),
  1120.             'address' => $this->getAddress(),
  1121.             'postalCode' => $this->getPostalCode(),
  1122.             'city' => $this->getCity(),
  1123.             'countryId' => $this->getCountry()?->getId(),
  1124.             'phone' => $this->getPhone(),
  1125.             'name' => $this->getName(),
  1126.             'nomSociete' => $this->getNomSociete(),
  1127.             'pieceIdentite' => $this->getPieceIdentite(),
  1128.             'type' => $this->getType(),
  1129.             'siret' => $this->getSiret(),
  1130.             'birthdate' => $this->getBirthdate()->format('Y-m-d'),
  1131.             'side' => $this->getSide(),
  1132.             'username' => $this->getUsername(),
  1133.             'password' => $this->getPassword(),
  1134.             'uplineId' => $this->getUpline()?->getId(),
  1135.             'parentId' => $this->getParent()?->getId(),
  1136.             'roles' => $this->getRoles(),
  1137.             'plainPassword' => $this->getPlainPassword(),
  1138.             'sexe' => $this->getSexe(),
  1139.             'lieuDeNaissance' => $this->getLieuDeNaissance(),
  1140.             'validiteDocument' => $this->getValiditeDocument(),
  1141.             'typePieceIdentite' => $this->getTypePieceIdentite()
  1142.         ]);
  1143.     }
  1144.     public function unserialize($serialized)
  1145.     {
  1146.         $data unserialize($serialized);
  1147.         $this->id $data['id'];
  1148.         $this->setName($data['name']);
  1149.         $this->setSurname($data['surname']);
  1150.         $this->setEmail($data['email']);
  1151.         $this->setAddress($data['address']);
  1152.         $this->setPostalCode($data['postalCode']);
  1153.         $this->setCity($data['city']);
  1154.         $this->setCountryId($data['countryId']);
  1155.         $this->setPhone($data['phone']);
  1156.         $this->setName($data['name']);
  1157.         $this->setNomSociete($data['nomSociete']);
  1158.         $this->setPieceIdentite($data['pieceIdentite']);
  1159.         $this->setType($data['type']);
  1160.         $this->setSiret($data['siret']);
  1161.         $this->setBirthdate($data['birthdate']);
  1162.         $this->setSide($data['side']);
  1163.         $this->setUsername($data['username']);
  1164.         $this->setPassword($data['password']);
  1165.         $this->setUplineId($data['uplineId']);
  1166.         $this->setParentId($data['parentId']);
  1167.         $this->setRoles($data['roles']);
  1168.         $this->setPlainPassword($data['plainPassword']);
  1169.         $this->setTypePieceIdentite($data['typePieceIdentite']);
  1170.         $this->setSexe($data['sexe']);
  1171.         $this->setLieuDeNaissance($data['lieuDeNaissance']);
  1172.         $this->setValiditeDocument($data['validiteDocument']);
  1173.     }
  1174.     public function getStringTeamParentPosition(): ?string{
  1175.         if($this->getTeamParentPosition() !== null){
  1176.             foreach (self::COTE_FORM as $key => $value) {
  1177.                 if($this->getTeamParentPosition() == $value) return $key;
  1178.             }
  1179.         } 
  1180.         return null;
  1181.     }
  1182.     public function getTeamParentPosition(): ?int
  1183.     {
  1184.         return $this->teamParentPosition;
  1185.     }
  1186.     public function setTeamParentPosition(?int $teamParentPosition): static
  1187.     {
  1188.         $this->teamParentPosition $teamParentPosition;
  1189.         return $this;
  1190.     }
  1191.     public function isDataProtectionChecked(): ?bool
  1192.     {
  1193.         return $this->dataProtectionChecked;
  1194.     }
  1195.     public function setDataProtectionChecked(?bool $dataProtectionChecked): static
  1196.     {
  1197.         $this->dataProtectionChecked $dataProtectionChecked;
  1198.         return $this;
  1199.     }
  1200.     
  1201.     /**
  1202.      * Get the value of contratApporteurAffaireState
  1203.      */
  1204.     public function getContratApporteurAffaireState() {
  1205.         return $this->contratApporteurAffaireState;
  1206.     }
  1207.     /**
  1208.      * Set the value of contratApporteurAffaireState
  1209.      */
  1210.     public function setContratApporteurAffaireState($contratApporteurAffaireState): self {
  1211.         $this->contratApporteurAffaireState $contratApporteurAffaireState;
  1212.         return $this;
  1213.     }
  1214.     public function getSignature(): ?string
  1215.     {
  1216.         return $this->signature;
  1217.     }
  1218.     public function setSignature(?string $signature): static
  1219.     {
  1220.         $this->signature $signature;
  1221.         return $this;
  1222.     }
  1223.     public function getContratStringStatus(){
  1224.         switch ($this->getContratApporteurAffaireState()) {
  1225.             case self::CONTRAT_APPORTEUR_AFFAIRE_VALIDATED:
  1226.                 return "Validé";
  1227.                 
  1228.             case self::CONTRAT_APPORTEUR_AFFAIRE_REJECTED 
  1229.                 return "Refusé";
  1230.                 
  1231.             case self::CONTRAT_APPORTEUR_AFFAIRE_SUBMITTED_WITH_SIGNATURE:
  1232.                 return "En attente de validation";
  1233.                 
  1234.             case self::CONTRAT_APPORTEUR_AFFAIRE_WAITING_SIGNATURE 
  1235.                 return "En attente de signature";
  1236.                 
  1237.             case self::CONTRAT_APPORTEUR_NEED_TO_SEND_MAIL 
  1238.                 return "En attente de signature";
  1239.                 
  1240.             default :
  1241.                 return "Aucun";
  1242.         }
  1243.     }
  1244.     public function getContratStringStatusColor(){
  1245.         switch ($this->getContratApporteurAffaireState()) {
  1246.             case self::CONTRAT_APPORTEUR_AFFAIRE_VALIDATED:
  1247.                 return "completed";
  1248.                 
  1249.             case self::CONTRAT_APPORTEUR_AFFAIRE_REJECTED 
  1250.                 return "un_paid";
  1251.                 
  1252.             default :
  1253.                 return "on_hold";
  1254.         }
  1255.     }
  1256.     /**
  1257.      * Get the value of contrat
  1258.      */
  1259.     public function getContrat()
  1260.     {
  1261.         return $this->contrat;
  1262.     }
  1263.     /**
  1264.      * Set the value of contrat
  1265.      */
  1266.     public function setContrat($contrat): self
  1267.     {
  1268.         $this->contrat $contrat;
  1269.         return $this;
  1270.     }
  1271.     /**
  1272.      * Get the value of termeEtCondition
  1273.      */
  1274.     public function getTermeEtCondition()
  1275.     {
  1276.         return $this->termeEtCondition;
  1277.     }
  1278.     /**
  1279.      * Set the value of termeEtCondition
  1280.      */
  1281.     public function setTermeEtCondition($termeEtCondition): self
  1282.     {
  1283.         $this->termeEtCondition $termeEtCondition;
  1284.         return $this;
  1285.     }
  1286.     /**
  1287.      * Get the value of waitingUserRankingRewardChoice
  1288.      */ 
  1289.     public function getWaitingUserRankingRewardChoice()
  1290.     {
  1291.         return $this->waitingUserRankingRewardChoice;
  1292.     }
  1293.     /**
  1294.      * Set the value of waitingUserRankingRewardChoice
  1295.      *
  1296.      * @return  self
  1297.      */ 
  1298.     public function setWaitingUserRankingRewardChoice($waitingUserRankingRewardChoice)
  1299.     {
  1300.         $this->waitingUserRankingRewardChoice $waitingUserRankingRewardChoice;
  1301.         return $this;
  1302.     }
  1303.     /**
  1304.      * Get the value of endOfSuspension
  1305.      */ 
  1306.     public function getEndOfSuspension()
  1307.     {
  1308.         return $this->endOfSuspension;
  1309.     }
  1310.     /**
  1311.      * Set the value of endOfSuspension
  1312.      *
  1313.      * @return  self
  1314.      */ 
  1315.     public function setEndOfSuspension($endOfSuspension)
  1316.     {
  1317.         $this->endOfSuspension $endOfSuspension;
  1318.         return $this;
  1319.     }
  1320.     /**
  1321.      * Get the value of numeroPieceIdentite
  1322.      */ 
  1323.     public function getNumeroPieceIdentite()
  1324.     {
  1325.         return $this->numeroPieceIdentite;
  1326.     }
  1327.     /**
  1328.      * Set the value of numeroPieceIdentite
  1329.      *
  1330.      * @return  self
  1331.      */ 
  1332.     public function setNumeroPieceIdentite($numeroPieceIdentite)
  1333.     {
  1334.         $this->numeroPieceIdentite $numeroPieceIdentite;
  1335.         return $this;
  1336.     }
  1337.     /**
  1338.      * Get the value of sexe
  1339.      */ 
  1340.     public function getSexe()
  1341.     {
  1342.         return $this->sexe;
  1343.     }
  1344.     /**
  1345.      * Set the value of sexe
  1346.      *
  1347.      * @return  self
  1348.      */ 
  1349.     public function setSexe($sexe)
  1350.     {
  1351.         $this->sexe $sexe;
  1352.         return $this;
  1353.     }
  1354.     /**
  1355.      * Get the value of lieuDeNaissance
  1356.      */ 
  1357.     public function getLieuDeNaissance()
  1358.     {
  1359.         return $this->lieuDeNaissance;
  1360.     }
  1361.     /**
  1362.      * Set the value of lieuDeNaissance
  1363.      *
  1364.      * @return  self
  1365.      */ 
  1366.     public function setLieuDeNaissance($lieuDeNaissance)
  1367.     {
  1368.         $this->lieuDeNaissance $lieuDeNaissance;
  1369.         return $this;
  1370.     }
  1371.     /**
  1372.      * Get the value of validiteDocument
  1373.      */ 
  1374.     public function getValiditeDocument()
  1375.     {
  1376.         return $this->validiteDocument;
  1377.     }
  1378.     /**
  1379.      * Set the value of validiteDocument
  1380.      *
  1381.      * @return  self
  1382.      */ 
  1383.     public function setValiditeDocument($validiteDocument)
  1384.     {
  1385.         $this->validiteDocument $validiteDocument;
  1386.         return $this;
  1387.     }
  1388.     /**
  1389.      * Get the value of cz
  1390.      */ 
  1391.     public function getCz()
  1392.     {
  1393.         return $this->cz;
  1394.     }
  1395.     /**
  1396.      * Set the value of cz
  1397.      *
  1398.      * @return  self
  1399.      */ 
  1400.     public function setCz($cz)
  1401.     {
  1402.         $this->cz $cz;
  1403.         return $this;
  1404.     }
  1405.     /**
  1406.      * Get the value of aml
  1407.      */ 
  1408.     public function getAml()
  1409.     {
  1410.         return $this->aml;
  1411.     }
  1412.     /**
  1413.      * Set the value of aml
  1414.      *
  1415.      * @return  self
  1416.      */ 
  1417.     public function setAml($aml)
  1418.     {
  1419.         $this->aml $aml;
  1420.         return $this;
  1421.     }
  1422.     /**
  1423.      * Get the value of siege
  1424.      */ 
  1425.     public function getSiege()
  1426.     {
  1427.         return $this->siege;
  1428.     }
  1429.     /**
  1430.      * Set the value of siege
  1431.      *
  1432.      * @return  self
  1433.      */ 
  1434.     public function setSiege($siege)
  1435.     {
  1436.         $this->siege $siege;
  1437.         return $this;
  1438.     }
  1439.     /**
  1440.      * Get the value of registre
  1441.      */ 
  1442.     public function getRegistre()
  1443.     {
  1444.         return $this->registre;
  1445.     }
  1446.     /**
  1447.      * Set the value of registre
  1448.      *
  1449.      * @return  self
  1450.      */ 
  1451.     public function setRegistre($registre)
  1452.     {
  1453.         $this->registre $registre;
  1454.         return $this;
  1455.     }
  1456.     /**
  1457.      * Get the value of numeroDeRegistre
  1458.      */ 
  1459.     public function getNumeroDeRegistre()
  1460.     {
  1461.         return $this->numeroDeRegistre;
  1462.     }
  1463.     /**
  1464.      * Set the value of numeroDeRegistre
  1465.      *
  1466.      * @return  self
  1467.      */ 
  1468.     public function setNumeroDeRegistre($numeroDeRegistre)
  1469.     {
  1470.         $this->numeroDeRegistre $numeroDeRegistre;
  1471.         return $this;
  1472.     }
  1473.     /**
  1474.      * Get the value of structureSociete
  1475.      */ 
  1476.     public function getStructureSociete()
  1477.     {
  1478.         return $this->structureSociete;
  1479.     }
  1480.     /**
  1481.      * Set the value of structureSociete
  1482.      *
  1483.      * @return  self
  1484.      */ 
  1485.     public function setStructureSociete($structureSociete)
  1486.     {
  1487.         $this->structureSociete $structureSociete;
  1488.         return $this;
  1489.     }
  1490.     /**
  1491.      * Get the value of qualifiedInvestisorDocument
  1492.      */ 
  1493.     public function getQualifiedInvestisorDocument()
  1494.     {
  1495.         return $this->qualifiedInvestisorDocument;
  1496.     }
  1497.     /**
  1498.      * Set the value of qualifiedInvestisorDocument
  1499.      *
  1500.      * @return  self
  1501.      */ 
  1502.     public function setQualifiedInvestisorDocument($qualifiedInvestisorDocument)
  1503.     {
  1504.         $this->qualifiedInvestisorDocument $qualifiedInvestisorDocument;
  1505.         return $this;
  1506.     }
  1507.     /**
  1508.      * Get the value of adminThatValidateKyc
  1509.      */ 
  1510.     public function getAdminThatValidateKyc()
  1511.     {
  1512.         return $this->adminThatValidateKyc;
  1513.     }
  1514.     /**
  1515.      * Set the value of adminThatValidateKyc
  1516.      *
  1517.      * @return  self
  1518.      */ 
  1519.     public function setAdminThatValidateKyc($adminThatValidateKyc)
  1520.     {
  1521.         $this->adminThatValidateKyc $adminThatValidateKyc;
  1522.         return $this;
  1523.     }
  1524.     /**
  1525.      * Get the value of nextStepKyc
  1526.      */ 
  1527.     public function getNextStepKyc()
  1528.     {
  1529.         return $this->nextStepKyc;
  1530.     }
  1531.     /**
  1532.      * Set the value of nextStepKycj
  1533.      *
  1534.      * @return  self
  1535.      */ 
  1536.     public function setNextStepKyc($nextStepKyc)
  1537.     {
  1538.         $this->nextStepKyc $nextStepKyc;
  1539.         return $this;
  1540.     }
  1541.     public function getFullAddress(){
  1542.         $lieu $this->getAddress()." ,".$this->getCity()." ".$this->getPostalCode();
  1543.         if($this->getCountry()){
  1544.             $lieu $lieu.",".$this->getCountry()->getValue();
  1545.         }
  1546.         return $lieu;
  1547.     }
  1548.     public function getCurrentBackOfficeLevel(){
  1549.         if(in_array("ROLE_ADMIN"$this->getRoles())){
  1550.             return self::BO_MAX_LEVEL;
  1551.         }
  1552.         return $this->getBackOfficeLevel();
  1553.     }
  1554.     /**
  1555.      * Get the value of backOfficeLevel
  1556.      */ 
  1557.     public function getBackOfficeLevel()
  1558.     {
  1559.         return $this->backOfficeLevel;
  1560.     }
  1561.     /**
  1562.      * Set the value of backOfficeLevel
  1563.      *
  1564.      * @return  self
  1565.      */ 
  1566.     public function setBackOfficeLevel($backOfficeLevel)
  1567.     {
  1568.         $this->backOfficeLevel $backOfficeLevel;
  1569.         return $this;
  1570.     }
  1571.     public function updateBackOfficeLevelBasedOnRank($rank){
  1572.         $currentBackOfficeLevel $this->getCurrentBackOfficeLevel();
  1573.         $newBackOfficeLevel self::BO_FIRST_LEVEL;
  1574.         $consultantRank 2;
  1575.         $seniorConsultantRank 4;
  1576.         if($rank >= $consultantRank){
  1577.             $newBackOfficeLevel self::BO_SECOND_LEVEL;
  1578.         }
  1579.         if($rank >= $seniorConsultantRank){
  1580.             $newBackOfficeLevel self::BO_THIRD_LEVEL;
  1581.         }
  1582.         if($newBackOfficeLevel <= $currentBackOfficeLevel ){
  1583.             return false;
  1584.         }
  1585.         $this->setBackOfficeLevel($newBackOfficeLevel);
  1586.         return true;
  1587.     } 
  1588.     /**
  1589.      * Get the value of lang
  1590.      */ 
  1591.     public function getLang()
  1592.     {
  1593.         return $this->lang;
  1594.     }
  1595.     /**
  1596.      * Set the value of lang
  1597.      *
  1598.      * @return  self
  1599.      */ 
  1600.     public function setLang($lang)
  1601.     {
  1602.         $this->lang $lang;
  1603.         return $this;
  1604.     }
  1605.     public function getRefusalReasonAdmin(): ?string
  1606.     {
  1607.         return $this->refusalReasonAdmin;
  1608.     }
  1609.     public function setRefusalReasonAdmin(?string $refusalReasonAdmin): static
  1610.     {
  1611.         $this->refusalReasonAdmin $refusalReasonAdmin;
  1612.         return $this;
  1613.     }
  1614.     /**
  1615.      * Get the value of dateKycValidation
  1616.      *
  1617.      * @return ?\DateTimeInterface
  1618.      */
  1619.     public function getDateKycValidation(): ?\DateTimeInterface
  1620.     {
  1621.         return $this->dateKycValidation;
  1622.     }
  1623.     /**
  1624.      * Set the value of dateKycValidation
  1625.      *
  1626.      * @param ?\DateTimeInterface $dateKycValidation
  1627.      *
  1628.      * @return self
  1629.      */
  1630.     public function setDateKycValidation(?\DateTimeInterface $dateKycValidation): self
  1631.     {
  1632.         $this->dateKycValidation $dateKycValidation;
  1633.         return $this;
  1634.     }
  1635.     /**
  1636.      * Get the value of hasSubmittedKycDocument
  1637.      *
  1638.      * @return ?bool
  1639.      */
  1640.     public function hasSubmittedKycDocument(): ?bool
  1641.     {
  1642.         return $this->hasSubmittedKycDocument;
  1643.     }
  1644.     /**
  1645.      * Set the value of hasSubmittedKycDocument
  1646.      *
  1647.      * @param ?bool $hasSubmittedKycDocument
  1648.      *
  1649.      * @return self
  1650.      */
  1651.     public function setHasSubmittedKycDocument(?bool $hasSubmittedKycDocument): self
  1652.     {
  1653.         $this->hasSubmittedKycDocument $hasSubmittedKycDocument;
  1654.         return $this;
  1655.     }
  1656. }