Commit 2b11c494 authored by Florian Joriot's avatar Florian Joriot
Browse files

Merge branch 'refs/heads/b23'

# Conflicts:
#	composer.lock
#	module/Dossier/src/Entity/Db/IntervenantDossier.php
#	module/ExportRh/src/Connecteur/Siham/SihamConnecteur.php
#	module/ExportRh/src/Entity/IntervenantRh.php
#	module/Intervenant/config/module.config.php
#	module/Intervenant/src/Entity/Db/Intervenant.php
parents 3a515651 14cc7584
Loading
Loading
Loading
Loading
+7 −0
Changes for admin/actions/install-bdd.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -21,6 +21,13 @@ $bdd->setOption('histo-user-id', $oa->getOseAppliId());

// On installe ensuite toutes les données
$bdd->dataUpdater()->run('install');
//Provisoire en attendant de mettre à jour les données par défaut
$sqlUpdatePjActive = "UPDATE statut SET PJ_ACTIVE  = 0 WHERE id NOT IN (
                                    SELECT s.id FROM type_piece_jointe_statut tpjs
                                    JOIN statut s ON s.id = tpjs.statut_id 
                                    AND tpjs.histo_destruction is NULL
                                    GROUP BY s.id)";
$bdd->exec($sqlUpdatePjActive);

/* On construit les plafonds et les tableaux de bord */
$args = 'plafonds construire';
+56 −0
Changes for admin/migration/v23FonctionReferentielCorrectionHisto.php: 56 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php


use Unicaen\BddAdmin\Bdd;
class v23FonctionReferentielCorrectionHisto extends AbstractMigration
{

    public function description(): string
    {
        return "Correction des histo_modification des fonctions referentielles";
    }



    public function utile(): bool
    {
        $bdd = $this->manager->getBdd();

        $res = $bdd->select('select count(*) C from fonction_referentiel WHERE histo_modification IS NULL');

        return $res[0]['C'] == 0;
    }



    public function after()
    {
        $bdd = $this->manager->getBdd();
        $c   = $this->manager->getOseAdmin()->console();

        $c->msg('Correction des histo_modification des fonctions référentielles en cours');
        $annee = $this->anneeCourante();
        $sql   = 'UPDATE fonction_referentiel fr
                        SET fr.histo_modification = null , fr.histo_modificateur_id = null 
                        WHERE fr.annee_id > :annee';
        $param = ['annee' => $annee];

        $bdd->exec($sql, $param);


        $c->msg('Correction des histo_modification des fonctions référentielles terminée');
    }



    private function anneeCourante()
    {
        $annee = date('Y');
        $mois  = date('m');
        if ($mois > 8) {
            return $annee;
        } else {
            return $annee - 1;
        }
    }
}
 No newline at end of file
+56 −0
Changes for admin/migration/v23UpdateStatutParamsIndemnitesEtPj.php: 56 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php





class v23UpdateStatutParamsIndemnitesEtPj extends AbstractMigration
{

    public function description(): string
    {
        return "Mise à jour activation des pièces justificatives et indémnités journalières par statuts";
    }



    public function utile(): bool
    {
        $c   = $this->manager->getOseAdmin()->console();
        $bdd = $this->manager->getBdd();
        if ($this->manager->hasNewColumn('STATUT', 'PJ_ACTIVE') || $this->manager->hasNewColumn('INTERVENANT_DOSSIER', 'SITUATION_MATRIMONIALE_ID')) {
            return true;
        }


        return false;
    }



    public function after()
    {
        $c   = $this->manager->getOseAdmin()->console();
        $bdd = $this->manager->getBdd();
        //On traite d'abord la colonne PJ_ACTIVE
        $this->manager->sauvegarderTable('STATUT', 'SAVE_STATUT');
        //On désactive les pièces justificatives sur les statuts sur lesquels on ne demande aucune pièce
        $c->println("Désactivation des pièces justificatives sur les statuts sur lesquels on ne demande aucune pièce");
        $sqlUpdatePjActive = "UPDATE statut SET PJ_ACTIVE  = 0 WHERE id NOT IN (
                                    SELECT s.id FROM type_piece_jointe_statut tpjs
                                    JOIN statut s ON s.id = tpjs.statut_id 
                                    AND tpjs.histo_destruction is NULL
                                    GROUP BY s.id)";
        $bdd->exec($sqlUpdatePjActive);
        //On désactive les indemnités de fin de contrat sur le statut si on a aucun entrée dans la table prime
        $c->println("Désactivation des indémnités de fin de mission sur les statuts où aucun intervenant n'a encore eu d'indémnités de fin de mission");
        //On désactive les indémintés de fin de mission sur les statuts sur lesquels il n'y a eu aucun prime de fin de mission de crée
        $sqlUpdateMission = "UPDATE statut SET MISSION_INDEMNITEES = 0 WHERE id NOT IN (
                                    SELECT s.id FROM mission_prime mp 
                                    JOIN intervenant i ON i.id = mp.intervenant_id 
                                    JOIN statut s ON s.id = i.statut_id
                                    GROUP BY s.id
                                    )";
        $bdd->exec($sqlUpdateMission);
    }
}
 No newline at end of file
+44 −0
Changes for admin/migration/v23UpdateVolumeHoraireMission.php: 44 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php





class v23UpdateVolumeHoraireMission extends AbstractMigration
{

    public function description(): string
    {
        return "Mise à jour du source code sur les volumes horaires mission";
    }



    public function utile(): bool
    {
        $c   = $this->manager->getOseAdmin()->console();
        $bdd = $this->manager->getBdd();
        //Si j'ai des source_code null dans la table volume_horaire_missions
        if ($this->manager->has('table', 'VOLUME_HORAIRE_MISSION')) {
            $result = $bdd->select("SELECT id FROM volume_horaire_mission where source_code IS NULL");
            if (!empty($result)) {
                return true;
            }
        }

        return false;
    }



    public function before()
    {
        $c   = $this->manager->getOseAdmin()->console();
        $bdd = $this->manager->getBdd();

        //On met à jour le source code avec la valeur de l'id de la ligne qui lui doit être unique
        $c->println("Update source code avec une valeur unique par ligne de volume horaire");
        $sqlUpdateSourceCode = "UPDATE volume_horaire_mission SET source_code  = id WHERE source_code IS NULL";
        $bdd->exec($sqlUpdateSourceCode);
    }
}
 No newline at end of file
+1 −1
Changes for composer.json: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
        "unicaen/import"                              : "6.0.1",
        "unicaen/tbl"                                 : "6.2.1",
        "unicaen/open-document"                       : "6.0.2",
        "unicaen/siham"                               : "6.1.4",
        "unicaen/siham"                               : "6.1.5",
        "unicaen/mail"                                : "6.1.1",
        "unicaen/vue"                                 : "6.2.3",
        "unicaen/bddadmin"                            : "0.9.0",
Loading