Commit 26351c1e authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Finalisation durée de vie d'un agrément.

- Adaptation de la vue TblAgrement.php
- Adaption interface utilisateur
parent c7dee755
Loading
Loading
Loading
Loading
+234 −86
Original line number Diff line number Diff line
@@ -13448,6 +13448,17 @@
          'default' => NULL,
          'commentaire' => NULL,
        ),
        'ANNEE_AGREMENT' => 
        array (
          'name' => 'ANNEE_AGREMENT',
          'type' => 'NUMBER',
          'length' => 0,
          'scale' => NULL,
          'precision' => NULL,
          'nullable' => true,
          'default' => NULL,
          'commentaire' => NULL,
        ),
      ),
    ),
    'TBL_CHARGENS' => 
@@ -16143,6 +16154,17 @@
          'default' => '1',
          'commentaire' => NULL,
        ),
        'PREMIER_RECRUTEMENT' => 
        array (
          'name' => 'PREMIER_RECRUTEMENT',
          'type' => 'NUMBER',
          'length' => 0,
          'scale' => NULL,
          'precision' => NULL,
          'nullable' => true,
          'default' => NULL,
          'commentaire' => NULL,
        ),
      ),
    ),
    'TYPE_CONTRAT' => 
@@ -29684,16 +29706,40 @@ END UNICAEN_TBL;',
            JOIN element_pedagogique ep ON ep.id = s.element_pedagogique_id
          WHERE
            frs.total > 0
        ),
        avi AS (
            SELECT DISTINCT
                i.code                code_intervenant,
                i.annee_id            annee_id,
                a.type_agrement_id    type_agrement,
                a.id             agrement_id,
                tas.duree_vie         duree_vie,
                i.annee_id+duree_vie date_validite
            FROM intervenant i
            JOIN type_agrement_statut tas ON tas.statut_intervenant_id = i.statut_id
            JOIN agrement a ON a.intervenant_id = i.id AND tas.type_agrement_id = a.type_agrement_id AND a.histo_destruction IS NULL
        )
        SELECT
        SELECT "ANNEE_ID","ANNEE_AGREMENT","TYPE_AGREMENT_ID","INTERVENANT_ID","CODE_INTERVENANT","STRUCTURE_ID","OBLIGATOIRE","AGREMENT_ID","DUREE_VIE","RANK" FROM (
            SELECT DISTINCT
              i.annee_id                     annee_id,
              CASE
                WHEN NVL(NVL(a.id, avi.agrement_id),0) = 0
                THEN NULL
                ELSE NVL(avi.annee_id, i.annee_id) END   annee_agrement,
              tas.type_agrement_id                       type_agrement_id,
              i.id                                       intervenant_id,
              i.code                                     code_intervenant,
              null                                       structure_id,
              tas.obligatoire                            obligatoire,
          a.id                    agrement_id,
          tas.duree_vie           duree_vie
              NVL(a.id, avi.agrement_id)                 agrement_id,
              tas.duree_vie                              duree_vie,
              RANK() OVER(
                PARTITION BY i.annee_id ORDER BY
                CASE
                WHEN NVL(NVL(a.id, avi.agrement_id),0) = 0
                THEN NULL
                ELSE NVL(avi.annee_id, i.annee_id) END DESC
              ) rank
            FROM
              type_agrement                  ta
              JOIN type_agrement_statut      tas ON tas.type_agrement_id = ta.id
@@ -29703,30 +29749,51 @@ END UNICAEN_TBL;',
                                               -- AND (tas.premier_recrutement IS NULL OR NVL(i.premier_recrutement,0) = tas.premier_recrutement)
                                                AND i.statut_id = tas.statut_intervenant_id
              JOIN                           i_s ON i_s.intervenant_id = i.id
              LEFT JOIN agrement               a ON a.type_agrement_id = ta.id
                                                AND a.intervenant_id = i.id
                                                AND a.histo_destruction IS NULL
              LEFT JOIN                      avi ON i.code = avi.code_intervenant
                                                AND tas.type_agrement_id = avi.type_agrement
                                                AND i.annee_id < avi.date_validite
                                                AND i.annee_id >= avi.annee_id
            WHERE
              ta.code = \'\'CONSEIL_ACADEMIQUE\'\')
        WHERE
          ta.code = \'\'CONSEIL_ACADEMIQUE\'\'
          rank = 1
        UNION ALL
        SELECT
        SELECT "ANNEE_ID","ANNEE_AGREMENT","TYPE_AGREMENT_ID","INTERVENANT_ID","CODE_INTERVENANT","STRUCTURE_ID","OBLIGATOIRE","AGREMENT_ID","DUREE_VIE","RANK" FROM (
            SELECT DISTINCT
              i.annee_id                                  annee_id,
              CASE
                WHEN NVL(NVL(a.id, avi.agrement_id),0) = 0
                THEN NULL
                ELSE NVL(avi.annee_id, i.annee_id) END    annee_agrement,
              tas.type_agrement_id                        type_agrement_id,
              i.id                                        intervenant_id,
              i.code                                      code_intervenant,
              i_s.structure_id                            structure_id,
              tas.obligatoire                             obligatoire,
          a.id                    agrement_id,
          tas.duree_vie           duree_vie
              NVL(a.id, avi.agrement_id)                  agrement_id,
              tas.duree_vie                               duree_vie,
              RANK() OVER(
                PARTITION BY i.annee_id ORDER BY
                CASE
                WHEN NVL(NVL(a.id, avi.agrement_id),0) = 0
                THEN NULL
                ELSE NVL(avi.annee_id, i.annee_id) END DESC
              ) rank
            FROM
              type_agrement                   ta
              JOIN type_agrement_statut      tas ON tas.type_agrement_id = ta.id
                                                AND tas.histo_destruction IS NULL
              JOIN intervenant                 i ON i.histo_destruction IS NULL
                                           -- AND (tas.premier_recrutement IS NULL OR NVL(i.premier_recrutement,0) = tas.premier_recrutement)
                                                AND i.statut_id = tas.statut_intervenant_id
              JOIN                           i_s ON i_s.intervenant_id = i.id
@@ -29735,13 +29802,23 @@ END UNICAEN_TBL;',
                                                AND a.intervenant_id = i.id
                                                AND a.structure_id = i_s.structure_id
                                                AND a.histo_destruction IS NULL
              LEFT JOIN                      avi ON i.code = avi.code_intervenant
                                                AND tas.type_agrement_id = avi.type_agrement
                                                AND i.annee_id < avi.date_validite
                                                AND i.annee_id >= avi.annee_id
            WHERE
              ta.code = \'\'CONSEIL_RESTREINT\'\')
        WHERE
          ta.code = \'\'CONSEIL_RESTREINT\'\') tv
          rank = 1) tv
      WHERE
        \' || conds || \'
    ) v ON (
            COALESCE(t.STRUCTURE_ID,0) = COALESCE(v.STRUCTURE_ID,0)
            COALESCE(t.ANNEE_AGREMENT,0) = COALESCE(v.ANNEE_AGREMENT,0)
        AND COALESCE(t.STRUCTURE_ID,0) = COALESCE(v.STRUCTURE_ID,0)
        AND t.INTERVENANT_ID   = v.INTERVENANT_ID
        AND t.TYPE_AGREMENT_ID = v.TYPE_AGREMENT_ID
@@ -29757,6 +29834,7 @@ END UNICAEN_TBL;',
    WHEN NOT MATCHED THEN INSERT (
      ID,
      ANNEE_AGREMENT,
      DUREE_VIE,
      CODE_INTERVENANT,
      AGREMENT_ID,
@@ -29770,6 +29848,7 @@ END UNICAEN_TBL;',
    ) VALUES (
      TBL_AGREMENT_ID_SEQ.NEXTVAL,
      v.ANNEE_AGREMENT,
      v.DUREE_VIE,
      v.CODE_INTERVENANT,
      v.AGREMENT_ID,
@@ -35854,16 +35933,40 @@ WITH i_s AS (
    JOIN element_pedagogique ep ON ep.id = s.element_pedagogique_id
  WHERE
    frs.total > 0
),
avi AS (
    SELECT DISTINCT
        i.code                code_intervenant,
        i.annee_id            annee_id,
        a.type_agrement_id    type_agrement,
        a.id             agrement_id,
        tas.duree_vie         duree_vie,
        i.annee_id+duree_vie date_validite
    FROM intervenant i
    JOIN type_agrement_statut tas ON tas.statut_intervenant_id = i.statut_id
    JOIN agrement a ON a.intervenant_id = i.id AND tas.type_agrement_id = a.type_agrement_id AND a.histo_destruction IS NULL
)
SELECT
SELECT "ANNEE_ID","ANNEE_AGREMENT","TYPE_AGREMENT_ID","INTERVENANT_ID","CODE_INTERVENANT","STRUCTURE_ID","OBLIGATOIRE","AGREMENT_ID","DUREE_VIE","RANK" FROM (
    SELECT DISTINCT
      i.annee_id                     annee_id,
      CASE
        WHEN NVL(NVL(a.id, avi.agrement_id),0) = 0
        THEN NULL
        ELSE NVL(avi.annee_id, i.annee_id) END   annee_agrement,
      tas.type_agrement_id                       type_agrement_id,
      i.id                                       intervenant_id,
      i.code                                     code_intervenant,
      null                                       structure_id,
      tas.obligatoire                            obligatoire,
  a.id                    agrement_id,
  tas.duree_vie           duree_vie
      NVL(a.id, avi.agrement_id)                 agrement_id,
      tas.duree_vie                              duree_vie,
      RANK() OVER(
        PARTITION BY i.annee_id ORDER BY
        CASE
        WHEN NVL(NVL(a.id, avi.agrement_id),0) = 0
        THEN NULL
        ELSE NVL(avi.annee_id, i.annee_id) END DESC
      ) rank
    FROM
      type_agrement                  ta
      JOIN type_agrement_statut      tas ON tas.type_agrement_id = ta.id
@@ -35873,30 +35976,51 @@ FROM
                                       -- AND (tas.premier_recrutement IS NULL OR NVL(i.premier_recrutement,0) = tas.premier_recrutement)
                                        AND i.statut_id = tas.statut_intervenant_id
      JOIN                           i_s ON i_s.intervenant_id = i.id
      LEFT JOIN agrement               a ON a.type_agrement_id = ta.id
                                        AND a.intervenant_id = i.id
                                        AND a.histo_destruction IS NULL
      LEFT JOIN                      avi ON i.code = avi.code_intervenant
                                        AND tas.type_agrement_id = avi.type_agrement
                                        AND i.annee_id < avi.date_validite
                                        AND i.annee_id >= avi.annee_id
    WHERE
      ta.code = \'CONSEIL_ACADEMIQUE\')
WHERE
  ta.code = \'CONSEIL_ACADEMIQUE\'
  rank = 1
UNION ALL
SELECT
SELECT "ANNEE_ID","ANNEE_AGREMENT","TYPE_AGREMENT_ID","INTERVENANT_ID","CODE_INTERVENANT","STRUCTURE_ID","OBLIGATOIRE","AGREMENT_ID","DUREE_VIE","RANK" FROM (
    SELECT DISTINCT
      i.annee_id                                  annee_id,
      CASE
        WHEN NVL(NVL(a.id, avi.agrement_id),0) = 0
        THEN NULL
        ELSE NVL(avi.annee_id, i.annee_id) END    annee_agrement,
      tas.type_agrement_id                        type_agrement_id,
      i.id                                        intervenant_id,
      i.code                                      code_intervenant,
      i_s.structure_id                            structure_id,
      tas.obligatoire                             obligatoire,
  a.id                    agrement_id,
  tas.duree_vie           duree_vie
      NVL(a.id, avi.agrement_id)                  agrement_id,
      tas.duree_vie                               duree_vie,
      RANK() OVER(
        PARTITION BY i.annee_id ORDER BY
        CASE
        WHEN NVL(NVL(a.id, avi.agrement_id),0) = 0
        THEN NULL
        ELSE NVL(avi.annee_id, i.annee_id) END DESC
      ) rank
    FROM
      type_agrement                   ta
      JOIN type_agrement_statut      tas ON tas.type_agrement_id = ta.id
                                        AND tas.histo_destruction IS NULL
      JOIN intervenant                 i ON i.histo_destruction IS NULL
                                   -- AND (tas.premier_recrutement IS NULL OR NVL(i.premier_recrutement,0) = tas.premier_recrutement)
                                        AND i.statut_id = tas.statut_intervenant_id
      JOIN                           i_s ON i_s.intervenant_id = i.id
@@ -35905,8 +36029,17 @@ FROM
                                        AND a.intervenant_id = i.id
                                        AND a.structure_id = i_s.structure_id
                                        AND a.histo_destruction IS NULL
      LEFT JOIN                      avi ON i.code = avi.code_intervenant
                                        AND tas.type_agrement_id = avi.type_agrement
                                        AND i.annee_id < avi.date_validite
                                        AND i.annee_id >= avi.annee_id
    WHERE
      ta.code = \'CONSEIL_RESTREINT\')
WHERE
  ta.code = \'CONSEIL_RESTREINT\'',
  rank = 1',
    ),
    'V_TBL_CHARGENS' => 
    array (
@@ -44359,13 +44492,14 @@ WHERE
    array (
      'name' => 'TBL_AGREMENT__UN',
      'table' => 'TBL_AGREMENT',
      'index' => 'TBL_AGREMENT__UN_IDX',
      'index' => 'TBL_AGREMENT__UN',
      'columns' => 
      array (
        0 => 'TYPE_AGREMENT_ID',
        1 => 'INTERVENANT_ID',
        2 => 'STRUCTURE_ID',
        3 => 'TO_DELETE',
        4 => 'ANNEE_AGREMENT',
      ),
    ),
    'TBL_CHARGENS_SEUILS_DEF__UN' => 
@@ -51157,6 +51291,20 @@ END;',
        0 => 'ID',
      ),
    ),
    'TBL_AGREMENT__UN' => 
    array (
      'name' => 'TBL_AGREMENT__UN',
      'unique' => true,
      'table' => 'TBL_AGREMENT',
      'columns' => 
      array (
        0 => 'TYPE_AGREMENT_ID',
        1 => 'INTERVENANT_ID',
        2 => 'STRUCTURE_ID',
        3 => 'TO_DELETE',
        4 => 'ANNEE_AGREMENT',
      ),
    ),
    'TBL_AGREMENT__UN_IDX' => 
    array (
      'name' => 'TBL_AGREMENT__UN_IDX',
+10 −4
Original line number Diff line number Diff line
@@ -88,9 +88,8 @@ class AgrementController extends AbstractController

        $role         = $this->getServiceContext()->getSelectedIdentityRole();
        $typeAgrement = $this->getEvent()->getParam('typeAgrement');
        /* @var $typeAgrement TypeAgrement */
        $intervenant = $this->getEvent()->getParam('intervenant');
        /* @var $intervenant Intervenant */

        if (!$intervenant){
            throw new \LogicException('Intervenant non précisé ou inexistant');
        }
@@ -102,7 +101,6 @@ class AgrementController extends AbstractController
        $this->getServiceTblAgrement()->leftJoin(AgrementService::class, $qb, 'agrement', true);

        $tas = $this->getServiceTblAgrement()->getList($qb);
        /* @var $tas TblAgrement[] */

        $needStructure = false;
        $hasActions    = false;
@@ -304,9 +302,17 @@ class AgrementController extends AbstractController

    private function updateTableauxBord(Intervenant $intervenant)
    {
        //@alecourtes : Récupérer les intervenants avec le même code car l'agrement peut être valide
        //plusieurs années pour plusieurs intervenants avec un même code

        $listeIntervenants = $this->getServiceIntervenant()->getByCodeIntervenant($intervenant->getCode());
        if(empty($listeIntervenants))
        {
            $listeIntervenants[] = $intervenant;
        }
        $this->getServiceWorkflow()->calculerTableauxBord([
            'agrement',
            'contrat',
        ], $intervenant);
        ], $listeIntervenants);
    }
}
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -5,6 +5,11 @@
            <generator strategy="SEQUENCE"/>
        </id>
        <field name="obligatoire" type="boolean" column="OBLIGATOIRE" nullable="false"/>
        <many-to-one field="anneeAgrement" target-entity="Application\Entity\Db\Annee">
            <join-columns>
                <join-column name="ANNEE_AGREMENT" referenced-column-name="ID"/>
            </join-columns>
        </many-to-one>
        <many-to-one field="annee" target-entity="Application\Entity\Db\Annee">
            <join-columns>
                <join-column name="ANNEE_ID" referenced-column-name="ID"/>
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
    <field name="histoCreation" type="datetime" column="HISTO_CREATION" nullable="false"/>
    <field name="histoDestruction" type="datetime" column="HISTO_DESTRUCTION" nullable="true"/>
    <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/>
    <field name="premierRecrutement" type="boolean" column="PREMIER_RECRUTEMENT" nullable="true"/>
    <field name="obligatoire" type="boolean" column="OBLIGATOIRE" nullable="false"/>
    <many-to-one field="histoModificateur" target-entity="Application\Entity\Db\Utilisateur">
      <join-columns>
+10 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ class TblAgrement implements ResourceInterface

    private $dureeVie;

    private $anneeAgrement;

    /**
     * Get id
     *
@@ -69,6 +71,14 @@ class TblAgrement implements ResourceInterface
        return $this->dureeVie;
    }

    /**
     * @return mixed
     */
    public function getAnneeAgrement()
    {
        return $this->anneeAgrement;
    }


    /**
     * Returns the string identifier of the Resource
Loading