Commit 6a35d310 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Merge branches 'alc-agrement-duree-vie' and 'master' of...

Merge branches 'alc-agrement-duree-vie' and 'master' of https://git.unicaen.fr/open-source/OSE into alc-agrement-duree-vie
parents ae09c618 e4bc6971
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -4,9 +4,11 @@ namespace Application\Controller;

use Application\Entity\Db\Intervenant;
use Application\Entity\Db\PieceJointe;
use Application\Entity\Db\TblPieceJointe;
use Application\Entity\Db\TypePieceJointe;
use Application\Entity\Db\TypePieceJointeStatut;
use Application\Form\PieceJointe\Traits\ModifierTypePieceJointeStatutFormAwareTrait;
use Application\Service\Traits\IntervenantServiceAwareTrait;
use Application\Service\Traits\PieceJointeServiceAwareTrait;
use Application\Service\Traits\StatutIntervenantServiceAwareTrait;
use Application\Service\Traits\TypePieceJointeServiceAwareTrait;
@@ -28,6 +30,7 @@ class PieceJointeController extends AbstractController
    use ContextServiceAwareTrait;
    use PieceJointeServiceAwareTrait;
    use StatutIntervenantServiceAwareTrait;
    use IntervenantServiceAwareTrait;
    use TypePieceJointeSaisieFormAwareTrait;
    use ModifierTypePieceJointeStatutFormAwareTrait;
    use TypePieceJointeServiceAwareTrait;
@@ -71,10 +74,10 @@ class PieceJointeController extends AbstractController

        $title = "Pièces justificatives <small>{$intervenant}</small>";

        $demandees       = $this->getServicePieceJointe()->getTypesPiecesDemandees($intervenant);
        $heuresPourSeuil = $this->getServicePieceJointe()->getHeuresPourSeuil($intervenant);
        $fournies  = $this->getServicePieceJointe()->getPiecesFournies($intervenant);
        //$archives        = $this->getServicePieceJointe()->getPiecesFourniesArchives($intervenant);
        $demandees = $this->getServicePieceJointe()->getTypesPiecesDemandees($intervenant);
        $synthese  = $this->getServicePieceJointe()->getPiecesSynthese($intervenant);

        $annee = $this->getServiceContext()->getAnnee();

@@ -82,7 +85,7 @@ class PieceJointeController extends AbstractController

        $alertContrat = $role->getIntervenant() && $intervenant->getStatut()->getPeutAvoirContrat();

        return compact('intervenant', 'title', 'demandees', 'heuresPourSeuil', 'fournies', 'messages', 'alertContrat', 'annee');
        return compact('intervenant', 'title', 'heuresPourSeuil', 'demandees', 'synthese', 'fournies', 'messages', 'alertContrat', 'annee');
    }


@@ -109,8 +112,7 @@ class PieceJointeController extends AbstractController


    /**
     * @param TypePieceJointe[] $demandees
     * @param PieceJointe[]     $fournies
     * @param TblPieceJointe[]     $synthesePiecesJointes
     */
    protected function makeMessages($demandees, $fournies)
    {
@@ -449,6 +451,14 @@ class PieceJointeController extends AbstractController
            'agrement',
            'contrat',
        ], $intervenant);

        //Récupérer tous les intervenants avec le même code intervenant
        $intervenants = $this->getServiceIntervenant()->getIntervenantByCode($intervenant->getCode());
        //On recalcule le tbl piece_jointe pour tous les intervenants ayant le même code intervenant que l'intervenant de l'année en cours
        $this->getServiceWorkflow()->calculerTableauxBord([
            'piece_jointe',
        ], $intervenants);

    }

}
+10 −0
Original line number Diff line number Diff line
@@ -177,6 +177,16 @@ class IntervenantService extends AbstractEntityService
        return $this->getBy('utilisateurCode', 'UTILISATEUR_CODE', $utilisateurCode, $annee, $autoImport);
    }

    public function getIntervenantByCode($intervenantCode, Annee $annee = null)
    {
        $findParams = ['code' => (string)$intervenantCode];
        $repo       = $this->getRepo();

        $result = $repo->findBy($findParams);

        return $result;
    }



    /**
+29 −0
Original line number Diff line number Diff line
@@ -126,6 +126,34 @@ class PieceJointeService extends AbstractEntityService
    }


    /**
     * @param Intervenant $intervenant
     *
     * @return mixed $result
     */
    public function getPiecesSynthese(Intervenant $intervenant)
    {
        $dql = "
            SELECT 
              pj
            FROM 
              Application\Entity\Db\TblPieceJointe pj
            WHERE
              pj.intervenant = :intervenant
        ";

        $listTblPieceJointe = $this->getEntityManager()->createQuery($dql)->setParameters([
            'intervenant' => $intervenant->getId(),
        ])->getResult();

        $result = [];
        foreach ($listTblPieceJointe as $TblPieceJointe) {
            $result[$TblPieceJointe->getTypePieceJointe()->getId()] = $TblPieceJointe;
        }

        return $result;
    }


    /**
     * @param Intervenant $intervenant
@@ -158,6 +186,7 @@ class PieceJointeService extends AbstractEntityService
            'annee'       => $intervenant->getAnnee()->getId(),
        ])->getResult();


        /* @var $lpjf \Application\Entity\Db\TblPieceJointeFournie[] */

        $result = [];
