resolution message non lus (fixes #34)

This commit is contained in:
afornerot 2019-11-29 09:37:13 +01:00
parent 9067d50b8e
commit 77c6cd4362
2 changed files with 18 additions and 15 deletions

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107'); (-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}hQDYGlko/0bZ5TvumkZnJPgwgGF9FfC5 (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}cmleGwso06Qj5cTZ+28U/BFQCTkB0Ur3
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');

View File

@ -50,6 +50,7 @@ class CountMessageCommand extends Command
$users=$this->em->getRepository("CadolesCoreBundle:User")->findAll(); $users=$this->em->getRepository("CadolesCoreBundle:User")->findAll();
foreach($users as $user) { foreach($users as $user) {
$cptnotread=0; $cptnotread=0;
// Pour chaque group de l'utilisateur // Pour chaque group de l'utilisateur
foreach($user->getGroups() as $usergroup) { foreach($user->getGroups() as $usergroup) {
// On calcule le nombre de message non lu pour l'utilisateur' // On calcule le nombre de message non lu pour l'utilisateur'
@ -76,6 +77,9 @@ class CountMessageCommand extends Command
if($tm-$tr>0) $cptnotread+=($tm-$tr); if($tm-$tr>0) $cptnotread+=($tm-$tr);
} }
}
// S'il l'utilisateur a des messages non lus
if($cptnotread>0) { if($cptnotread>0) {
$this->writeln($user->getUsername()." notifié de ".$cptnotread." messages non lus"); $this->writeln($user->getUsername()." notifié de ".$cptnotread." messages non lus");
@ -91,7 +95,6 @@ class CountMessageCommand extends Command
$message->sendEmail($template, $mail_params, $user->getEmail(), $this->noreply, $this->appname); $message->sendEmail($template, $mail_params, $user->getEmail(), $this->noreply, $this->appname);
} }
} }
}
$this->writeln(''); $this->writeln('');
return 1; return 1;
} }