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

Validation entretien professionnel : Ajout des mails (bidons) et corrections mineures

parent 5211e185
Loading
Loading
Loading
Loading
+6 −1
Changes for module/Application/src/Application/Controller/EntretienProfessionnelController.php: 6 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -291,12 +291,15 @@ class EntretienProfessionnelController extends AbstractActionController
                switch ($type) {
                    case 'Agent' :
                        $entretien->setValidationAgent($validation);
                        $this->getMailingService()->sendMailType("ENTRETIEN_VALIDATION_AGENT", ['campagne' => $entretien->getCampagne(), 'entretien' => $entretien, 'mailing' => 'zzz'.'DRH@unicaen.fr']);
                        break;
                    case 'Responsable' :
                        $entretien->setValidationResponsable($validation);
                        $this->getMailingService()->sendMailType("ENTRETIEN_VALIDATION_RESPONSABLE", ['campagne' => $entretien->getCampagne(), 'entretien' => $entretien, 'mailing' => 'zzz'.$entretien->getAgent()->getUtilisateur()->getEmail()]);
                        break;
                    case 'DRH' :
                        $entretien->setValidationDRH($validation);
                        $this->getMailingService()->sendMailType("ENTRETIEN_VALIDATION_DRH", ['campagne' => $entretien->getCampagne(), 'entretien' => $entretien, 'mailing' => 'zzz'.$entretien->getResponsable()->getEmail()]);
                        break;
                }
                $this->getEntretienProfessionnelService()->update($entretien);
@@ -321,12 +324,14 @@ class EntretienProfessionnelController extends AbstractActionController
        $validation = $this->getValidationInstanceService()->getRequestedValidationInstance($this);
        $this->getValidationInstanceService()->historise($validation);

        /** TODO c'est vraiment crado (faire mieux ...) */

        /** @var EntretienProfessionnel $entity */
        $entity = $this->getValidationInstanceService()->getEntity($validation);

        /** TODO c'est vraiment crado (faire mieux ...) */
        if ($validation->getType()->getCode() === "ENTRETIEN_AGENT") $entity->setValidationAgent(null);
        if ($validation->getType()->getCode() === "ENTRETIEN_RESPONSABLE") $entity->setValidationResponsable(null);
        if ($validation->getType()->getCode() === "ENTRETIEN_DRH") $entity->setValidationDRH(null);

        try {
            $this->getValidationInstanceService()->getEntityManager()->flush($entity);
+20
Changes for module/Application/src/Application/Entity/Db/EntretienProfessionnel.php: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -237,6 +237,13 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf
        return $this;
    }

    /**
     * @return bool
     */
    public function hasValidationAgent() {
        return ($this->validationAgent AND $this->validationAgent->estNonHistorise());
    }

    /**
     * @return ValidationInstance
     */
@@ -255,6 +262,13 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf
        return $this;
    }

    /**
     * @return bool
     */
    public function hasValidationResponsable() {
        return ($this->validationResponsable AND $this->validationResponsable->estNonHistorise());
    }

    /**
     * @return ValidationInstance
     */
@@ -271,4 +285,10 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf
        $this->validationDRH = $validationDRH;
    }

    /**
     * @return bool
     */
    public function hasValidationDRH() {
        return ($this->validationDRH AND $this->validationDRH->estNonHistorise());
    }
}
 No newline at end of file
+15 −9
Changes for module/Application/view/application/entretien-professionnel/partial/validation.phtml: 15 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ use Application\Provider\Privilege\EntretienproPrivileges;

$canValiderAgent        = $this->isAllowed($entretien, EntretienproPrivileges::ENTRETIENPRO_VALIDER_AGENT);
$canValiderResponsable  = $this->isAllowed($entretien, EntretienproPrivileges::ENTRETIENPRO_VALIDER_RESPONSABLE);
$canValiderRdh          = $this->isAllowed($entretien, EntretienproPrivileges::ENTRETIENPRO_VALIDER_DRH);
$canValiderDrh          = $this->isAllowed($entretien, EntretienproPrivileges::ENTRETIENPRO_VALIDER_DRH);

?>

