Loading admin/migration/PJPassageDureeVie.php 0 → 100644 +58 −0 Original line number Diff line number Diff line <?php class PJPassageDureeVie extends AbstractMigration { protected $contexte = self::CONTEXTE_ALL; public function description(): string { return "Initalisation de la durée de vie des pièces justificatives"; } public function utile(): bool { return $this->manager->hasOldColumn('TYPE_PIECE_JOINTE_STATUT', 'PREMIER_RECRUTEMENT') && $this->manager->hasNewColumn('TYPE_PIECE_JOINTE_STATUT', 'DUREE_VIE'); } public function action(string $contexte) { if ($contexte == self::CONTEXTE_PRE) { $this->before(); } else { $this->after(); } } protected function before() { $this->manager->sauvegarderTable('TYPE_PIECE_JOINTE_STATUT', 'TPJS_AJOUT_DUREE_VIE'); } protected function after() { $sql = ' UPDATE TYPE_PIECE_JOINTE_STATUT SET DUREE_VIE = ( SELECT CASE WHEN PREMIER_RECRUTEMENT = 1 THEN 99 ELSE 1 END FROM TPJS_AJOUT_DUREE_VIE O WHERE O.ID = TYPE_PIECE_JOINTE_STATUT.ID )'; $this->manager->getSchema()->getBdd()->exec($sql); $this->manager->supprimerSauvegarde('TPJS_AJOUT_DUREE_VIE'); } } No newline at end of file data/ddl.php +8 −25 Original line number Diff line number Diff line Loading @@ -14742,7 +14742,7 @@ 'length' => 0, 'scale' => NULL, 'precision' => NULL, 'nullable' => true, 'nullable' => false, 'default' => NULL, 'commentaire' => NULL, ), Loading Loading @@ -14841,7 +14841,7 @@ 'length' => 0, 'scale' => NULL, 'precision' => NULL, 'nullable' => true, 'nullable' => false, 'default' => NULL, 'commentaire' => NULL, ), Loading Loading @@ -14962,7 +14962,7 @@ 'length' => 0, 'scale' => NULL, 'precision' => NULL, 'nullable' => true, 'nullable' => false, 'default' => NULL, 'commentaire' => NULL, ), Loading Loading @@ -17881,17 +17881,6 @@ 'default' => NULL, 'commentaire' => NULL, ), 'PREMIER_RECRUTEMENT' => array ( 'name' => 'PREMIER_RECRUTEMENT', 'type' => 'NUMBER', 'length' => 0, 'scale' => '0', 'precision' => 1, 'nullable' => false, 'default' => '0', 'commentaire' => NULL, ), 'HISTO_CREATION' => array ( 'name' => 'HISTO_CREATION', Loading Loading @@ -18009,8 +17998,8 @@ 'length' => 0, 'scale' => NULL, 'precision' => NULL, 'nullable' => true, 'default' => NULL, 'nullable' => false, 'default' => '1', 'commentaire' => 'Durée de vie de la pièce jointe', ), ), Loading Loading @@ -30871,9 +30860,6 @@ END UNICAEN_TBL;', -- Seuil HETD AND (COALESCE(i_h.heures,0) > COALESCE(tpjs.seuil_hetd,-1)) -- En fonction du premier recrutement ou non AND (tpjs.premier_recrutement = 0 OR COALESCE(i.premier_recrutement,0) = 1) -- Le RIB n\'\'est demandé QUE s\'\'il est différent!! AND CASE WHEN tpjs.changement_rib = 0 OR d.id IS NULL THEN 1 Loading Loading @@ -30959,7 +30945,7 @@ END UNICAEN_TBL;', pj.id piece_jointe_id, v.id validation_id, f.id fichier_id, MAX(COALESCE(tpjs.duree_vie, 1)) duree_vie, MAX(tpjs.duree_vie) duree_vie, MAX(i.annee_id+duree_vie) date_validite, pj.date_archive date_archive FROM Loading Loading @@ -36601,9 +36587,6 @@ WHERE -- Seuil HETD AND (COALESCE(i_h.heures,0) > COALESCE(tpjs.seuil_hetd,-1)) -- En fonction du premier recrutement ou non AND (tpjs.premier_recrutement = 0 OR COALESCE(i.premier_recrutement,0) = 1) -- Le RIB n\'est demandé QUE s\'il est différent!! AND CASE WHEN tpjs.changement_rib = 0 OR d.id IS NULL THEN 1 Loading Loading @@ -36631,7 +36614,7 @@ SELECT DISTINCT pj.id piece_jointe_id, v.id validation_id, f.id fichier_id, MAX(COALESCE(tpjs.duree_vie, 1)) duree_vie, MAX(tpjs.duree_vie) duree_vie, MAX(i.annee_id+duree_vie) date_validite, pj.date_archive date_archive FROM module/Application/src/Application/Service/TypePieceJointeStatutService.php +35 −51 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ class TypePieceJointeStatutService extends AbstractEntityService { use AnneeServiceAwareTrait; /** * retourne la classe des entités * Loading Loading @@ -51,7 +53,7 @@ class TypePieceJointeStatutService extends AbstractEntityService */ public function finderByStatutIntervenant(StatutIntervenant $statut, QueryBuilder $qb = null, $alias = null) { list($qb, $alias) = $this->initQuery($qb, $alias); [$qb, $alias] = $this->initQuery($qb, $alias); $qb->andWhere("$alias.statut = :statut")->setParameter('statut', $statut); return $qb; Loading @@ -59,24 +61,6 @@ class TypePieceJointeStatutService extends AbstractEntityService /** * Retourne la liste des enregistrements correspondant au témoin de premier recrutement spécifié. * * @param bool $premierRecrutement * @param QueryBuilder|null $queryBuilder * * @return QueryBuilder */ public function finderByPremierRecrutement($premierRecrutement, QueryBuilder $qb = null, $alias = null) { list($qb, $alias) = $this->initQuery($qb, $alias); $qb->andWhere("$alias.premierRecrutement = :flag")->setParameter('flag', $premierRecrutement); return $qb; } /** * @param TypePieceJointeStatut $typePieceJointeStatut * Loading @@ -92,16 +76,16 @@ class TypePieceJointeStatutService extends AbstractEntityService $sql = " SELECT MAX(annee_fin_id) annee_fin MAX(ANNEE_FIN_ID) ANNEE_FIN FROM type_piece_jointe_statut tpjs TYPE_PIECE_JOINTE_STATUT TPJS WHERE tpjs.histo_destruction IS NULL AND tpjs.statut_intervenant_id = :statut AND tpjs.type_piece_jointe_id = :tpj AND tpjs.id <> :id AND tpjs.annee_fin_id IS NOT NULL AND tpjs.annee_fin_id < :annee TPJS.HISTO_DESTRUCTION IS NULL AND TPJS.STATUT_INTERVENANT_ID = :statut AND TPJS.TYPE_PIECE_JOINTE_ID = :tpj AND TPJS.ID <> :id AND TPJS.ANNEE_FIN_ID IS NOT NULL AND TPJS.ANNEE_FIN_ID < :annee "; $res = $this->getEntityManager()->getConnection()->executeQuery($sql, $params)->fetch(); if ($res && (int)$res['ANNEE_FIN'] !== 0) { Loading @@ -128,16 +112,16 @@ class TypePieceJointeStatutService extends AbstractEntityService $sql = " SELECT MAX(annee_debut_id) annee_debut MAX(ANNEE_DEBUT_ID) ANNEE_DEBUT FROM type_piece_jointe_statut tpjs TYPE_PIECE_JOINTE_STATUT TPJS WHERE tpjs.histo_destruction IS NULL AND tpjs.statut_intervenant_id = :statut AND tpjs.type_piece_jointe_id = :tpj AND tpjs.id <> :id AND tpjs.annee_debut_id IS NOT NULL AND tpjs.annee_debut_id > :annee TPJS.HISTO_DESTRUCTION IS NULL AND TPJS.STATUT_INTERVENANT_ID = :statut AND TPJS.TYPE_PIECE_JOINTE_ID = :tpj AND TPJS.ID <> :id AND TPJS.ANNEE_DEBUT_ID IS NOT NULL AND TPJS.ANNEE_DEBUT_ID > :annee "; $res = $this->getEntityManager()->getConnection()->executeQuery($sql, $params)->fetch(); if ($res && (int)$res['ANNEE_DEBUT'] !== 0) { Loading Loading @@ -178,7 +162,7 @@ class TypePieceJointeStatutService extends AbstractEntityService */ public function getList(QueryBuilder $qb = null, $alias = null) { list($qb, $alias) = $this->initQuery($qb, $alias); [$qb, $alias] = $this->initQuery($qb, $alias); $qb->addOrderBy("$alias.id"); return parent::getList($qb, $alias); Loading Loading
admin/migration/PJPassageDureeVie.php 0 → 100644 +58 −0 Original line number Diff line number Diff line <?php class PJPassageDureeVie extends AbstractMigration { protected $contexte = self::CONTEXTE_ALL; public function description(): string { return "Initalisation de la durée de vie des pièces justificatives"; } public function utile(): bool { return $this->manager->hasOldColumn('TYPE_PIECE_JOINTE_STATUT', 'PREMIER_RECRUTEMENT') && $this->manager->hasNewColumn('TYPE_PIECE_JOINTE_STATUT', 'DUREE_VIE'); } public function action(string $contexte) { if ($contexte == self::CONTEXTE_PRE) { $this->before(); } else { $this->after(); } } protected function before() { $this->manager->sauvegarderTable('TYPE_PIECE_JOINTE_STATUT', 'TPJS_AJOUT_DUREE_VIE'); } protected function after() { $sql = ' UPDATE TYPE_PIECE_JOINTE_STATUT SET DUREE_VIE = ( SELECT CASE WHEN PREMIER_RECRUTEMENT = 1 THEN 99 ELSE 1 END FROM TPJS_AJOUT_DUREE_VIE O WHERE O.ID = TYPE_PIECE_JOINTE_STATUT.ID )'; $this->manager->getSchema()->getBdd()->exec($sql); $this->manager->supprimerSauvegarde('TPJS_AJOUT_DUREE_VIE'); } } No newline at end of file
data/ddl.php +8 −25 Original line number Diff line number Diff line Loading @@ -14742,7 +14742,7 @@ 'length' => 0, 'scale' => NULL, 'precision' => NULL, 'nullable' => true, 'nullable' => false, 'default' => NULL, 'commentaire' => NULL, ), Loading Loading @@ -14841,7 +14841,7 @@ 'length' => 0, 'scale' => NULL, 'precision' => NULL, 'nullable' => true, 'nullable' => false, 'default' => NULL, 'commentaire' => NULL, ), Loading Loading @@ -14962,7 +14962,7 @@ 'length' => 0, 'scale' => NULL, 'precision' => NULL, 'nullable' => true, 'nullable' => false, 'default' => NULL, 'commentaire' => NULL, ), Loading Loading @@ -17881,17 +17881,6 @@ 'default' => NULL, 'commentaire' => NULL, ), 'PREMIER_RECRUTEMENT' => array ( 'name' => 'PREMIER_RECRUTEMENT', 'type' => 'NUMBER', 'length' => 0, 'scale' => '0', 'precision' => 1, 'nullable' => false, 'default' => '0', 'commentaire' => NULL, ), 'HISTO_CREATION' => array ( 'name' => 'HISTO_CREATION', Loading Loading @@ -18009,8 +17998,8 @@ 'length' => 0, 'scale' => NULL, 'precision' => NULL, 'nullable' => true, 'default' => NULL, 'nullable' => false, 'default' => '1', 'commentaire' => 'Durée de vie de la pièce jointe', ), ), Loading Loading @@ -30871,9 +30860,6 @@ END UNICAEN_TBL;', -- Seuil HETD AND (COALESCE(i_h.heures,0) > COALESCE(tpjs.seuil_hetd,-1)) -- En fonction du premier recrutement ou non AND (tpjs.premier_recrutement = 0 OR COALESCE(i.premier_recrutement,0) = 1) -- Le RIB n\'\'est demandé QUE s\'\'il est différent!! AND CASE WHEN tpjs.changement_rib = 0 OR d.id IS NULL THEN 1 Loading Loading @@ -30959,7 +30945,7 @@ END UNICAEN_TBL;', pj.id piece_jointe_id, v.id validation_id, f.id fichier_id, MAX(COALESCE(tpjs.duree_vie, 1)) duree_vie, MAX(tpjs.duree_vie) duree_vie, MAX(i.annee_id+duree_vie) date_validite, pj.date_archive date_archive FROM Loading Loading @@ -36601,9 +36587,6 @@ WHERE -- Seuil HETD AND (COALESCE(i_h.heures,0) > COALESCE(tpjs.seuil_hetd,-1)) -- En fonction du premier recrutement ou non AND (tpjs.premier_recrutement = 0 OR COALESCE(i.premier_recrutement,0) = 1) -- Le RIB n\'est demandé QUE s\'il est différent!! AND CASE WHEN tpjs.changement_rib = 0 OR d.id IS NULL THEN 1 Loading Loading @@ -36631,7 +36614,7 @@ SELECT DISTINCT pj.id piece_jointe_id, v.id validation_id, f.id fichier_id, MAX(COALESCE(tpjs.duree_vie, 1)) duree_vie, MAX(tpjs.duree_vie) duree_vie, MAX(i.annee_id+duree_vie) date_validite, pj.date_archive date_archive FROM
module/Application/src/Application/Service/TypePieceJointeStatutService.php +35 −51 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ class TypePieceJointeStatutService extends AbstractEntityService { use AnneeServiceAwareTrait; /** * retourne la classe des entités * Loading Loading @@ -51,7 +53,7 @@ class TypePieceJointeStatutService extends AbstractEntityService */ public function finderByStatutIntervenant(StatutIntervenant $statut, QueryBuilder $qb = null, $alias = null) { list($qb, $alias) = $this->initQuery($qb, $alias); [$qb, $alias] = $this->initQuery($qb, $alias); $qb->andWhere("$alias.statut = :statut")->setParameter('statut', $statut); return $qb; Loading @@ -59,24 +61,6 @@ class TypePieceJointeStatutService extends AbstractEntityService /** * Retourne la liste des enregistrements correspondant au témoin de premier recrutement spécifié. * * @param bool $premierRecrutement * @param QueryBuilder|null $queryBuilder * * @return QueryBuilder */ public function finderByPremierRecrutement($premierRecrutement, QueryBuilder $qb = null, $alias = null) { list($qb, $alias) = $this->initQuery($qb, $alias); $qb->andWhere("$alias.premierRecrutement = :flag")->setParameter('flag', $premierRecrutement); return $qb; } /** * @param TypePieceJointeStatut $typePieceJointeStatut * Loading @@ -92,16 +76,16 @@ class TypePieceJointeStatutService extends AbstractEntityService $sql = " SELECT MAX(annee_fin_id) annee_fin MAX(ANNEE_FIN_ID) ANNEE_FIN FROM type_piece_jointe_statut tpjs TYPE_PIECE_JOINTE_STATUT TPJS WHERE tpjs.histo_destruction IS NULL AND tpjs.statut_intervenant_id = :statut AND tpjs.type_piece_jointe_id = :tpj AND tpjs.id <> :id AND tpjs.annee_fin_id IS NOT NULL AND tpjs.annee_fin_id < :annee TPJS.HISTO_DESTRUCTION IS NULL AND TPJS.STATUT_INTERVENANT_ID = :statut AND TPJS.TYPE_PIECE_JOINTE_ID = :tpj AND TPJS.ID <> :id AND TPJS.ANNEE_FIN_ID IS NOT NULL AND TPJS.ANNEE_FIN_ID < :annee "; $res = $this->getEntityManager()->getConnection()->executeQuery($sql, $params)->fetch(); if ($res && (int)$res['ANNEE_FIN'] !== 0) { Loading @@ -128,16 +112,16 @@ class TypePieceJointeStatutService extends AbstractEntityService $sql = " SELECT MAX(annee_debut_id) annee_debut MAX(ANNEE_DEBUT_ID) ANNEE_DEBUT FROM type_piece_jointe_statut tpjs TYPE_PIECE_JOINTE_STATUT TPJS WHERE tpjs.histo_destruction IS NULL AND tpjs.statut_intervenant_id = :statut AND tpjs.type_piece_jointe_id = :tpj AND tpjs.id <> :id AND tpjs.annee_debut_id IS NOT NULL AND tpjs.annee_debut_id > :annee TPJS.HISTO_DESTRUCTION IS NULL AND TPJS.STATUT_INTERVENANT_ID = :statut AND TPJS.TYPE_PIECE_JOINTE_ID = :tpj AND TPJS.ID <> :id AND TPJS.ANNEE_DEBUT_ID IS NOT NULL AND TPJS.ANNEE_DEBUT_ID > :annee "; $res = $this->getEntityManager()->getConnection()->executeQuery($sql, $params)->fetch(); if ($res && (int)$res['ANNEE_DEBUT'] !== 0) { Loading Loading @@ -178,7 +162,7 @@ class TypePieceJointeStatutService extends AbstractEntityService */ public function getList(QueryBuilder $qb = null, $alias = null) { list($qb, $alias) = $this->initQuery($qb, $alias); [$qb, $alias] = $this->initQuery($qb, $alias); $qb->addOrderBy("$alias.id"); return parent::getList($qb, $alias); Loading