+18 −6
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ $menuUrl = $this->url('intervenant/services', ['intervenant' => $intervenant->ge
                //Check si piece obligatoire
                $obligatoire = $pj->isObligatoire();
                $tpj = $pj->getTypePieceJointe();
                if (isset($fournies[$tpj->getId()])) { // qu'elles soient fournies ou non
                if (isset($fournies[$tpj->getId()]) && $synthese[$tpj->getId()]->getFournie() == 1) { // qu'elles soient fournies ou non
                    $pj = $fournies[$tpj->getId()];
                    unset($restantes[$tpj->getId()]);
                } else {
@@ -64,15 +64,27 @@ $menuUrl = $this->url('intervenant/services', ['intervenant' => $intervenant->ge
            }
        }


        if (!empty($restantes)) {
            echo '<div class="well">';
            echo '<h2>Autres pièces fournies</h2>';
            $html =  '<div class="well">';
            $html .= '<h2>Autres pièces fournies</h2>';
            $obligatoire = false;
            $haveRestante = false;
            foreach ($restantes as $tpjId => $pj) { // on liste les pièces fournies mais qui ne sont pas demandées...
                //on affiche la pièce jointe restante uniquement sur l'année où elle a été fourni

                if($pj->getIntervenant()->getAnnee()->getId() == $annee->getId())
                {
                    $haveRestante = true;
                    $tpj = $pj->getType();
                echo $this->partial('application/piece-jointe/partial/piece-jointe', compact('intervenant', 'tpj', 'pj', 'canEdit', 'canValider', 'canDevalider', 'obligatoire', 'annee'));
                    $html .= $this->partial('application/piece-jointe/partial/piece-jointe', compact('intervenant', 'tpj', 'pj', 'canEdit', 'canValider', 'canDevalider', 'obligatoire', 'annee'));
                }
            }
            $html .= '</div>';
            if($haveRestante)
            {
                echo $html;
            }
            echo '</div>';
        }

        ?>
+2 −2
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ $uploader = $this->uploader()->setUrl($this->url('piece-jointe/intervenant/fichi
        <h3>
            <?php if ((!$hasValidation && $canValider) || ($hasValidation && $canDevalider)): ?>

                <?php if ($pj && $pj->annee->getId() != $annee->getId()): ?>
                <?php if ($pj && $pj->getIntervenant()->getAnnee()->getId() != $annee->getId()): ?>
                    <div class="validation-bar pull-right"
                         data-url="<?= $this->url('piece-jointe/intervenant/archiver', ['pieceJointe' => $pj->getId()], [], true) ?>">
                        <a class="archiver-pj btn btn-success"
@@ -70,7 +70,7 @@ $uploader = $this->uploader()->setUrl($this->url('piece-jointe/intervenant/fichi
            <?php endif; ?>
            <!--Infos sur document fourni sur une autre année-->
            <?=
            ($pj && $pj->annee->getId() != $annee->getId()) ? $type . "  <span style=\"font-size:0.6em;\">Fourni(e) en " . $pj->annee->getId() . "</span>" : $type;
            ($pj && $pj->getIntervenant()->getAnnee()->getId() != $annee->getId()) ? $type . "  <span style=\"font-size:0.6em;\">Fourni(e) en " . $pj->getIntervenant()->getAnnee()->getId() . "</span>" : $type;
            ?>
            <!--Info sur document facultatif-->
            <?=