@@ -17,7 +17,7 @@ $canValiderRdh = $this->isAllowed($entretien, EntretienproPrivileges::E
    <h3 class="categorie"> Validation du responsable de l'entretien professionnel </h3>

    <div class="row">
        <?php if ($entretien->getValidationResponsable() !== null AND $entretien->getValidationResponsable()->estNonHistorise()) : ?>
        <?php if ($entretien->hasValidationResponsable()) : ?>
            <div class="col-md-8">
                <div class="row">
                    <div class="alert alert-success">
@@ -40,7 +40,7 @@ $canValiderRdh = $this->isAllowed($entretien, EntretienproPrivileges::E
            </div>
            <div class="pull-right">
                <br/>
                <?php if ($canValiderResponsable) : ?>
                <?php if ($canValiderResponsable && ! $entretien->hasValidationAgent()) : ?>
                    <a
                        <?php /** @see \Application\Controller\EntretienProfessionnelController::revoquerValidationAction() */ ?>
                            href="<?php echo $this->url('entretien-professionnel/revoquer-validation', ['validation' => $entretien->getValidationResponsable()->getId()], [], true); ?>"
@@ -81,7 +81,7 @@ $canValiderRdh = $this->isAllowed($entretien, EntretienproPrivileges::E

    <div class="row">

        <?php if ($entretien->getValidationResponsable() === null OR $entretien->getValidationResponsable()->estHistorise()) : ?>
        <?php if (!$entretien->hasValidationResponsable()) : ?>
            <div class="col-md-8">
                <div class="alert alert-warning">
                    <span class="icon attention"></span>
@@ -89,7 +89,7 @@ $canValiderRdh = $this->isAllowed($entretien, EntretienproPrivileges::E
                </div>
            </div>
        <?php else : ?>
            <?php if ($entretien->getValidationAgent() !== null AND $entretien->getValidationAgent()->estNonHistorise()) : ?>
            <?php if ($entretien->hasValidationAgent()) : ?>
                <div class="col-md-8">
                    <div class="row">
                        <div class="alert alert-success">
@@ -112,7 +112,7 @@ $canValiderRdh = $this->isAllowed($entretien, EntretienproPrivileges::E
                </div>
                <div class="pull-right">
                    <br/>
                    <?php if ($canValiderResponsable) : ?>
                    <?php if ($canValiderAgent && ! $entretien->hasValidationDRH()) : ?>
                        <a
                            <?php /** @see \Application\Controller\EntretienProfessionnelController::revoquerValidationAction() */ ?>
                                href="<?php echo $this->url('entretien-professionnel/revoquer-validation', ['validation' => $entretien->getValidationAgent()->getId()], [], true); ?>"
@@ -155,7 +155,7 @@ $canValiderRdh = $this->isAllowed($entretien, EntretienproPrivileges::E

    <div class="row">

        <?php if ($entretien->getValidationAgent() === null OR $entretien->getValidationAgent()->estHistorise()) : ?>
        <?php if (!$entretien->hasValidationAgent()) : ?>
            <div class="col-md-8">
                <div class="alert alert-warning">
                    <span class="icon attention"></span>
@@ -163,7 +163,7 @@ $canValiderRdh = $this->isAllowed($entretien, EntretienproPrivileges::E
                </div>
            </div>
        <?php else : ?>
            <?php if ($entretien->getValidationDRH() !== null AND $entretien->getValidationDRH()->estNonHistorise()) : ?>
            <?php if ($entretien->hasValidationDRH()) : ?>
                <div class="col-md-8">
                    <div class="row">
                        <div class="alert alert-success">
@@ -186,7 +186,7 @@ $canValiderRdh = $this->isAllowed($entretien, EntretienproPrivileges::E
                </div>
                <div class="pull-right">
                    <br/>
                    <?php if ($canValiderResponsable) : ?>
                    <?php if ($canValiderDrh ) : ?>
                        <a
                            <?php /** @see \Application\Controller\EntretienProfessionnelController::revoquerValidationAction() */ ?>
                                href="<?php echo $this->url('entretien-professionnel/revoquer-validation', ['validation' => $entretien->getValidationDRH()->getId()], [], true); ?>"
@@ -222,3 +222,9 @@ $canValiderRdh = $this->isAllowed($entretien, EntretienproPrivileges::E
        <?php endif; ?>
    </div>
</div>

<style>
    h3.categorie {
        border-bottom: 1px solid #31708f;
    }
</style>
 No newline at end of file