Compare commits

..

No commits in common. "f07b95f1e45418821f9820e87b70659f26c9d27f" and "ae1a97bcbdf33f8f86c33f40a8709bab9d57afa5" have entirely different histories.

3 changed files with 27 additions and 26 deletions

View File

@ -128,10 +128,7 @@ class SecurityController extends Controller
$user->setLastname($lastname); $user->setLastname($lastname);
$user->setFirstname($firstname); $user->setFirstname($firstname);
$user->setEmail($email); $user->setEmail($email);
if(!$sameniveau01) { if(!$sameniveau01) $user->setNiveau02(null);
$user->setNiveau01($niveau01);
$user->setNiveau02(null);
}
if(in_array($username,$this->getParameter("ldap_usersadmin"))) if(in_array($username,$this->getParameter("ldap_usersadmin")))
$user->setRole("ROLE_ADMIN"); $user->setRole("ROLE_ADMIN");

View File

@ -60,17 +60,19 @@ class syncNiveau01 implements EventSubscriber
if ($entity instanceof Niveau01 && ($this->changeSiren||$this->changeLabel)) { if ($entity instanceof Niveau01 && ($this->changeSiren||$this->changeLabel)) {
// On change le SIRET de l'ensemble des utlisateurs associés à ce Niveau01 // On change le SIRET de l'ensemble des utlisateurs associés à cet établissement
// Pas de déclencheur bdd car trop long $qb = $this->em->createQueryBuilder();
// La synchronisation journalière mettra à jour l'annuaire de l'utilisateur $datas= $qb ->select('table')->from('CadolesCoreBundle:User','table')
$qb = $this->em->createQueryBuilder(); ->where('table.niveau01 = :id')
$q = $qb->update('CadolesCoreBundle:User','user') ->setParameter("id", $entity->getId())
->set('user.labelniveau01', $qb->expr()->literal($entity->getLabel())) ->getQuery()
->set('user.siren', $qb->expr()->literal($entity->getSiren())) ->getResult();
->where('user.niveau01 = :niveau01') foreach($datas as $data) {
->setParameter("niveau01", $entity->getId()) $data->setSiren($entity->getSiren());
->getQuery(); $data->setLabelniveau01($entity->getLabel());
$q->execute(); $this->em->persist($data);
$this->em->flush();
}
} }
} }

View File

@ -59,17 +59,19 @@ class syncNiveau02 implements EventSubscriber
} }
if ($entity instanceof Niveau02 && ($this->changeSiret||$this->changeLabel)) { if ($entity instanceof Niveau02 && ($this->changeSiret||$this->changeLabel)) {
// On change le SIREN de l'ensemble des utlisateurs associés à ce Niveau02 // On change le SIRET de l'ensemble des utlisateurs associés à cet établissement
// Pas de déclencheur bdd car trop long $qb = $this->em->createQueryBuilder();
// La synchronisation journalière mettra à jour l'annuaire de l'utilisateur $datas= $qb ->select('table')->from('CadolesCoreBundle:User','table')
$qb = $this->em->createQueryBuilder(); ->where('table.niveau02 = :id')
$q = $qb->update('CadolesCoreBundle:User','user') ->setParameter("id", $entity->getId())
->set('user.labelniveau02', $qb->expr()->literal($entity->getSiret())) ->getQuery()
->set('user.siret', $qb->expr()->literal($entity->getSiren())) ->getResult();
->where('user.niveau02 = :niveau02') foreach($datas as $data) {
->setParameter("niveau02", $entity->getId()) $data->setSiret($entity->getSiret());
->getQuery(); $data->setLabelniveau02($entity->getLabel());
$q->execute(); $this->em->persist($data);
$this->em->flush();
}
} }
} }