Commit b0278c2e authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Release_2.2.2

parent 9f27164b
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ use Soutenance\Service\Validation\ValidatationServiceAwareTrait;
use UnicaenApp\Exception\LogicException;
use UnicaenApp\Exception\RuntimeException;
use UnicaenAuth\Service\Traits\UserServiceAwareTrait;
use UnicaenAuthToken\Service\TokenServiceAwareTrait;
use Zend\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Zend\View\Model\ViewModel;
use Zend\View\Renderer\PhpRenderer;
@@ -56,6 +57,7 @@ class PresoutenanceController extends AbstractController
    use EngagementImpartialiteServiceAwareTrait;
    use FichierServiceAwareTrait;
    use StructureDocumentServiceAwareTrait;
    use TokenServiceAwareTrait;

    use DateRenduRapportFormAwareTrait;
    use AdresseSoutenanceFormAwareTrait;
@@ -209,8 +211,17 @@ class PresoutenanceController extends AbstractController
                $user = $this->utilisateurService->createFromIndividu($individu, $this->generateUsername($membre), 'none');
                $user->setEmail($membre->getEmail());
                $this->userService->updateUserPasswordResetToken($user);
                $url = $this->url()->fromRoute('utilisateur/init-compte', ['token' => $user->getPasswordResetToken()], ['force_canonical' => true], true);
                $this->getNotifierSoutenanceService()->triggerInitialisationCompte($these, $user, $url);

                $token = $this->tokenService->createUserToken($proposition->getDate());
                $token->setUser($user);
                $this->tokenService->saveUserToken($token);

                $url_rapporteur = $this->url()->fromRoute("soutenance/index-rapporteur", ['these' => $these->getId()], ['force_canonical' => true], true);
                $url = $this->url()->fromRoute('zfcuser/login', ['type'=> 'token'], ['query' => ['token' => $token->getToken(), 'redirect' => $url_rapporteur, 'role' => $acteur->getRole()->getRoleId()], 'force_canonical' => true], true );
                $this->getNotifierSoutenanceService()->triggerConnexionRapporteur($these, $url);

//                $url = $this->url()->fromRoute('utilisateur/init-compte', ['token' => $user->getPasswordResetToken()], ['force_canonical' => true], true);
//                $this->getNotifierSoutenanceService()->triggerInitialisationCompte($these, $user, $url);
            }
        }

+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ use Soutenance\Service\Parametre\ParametreService;
use Soutenance\Service\Proposition\PropositionService;
use Soutenance\Service\Validation\ValidationService;
use UnicaenAuth\Service\User as UserService;
use UnicaenAuthToken\Service\TokenService;
use Zend\View\Renderer\PhpRenderer;

class PresoutenanceControllerFactory
@@ -46,6 +47,7 @@ class PresoutenanceControllerFactory
         * @var EngagementImpartialiteService $engagementImpartialiteService
         * @var FichierService $fichierService
         * @var StructureDocumentService $structureDocumentService
         * @var TokenService $tokenService
         */
        $propositionService = $container->get(PropositionService::class);
        $membreService = $container->get(MembreService::class);
@@ -62,6 +64,7 @@ class PresoutenanceControllerFactory
        $engagementImpartialiteService = $container->get(EngagementImpartialiteService::class);
        $fichierService = $container->get(FichierService::class);
        $structureDocumentService = $container->get(StructureDocumentService::class);
        $tokenService = $container->get(TokenService::class);

        /**
         * @var DateRenduRapportForm $dateRenduRapportForm
@@ -90,6 +93,7 @@ class PresoutenanceControllerFactory
        $controller->setEngagementImpartialiteService($engagementImpartialiteService);
        $controller->setFichierService($fichierService);
        $controller->setStructureDocumentService($structureDocumentService);
        $controller->setTokenService($tokenService);

        $controller->setDateRenduRapportForm($dateRenduRapportForm);
        $controller->setAdresseSoutenanceForm($adresseSoutenanceForm);
+27 −0
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ class NotifierSoutenanceService extends NotifierService
        $this->urlHelper = $urlHelper;
    }



    /**
     * @param These $these
     * @return string
@@ -639,6 +641,31 @@ class NotifierSoutenanceService extends NotifierService
        }
    }

    /**
     * @param These $these
     * @param Utilisateur $user
     * @param string $url
     */
    public function triggerConnexionRapporteur(These $these, Utilisateur $user, string $url)
    {
        $email = $user->getEmail();
        if ($email === null) throw new LogicException("Aucun email de fourni !");

        if (!empty($email)) {
            $notif = new Notification();
            $notif
                ->setSubject("Connexion à SyGAL en tant que rapporteur de la thèse de " . $these->getDoctorant()->getIndividu()->getNomComplet())
                ->setTo($email)
                ->setTemplatePath('soutenance/notification/connexion-rapporteur')
                ->setTemplateVariables([
                    'these' => $these,
                    'username' => $user->getUsername(),
                    'url' => $url,
                ]);
            $this->trigger($notif);
        }
    }

    /**
     * @param Membre $membre
     * @param string $url
+54 −0
Original line number Diff line number Diff line
<?php

use Application\Entity\Db\These;
use Application\View\Renderer\PhpRenderer;

/**
 * @see \Soutenance\Service\Notifier\NotifierSoutenanceService::triggerConnexionRapporteur()
 *
 * @var PhpRenderer $this
 * @var These $these
 * @var string $username
 * @var string $url
 */

$doctorant = $these->getDoctorant()->getIndividu()->getNomComplet(false, false, false, true, false, true);
$titre = $these->getTitre();

$justification = true;
?>

<p><em>-- Version française----------------------------------------------------</em></p>
<p>
    Bonjour,
</p>
<p>
    Vous venez d'être désigné comme rapporteur pour la thèse de <strong><?php echo $doctorant; ?></strong> intitulée
    <strong><?php echo $titre; ?></strong>. Afin de pouvoir vous connecter à l'application <strong> <?php echo $this->appInfos()->nom; ?> </strong>
    et ainsi pouvoir rendre votre avis de pré-soutenance, vous pouvez utiliser l'adresse suivante : <a href="<?php echo $url; ?>"><?php echo $url;?> </a>.
</p>
<p>
    Cordialement,
</p>

<p><em>-- English version -----------------------------------------------------</em></p>
<p>
    Dear Mrs/Mr,
</p>
<p>
    You have been appointed as an external referee for the PhD thesis presented by <strong><?php echo $doctorant; ?></strong> entitled
    <strong><?php echo $titre; ?></strong>. In order to have access to the <strong> <?php echo $this->appInfos()->nom; ?> </strong>
    web-based application for submitting your report, you can use the following link : <a href="<?php echo $url; ?>"><?php echo $url;?> </a>.
</p>
<p>
    Best regards,
</p>


<?php if ($justification) : ?>
    <p>
        Vous recevez ce mail, car votre rôle dans la soutenance de thèse de <?php echo $doctorant; ?> nécessite un compte SyGAL.
    </p>
<?php endif; ?>