Commit 911cd305 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Possibilité d'initialiser le prévisionnel à parti du réalisé de l'année passée (paramétrable)

parent 3ff8cf9d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -82,6 +82,10 @@ return [
        "VALEUR"      => "semestriel",
        "DESCRIPTION" => "Modalité de gestion des services (réalisé, référentiel)",
    ],
    "report_service"                     => [
        "VALEUR"      => "PREVU",
        "DESCRIPTION" => "Report du service de l'année précédente",
    ],


    /* Documentations */
+18 −4
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace Application\Form;

use Application\Entity\Db\Parametre;
use Application\Entity\Db\TypeVolumeHoraire;
use Application\Service\Traits\AnneeServiceAwareTrait;
use Application\Service\Traits\DomaineFonctionnelServiceAwareTrait;
use Application\Service\Traits\EtatSortieServiceAwareTrait;
@@ -32,7 +33,6 @@ class ParametresForm extends AbstractForm
    use FormuleServiceAwareTrait;



    public function init()
    {
        $this->setAttribute('action', $this->getCurrentUrl());
@@ -298,6 +298,20 @@ class ParametresForm extends AbstractForm
            ],
        ]);

        $this->add([
            'type'       => 'Select',
            'name'       => 'report_service',
            'options'    => [
                'value_options' => [
                    TypeVolumeHoraire::CODE_PREVU   => 'Se baser sur le prévisionnel validé de l\'année prédédente',
                    TypeVolumeHoraire::CODE_REALISE => 'Se baser sur le réalisé validé de l\'année prédédente',
                ],
            ],
            'attributes' => [
                'class'     => 'selectpicker',
                'data-size' => 20,
            ],
        ]);

        $this->add([
            'type'       => 'Select',
+19 −17
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Application\Provider\Privilege\Privileges;
use Application\Service\Traits\EtatVolumeHoraireServiceAwareTrait;
use Application\Service\Traits\FonctionReferentielServiceAwareTrait;
use Application\Service\Traits\IntervenantServiceAwareTrait;
use Application\Service\Traits\ParametresServiceAwareTrait;
use Application\Service\Traits\SourceServiceAwareTrait;
use Application\Service\Traits\StructureServiceAwareTrait;
use Application\Service\Traits\TypeVolumeHoraireServiceAwareTrait;
@@ -33,7 +34,7 @@ class ServiceReferentielService extends AbstractEntityService
    use EtatVolumeHoraireServiceAwareTrait;
    use VolumeHoraireReferentielServiceAwareTrait;
    use SourceServiceAwareTrait;

    use ParametresServiceAwareTrait;


    /**
@@ -73,7 +74,7 @@ class ServiceReferentielService extends AbstractEntityService
     */
    public function initQuery(QueryBuilder $qb = null, $alias = null, array $fields = [])
    {
        list($qb, $alias) = parent::initQuery($qb, $alias, $fields);
        [$qb, $alias] = parent::initQuery($qb, $alias, $fields);

        $this
            ->join($this->getServiceStructure(), $qb, 'structure', true, $alias)
@@ -96,7 +97,7 @@ class ServiceReferentielService extends AbstractEntityService
    {
        $role = $this->getServiceContext()->getSelectedIdentityRole();

        list($qb, $alias) = $this->initQuery($qb, $alias);
        [$qb, $alias] = $this->initQuery($qb, $alias);

        $this->join($this->getServiceIntervenant(), $qb, 'intervenant', false, $alias);
        $this->getServiceIntervenant()->finderByAnnee($this->getServiceContext()->getAnnee(), $qb);
@@ -120,7 +121,7 @@ class ServiceReferentielService extends AbstractEntityService
     */
    public function finderByTypeVolumeHoraire(TypeVolumeHoraire $typeVolumeHoraire, QueryBuilder $qb = null, $alias = null)
    {
        list($qb, $alias) = $this->initQuery($qb, $alias);
        [$qb, $alias] = $this->initQuery($qb, $alias);
        if ($typeVolumeHoraire) {
            $this->join($this->getServiceVolumeHoraireReferentiel(), $qb, 'volumeHoraireReferentiel');
            $this->getServiceVolumeHoraireReferentiel()->finderByTypeVolumeHoraire($typeVolumeHoraire, $qb);
@@ -180,7 +181,7 @@ class ServiceReferentielService extends AbstractEntityService
     */
    public function orderBy(QueryBuilder $qb = null, $alias = null)
    {
        list($qb, $alias) = $this->initQuery($qb, $alias);
        [$qb, $alias] = $this->initQuery($qb, $alias);

        $qb
            ->addOrderBy($this->getServiceIntervenant()->getAlias() . '.nomUsuel')
@@ -377,6 +378,7 @@ class ServiceReferentielService extends AbstractEntityService
    public function getPrevusFromPrevusData(Intervenant $intervenant)
    {
        $tvhPrevu  = $this->getServiceTypeVolumeHoraire()->getPrevu();
        $tvhSource = $this->getServiceTypeVolumeHoraire()->getByCode($this->getServiceParametres()->get('report_service'));
        $evhValide = $this->getServiceEtatVolumeHoraire()->getSaisi();

        $intervenantPrec = $this->getServiceIntervenant()->getBySourceCode(
@@ -399,7 +401,7 @@ class ServiceReferentielService extends AbstractEntityService
        $this->getServiceFonctionReferentiel()->finderByHistorique($qb); // pour éviter que des fonctions devenues historiques ne soient reconduites
        $this->getServiceStructure()->finderByHistorique($qb); // idem pour les structures anciennes!!
        $sVolumeHoraireReferentiel->finderByHistorique($qb);
        $sVolumeHoraireReferentiel->finderByTypeVolumeHoraire($tvhPrevu, $qb);
        $sVolumeHoraireReferentiel->finderByTypeVolumeHoraire($tvhSource, $qb);
        $sVolumeHoraireReferentiel->finderByEtatVolumeHoraire($evhValide, $qb);

        $s = $this->getList($qb);
+6 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ use Application\Service\Traits\ElementPedagogiqueServiceAwareTrait;
use Application\Service\Traits\EtapeServiceAwareTrait;
use Application\Service\Traits\IntervenantServiceAwareTrait;
use Application\Service\Traits\LocalContextServiceAwareTrait;
use Application\Service\Traits\ParametresServiceAwareTrait;
use Application\Service\Traits\PeriodeServiceAwareTrait;
use Application\Service\Traits\SourceServiceAwareTrait;
use Application\Service\Traits\StatutIntervenantServiceAwareTrait;
@@ -60,6 +61,7 @@ class ServiceService extends AbstractEntityService
    use ValidationServiceAwareTrait;
    use StatutIntervenantServiceAwareTrait;
    use SourceServiceAwareTrait;
    use ParametresServiceAwareTrait;

    /**
     *
@@ -608,7 +610,7 @@ class ServiceService extends AbstractEntityService
            foreach ($o['heures'] as $heures) {
                $volumeHoraire = $this->getServiceVolumeHoraire()->newEntity();
                //@formatter:off
                $volumeHoraire->setTypeVolumeHoraire( $heures['type-volume-horaire'] );
                $volumeHoraire->setTypeVolumeHoraire( $typeVolumeHoraire );
                $volumeHoraire->setPeriode          ( $heures['periode']             );
                $volumeHoraire->setTypeIntervention ( $heures['type-intervention']   );
                $volumeHoraire->setHeures           ( $heures['heures']              );
@@ -629,6 +631,7 @@ class ServiceService extends AbstractEntityService
    public function getPrevusFromPrevusData(Intervenant $intervenant)
    {
        $tvhPrevu  = $this->getServiceTypeVolumeHoraire()->getPrevu();
        $tvhSource = $this->getServiceTypeVolumeHoraire()->getByCode($this->getServiceParametres()->get('report_service'));
        $evhValide = $this->getServiceEtatVolumeHoraire()->getValide();

        $intervenantPrec = $this->getServiceIntervenant()->getBySourceCode(
@@ -651,7 +654,7 @@ class ServiceService extends AbstractEntityService
        $this->finderByHistorique($qb);
        $this->finderByIntervenant($intervenantPrec, $qb);
        $sVolumeHoraire->finderByHistorique($qb);
        $sVolumeHoraire->finderByTypeVolumeHoraire($tvhPrevu, $qb);
        $sVolumeHoraire->finderByTypeVolumeHoraire($tvhSource, $qb);
        $sVolumeHoraire->finderByEtatVolumeHoraire($evhValide, $qb);

        $s = $this->getList($qb);
@@ -660,7 +663,7 @@ class ServiceService extends AbstractEntityService
        foreach ($s as $service) {

            /* @var $service \Application\Entity\Db\Service */
            $service->setTypeVolumeHoraire($tvhPrevu);
            $service->setTypeVolumeHoraire($tvhSource);
            $oldElement = $service->getElementPedagogique();
            $newElement = $oldElement ? $this->getServiceElementPedagogique()->getBySourceCode(
                $oldElement->getSourceCode(),
+6 −3
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ use Application\Processus\Traits\IntervenantProcessusAwareTrait;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Service\Traits\EtatVolumeHoraireServiceAwareTrait;
use Application\Service\Traits\IntervenantServiceAwareTrait;
use Application\Service\Traits\ParametresServiceAwareTrait;
use Application\Service\Traits\TypeInterventionServiceAwareTrait;
use Application\View\Helper\AbstractViewHelper;
use Application\Entity\Db\Service;
@@ -32,6 +33,7 @@ class Liste extends AbstractViewHelper
    use IntervenantServiceAwareTrait;
    use IntervenantProcessusAwareTrait;
    use IntervenantAwareTrait;
    use ParametresServiceAwareTrait;

    /**
     *
@@ -266,16 +268,17 @@ class Liste extends AbstractViewHelper
                    //'href'          => $this->getAddUrl(),
                    'title'       => "Initialiser le service prévisionnel avec le service prévisionnel validé l'année dernière",
                ];
                $out     .= '<button type="button" ' . $this->htmlAttribs($attribs) . '>Prévu ' . $this->getServiceContext()->getAnneePrecedente() . ' <span class="glyphicon glyphicon-arrow-right"></span> Prévu ' . $this->getServiceContext()->getAnnee() . '</button>&nbsp;';
                $source  = $this->getServiceTypeVolumeHoraire()->getByCode($this->getServiceParametres()->get('report_service'))->getLibelle();
                $out     .= '<button type="button" ' . $this->htmlAttribs($attribs) . '>' . $source . ' ' . $this->getServiceContext()->getAnneePrecedente() . ' <span class="glyphicon glyphicon-arrow-right"></span> Prévisionnel ' . $this->getServiceContext()->getAnnee() . '</button>&nbsp;';
                $out     .= '<div class="modal fade" id="prevu-to-prevu-modal" tabindex="-1" role="dialog" aria-hidden="true">';
                $out     .= '<div class="modal-dialog modal-md">';
                $out     .= '<div class="modal-content">';
                $out     .= '<div class="modal-header">';
                $out     .= '<button type="button" class="close" data-dismiss="modal" aria-label="Annuler"><span aria-hidden="true">&times;</span></button>';
                $out     .= '<h4 class="modal-title">Reporter ici le service prévisionnel validé de l\'année précédente.</h4>';
                $out     .= '<h4 class="modal-title">Reporter ici le service ' . strtolower($source) . ' validé de l\'année précédente.</h4>';
                $out     .= '</div>';
                $out     .= '<div class="modal-body">';
                $out     .= '<p>Souhaitez-vous réellement initialiser votre service prévisionnel à partir de votre service prévisionnel validé de l\'an dernier ?</p>';
                $out     .= '<p>Souhaitez-vous réellement initialiser votre service prévisionnel à partir de votre service ' . strtolower($source) . ' validé de l\'an dernier ?</p>';
                $out     .= '<div class="alert alert-info" id="prevu-to-prevu-attente" style="display:none">';
                $out     .= '<img src="' . $this->getView()->basePath() . '/images/wait.gif" alt="Attente..."/>';
                $out     .= '<div>Reprise des enseignements de l\'année dernière en cours... Merci de patienter.</div>';
Loading