Commit 057ef3bf authored by Thomas Hamel's avatar Thomas Hamel
Browse files

version du module d'Admission fonctionnelle

parent e39fcf08
Loading
Loading
Loading
Loading
+75 −79
Changes for config/autoload/global.php: 75 added lines, 79 removed lines.
Original line number Diff line number Diff line
@@ -5,11 +5,9 @@ namespace Application;
use Application\Entity\Db\Source;
use Application\Navigation\NavigationFactoryFactory;
use Import\Filter\PrefixEtabColumnValueFilter;
use Import\Filter\SetTypeStructureIdFilter;
use Import\Model\ImportObserv;
use Import\Model\ImportObservResult;
use Retraitement\Filter\Command\RetraitementShellCommandMines;
use Structure\Entity\Db\TypeStructure;

$config = [
    'api-tools-content-negotiation' => [
@@ -188,40 +186,6 @@ $config = [
 * Ce qui suit n'est que la config "commune".
 */
const CONFIG_IMPORTS = [
    [
        'name' => 'composante-enseignement-%s',
        'order' => 10,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-octopus-composante-ens',
            'select' => '/structure-light?type=2',
            'source_code_column' => 'SOURCE_CODE',
            'code' => 'UCN::octopus',
            'column_value_filter' => PrefixEtabColumnValueFilter::class,
            'page_size' => 0,
            'columns' => [
                'sigle',
                'libelleLong',
                'code',
            ],
            'column_name_filter' => [
                'sigle' => 'SIGLE',
                'libelleLong' => 'LIBELLE_LONG',
                'code' => 'SOURCE_CODE',
            ],
            'extra' => [
                /** cf. injection dans {@see \Application\generateConfigImportsForEtabs()} */
            ],
        ],
        'destination' => [
            'name' => 'Application',
            'table' => 'tmp_composante_ens',
            'connection' => 'default',
            'source_code_column' => 'SOURCE_CODE',
            'id_strategy' => null,
            'id_sequence' => null,
        ],
    ],
    [
        'name' => 'structure-%s',
        'order' => 10,
@@ -343,8 +307,42 @@ const CONFIG_IMPORTS = [
        ],
    ],
    [
        'name' => 'individu-%s',
        'name' => 'composante-enseignement-%s',
        'order' => 50,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-octopus-composante-ens',
            'select' => '/structure-light?type=2',
            'source_code_column' => 'SOURCE_CODE',
            'code' => 'UCN::octopus',
            'column_value_filter' => \Admission\Filter\PrefixEtabColumnValueFilter::class,
            'page_size' => 0,
            'columns' => [
                'sigle',
                'libelleLong',
                'code',
            ],
            'column_name_filter' => [
                'sigle' => 'SIGLE',
                'libelleLong' => 'LIBELLE_LONG',
                'code' => 'SOURCE_CODE',
            ],
            'extra' => [
                /** cf. injection dans {@see \Application\generateConfigImportsForEtabs()} */
            ],
        ],
        'destination' => [
            'name' => 'Application',
            'table' => 'tmp_composante_ens',
            'connection' => 'default',
            'source_code_column' => 'SOURCE_CODE',
            'id_strategy' => null,
            'id_sequence' => null,
        ],
    ],
    [
        'name' => 'individu-%s',
        'order' => 60,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -384,7 +382,7 @@ const CONFIG_IMPORTS = [
    ],
    [
        'name' => 'doctorant-%s',
        'order' => 60,
        'order' => 70,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -414,7 +412,7 @@ const CONFIG_IMPORTS = [
    ],
    [
        'name' => 'these-%s',
        'order' => 70,
        'order' => 80,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -463,7 +461,7 @@ const CONFIG_IMPORTS = [
    ],
    [
        'name' => 'these-annee-univ-%s',
        'order' => 80,
        'order' => 90,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -493,7 +491,7 @@ const CONFIG_IMPORTS = [
    ],
    [
        'name' => 'role-%s',
        'order' => 90,
        'order' => 100,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -523,7 +521,7 @@ const CONFIG_IMPORTS = [
    ],
    [
        'name' => 'acteur-%s',
        'order' => 100,
        'order' => 110,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -561,7 +559,7 @@ const CONFIG_IMPORTS = [
    ],
    [
        'name' => 'origine-financement-%s',
        'order' => 110,
        'order' => 120,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -592,7 +590,7 @@ const CONFIG_IMPORTS = [
    ],
    [
        'name' => 'financement-%s',
        'order' => 120,
        'order' => 130,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -629,7 +627,7 @@ const CONFIG_IMPORTS = [
    ],
    [
        'name' => 'titre-acces-%s',
        'order' => 130,
        'order' => 140,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -664,7 +662,7 @@ const CONFIG_IMPORTS = [
    ],
    [
        'name' => 'variable-%s',
        'order' => 140,
        'order' => 150,
        'source' => [
            'name' => '%s',
            'connection' => 'sygal-import-ws-%s',
@@ -727,28 +725,6 @@ const CONFIG_SYNCHROS = [
        ],
    ],
    [
        'name' => 'composante-enseignement-%s',
        'order' => 150,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
            'table' => 'SRC_COMPOSANTE_ENS',
            'connection' => 'default',
            'source_code_column' => 'SOURCE_CODE',
        ],
        'destination' => [
            'name' => 'Application',
            'table' => 'COMPOSANTE_ENS',
            'connection' => 'default',
            'source_code_column' => 'SOURCE_CODE',
            'intermediate_table_auto_drop' => false,
            'id_strategy' => 'SEQUENCE',
            'id_sequence' => null,
        ],
    ],
    ////////////////////////////////////////////// ETABLISSEMENT //////////////////////////////////////////////
    [
        ////// ETABLISSEMENT : sans doublons non historisés.
        'name' => 'etablissement-%s',
        'order' => 22,
        'source' => [
@@ -815,11 +791,31 @@ const CONFIG_SYNCHROS = [
            'update_on_deleted_enabled_column' => 'synchro_update_on_deleted_enabled', // pour activer la màj des substitués (historisés)
        ],
    ],
    [
        'name' => 'composante-enseignement-%s',
        'order' => 50,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
            'table' => 'SRC_COMPOSANTE_ENS',
            'connection' => 'default',
            'source_code_column' => 'SOURCE_CODE',
        ],
        'destination' => [
            'name' => 'Application',
            'table' => 'COMPOSANTE_ENS',
            'connection' => 'default',
            'source_code_column' => 'SOURCE_CODE',
            'intermediate_table_auto_drop' => false,
            'id_strategy' => 'SEQUENCE',
            'id_sequence' => null,
        ],
    ],
    ////////////////////////////////////////////// INDIVIDU //////////////////////////////////////////////
    [
        ////// INDIVIDU : sans doublons non historisés.
        'name' => 'individu-%s',
        'order' => 51,
        'order' => 60,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -842,7 +838,7 @@ const CONFIG_SYNCHROS = [
    [
        ////// DOCTORANT : sans doublons non historisés.
        'name' => 'doctorant-%s',
        'order' => 61,
        'order' => 70,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -864,7 +860,7 @@ const CONFIG_SYNCHROS = [
    ////////////////////////////////////////////// THESE //////////////////////////////////////////////
    [
        'name' => 'these-%s',
        'order' => 70,
        'order' => 80,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -884,7 +880,7 @@ const CONFIG_SYNCHROS = [
    ////////////////////////////////////////////// THESE-ANNEE-UNIV //////////////////////////////////////////////
    [
        'name' => 'these-annee-univ-%s',
        'order' => 80,
        'order' => 90,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -904,7 +900,7 @@ const CONFIG_SYNCHROS = [
    ////////////////////////////////////////////// ROLE //////////////////////////////////////////////
    [
        'name' => 'role-%s',
        'order' => 90,
        'order' => 100,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -924,7 +920,7 @@ const CONFIG_SYNCHROS = [
    ////////////////////////////////////////////// ACTEUR //////////////////////////////////////////////
    [
        'name' => 'acteur-%s',
        'order' => 100,
        'order' => 110,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -944,7 +940,7 @@ const CONFIG_SYNCHROS = [
    ////////////////////////////////////////////// ORIGINE-FINANCEMENT //////////////////////////////////////////////
    [
        'name' => 'origine-financement-%s',
        'order' => 110,
        'order' => 120,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -964,7 +960,7 @@ const CONFIG_SYNCHROS = [
    ////////////////////////////////////////////// FINANCEMENT //////////////////////////////////////////////
    [
        'name' => 'financement-%s',
        'order' => 120,
        'order' => 130,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -984,7 +980,7 @@ const CONFIG_SYNCHROS = [
    ////////////////////////////////////////////// TITRE-ACCES //////////////////////////////////////////////
    [
        'name' => 'titre-acces-%s',
        'order' => 130,
        'order' => 140,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -1004,7 +1000,7 @@ const CONFIG_SYNCHROS = [
    ////////////////////////////////////////////// VARIABLE //////////////////////////////////////////////
    [
        'name' => 'variable-%s',
        'order' => 140,
        'order' => 150,
        'source' => [
            'name' => 'SyGAL',
            'code' => 'app',
@@ -1037,8 +1033,8 @@ function generateConfigImportsForEtabs(array $etabs): array
            $array['source']['name'] = generateNameForEtab($array['source']['name'], $etab);
            $array['source']['connection'] = generateNameForEtab($array['source']['connection'], $etab);
            $array['source']['extra'] = [
                SetTypeStructureIdFilter::PARAM_CODE_TYPE_STRUCTURE => TypeStructure::CODE_COMPOSANTE_ENSEIGNEMENT,
                PrefixEtabColumnValueFilter::PARAM_CODE_ETABLISSEMENT => $etab,
                \Admission\Filter\PrefixEtabColumnValueFilter::PARAM_CODE_ETABLISSEMENT => $etab
            ];
            $synchros[] = $array;
        }
+126 −117
Changes for module/Admission/Sql/admission.sql: 126 added lines, 117 removed lines.
Original line number Diff line number Diff line
-- Suppression des tables associés à Admission
DROP TABLE IF EXISTS admission_etat CASCADE;
DROP TABLE IF EXISTS admission_validation;
drop table if exists admission_avis;
DROP TABLE IF EXISTS admission_avis;
DROP TABLE IF EXISTS admission_type_validation;
DROP TABLE IF EXISTS admission_verification;
DROP TABLE IF EXISTS admission_etudiant;
DROP TABLE IF EXISTS admission_inscription;

--------Import des composantes d'enseignement-----------------------
--Ajout de la table Composante d'enseignement
INSERT INTO source(id, code, libelle, etablissement_id, importable)
VALUES (6, 'UCN::octopus', 'Octopus UCN', 2, true)
ON CONFLICT DO NOTHING;
INSERT INTO type_structure(id, code, libelle)
VALUES (4, 'composante-enseignement', 'Composante d''enseignement')
ON CONFLICT DO NOTHING;;

--Suppression des données existantes concernant l'import des composantes d'enseignement
drop view if exists v_diff_structure;
drop view if exists src_structure;
drop view if exists v_diff_composante_ens;
drop view if exists src_composante_ens;
drop table if exists tmp_composante_ens;
drop table if exists composante_ens;
--Création de la table TEMP de Composante d'enseignement
create table public.tmp_composante_ens
(
    id                    bigserial,
    sigle                 varchar(64),
    libelle_long          varchar(200),
    insert_date           timestamp(0) default ('now'::text)::timestamp without time zone,
    source_id             bigint                                                             not null,
    source_code           varchar(64)                                                        not null,
    source_insert_date    timestamp    default ('now'::text)::timestamp without time zone,
    histo_creation        timestamp(0) default ('now'::text)::timestamp(0) without time zone not null,
    histo_modification    timestamp(0),
    histo_destruction     timestamp(0),
    histo_createur_id     bigint                                                             not null,
    histo_modificateur_id bigint,
    histo_destructeur_id  bigint
);

create index tmp_composante_ens_source_code_index
    on public.tmp_composante_ens (source_code);

create index tmp_composante_ens_source_id_index
    on public.tmp_composante_ens (source_id);

create unique index tmp_composante_ens_unique_index
    on public.tmp_composante_ens (source_id, source_code);

--Création de la table Composante d'enseignement
create table public.composante_ens
(
    id                    bigserial                                                    not null
        primary key,
    structure_id          bigint references structure (id),
    histo_creation        timestamp default ('now'::text)::timestamp without time zone not null,
    histo_createur_id     bigint                                                       not null
        constraint composante_ens_hcfk
            references public.utilisateur
            on delete cascade,
    histo_modification    timestamp,
    histo_modificateur_id bigint
        constraint composante_ens_hmfk
            references public.utilisateur
            on delete cascade,
    histo_destruction     timestamp,
    histo_destructeur_id  bigint
        constraint composante_ens_hdfk
            references public.utilisateur
            on delete cascade,
    source_id             bigint                                                       not null
        constraint composante_ens_source_fk
            references public.source
            on delete cascade,
    source_code           varchar(64)                                                  not null
);

create index composante_ens_hc_idx
    on public.composante_ens (histo_createur_id);

create index composante_ens_hd_idx
    on public.composante_ens (histo_destructeur_id);

create index composante_ens_hm_idx
    on public.composante_ens (histo_modificateur_id);

create unique index composante_ens_source_code_un
    on public.composante_ens (source_code);

create index composante_ens_source_idx
    on public.composante_ens (source_id);

--Création de la vue src_structure avec les infos de tmp_composante_ens
create or replace view src_structure(id, source_code, code, source_id, type_structure_id, sigle, libelle) as
SELECT NULL::bigint                                                                               AS id,
       tmp.source_code,
       ltrim(substr(tmp.source_code::text, strpos(tmp.source_code::text, '::'::text)), ':'::text) AS code,
       src.id                                                                                     AS source_id,
       ts.id                                                                                      AS type_structure_id,
       tmp.sigle,
       tmp.libelle
FROM tmp_structure tmp
         JOIN type_structure ts ON ts.code::text = tmp.type_structure_id::text
         JOIN source src ON src.id = tmp.source_id
union
select NULL::bigint                                                                               AS id,
       tmp.source_code,
       ltrim(substr(tmp.source_code::text, strpos(tmp.source_code::text, '::'::text)), ':'::text) AS code,
       src.id                                                                                     AS source_id,
       ts.id                                                                                      AS type_structure_id,
       tmp.sigle,
       tmp.libelle_long                                                                           as libelle
FROM tmp_composante_ens tmp
         JOIN type_structure ts ON ts.code = 'composante-enseignement'
         JOIN source src ON src.id = tmp.source_id
;

--Création de la vue src_composante_ens avec les infos de tmp_composante_ens
create or replace view src_composante_ens(id, source_code, source_id) as
select NULL::bigint AS id,
       tmp.source_code,
       src.id       AS source_id,
       s.id         as structure_id
FROM tmp_composante_ens tmp
         JOIN structure s ON s.source_code = tmp.source_code
         JOIN source src ON src.id = tmp.source_id
;
---------------------------------------------
DROP TABLE IF EXISTS admission_financement;
DROP TABLE IF EXISTS admission_document;
DROP TABLE IF EXISTS admission_convention_formation_doctorale CASCADE;
@@ -96,8 +219,8 @@ create table IF NOT EXISTS admission_inscription
    admission_id                              bigint REFERENCES admission_admission (id),
    discipline_doctorat                       varchar(60),
    specialite_doctorat                       varchar(255),
    composante_doctorat_id                    bigint REFERENCES etablissement (id),
    ecole_doctorale_id                        bigint REFERENCES composante_ens (id),
    composante_doctorat_id                    bigint REFERENCES composante_ens (id),
    ecole_doctorale_id                        bigint REFERENCES ecole_doct (id),
    unite_recherche_id                        bigint REFERENCES unite_rech (id),
    etablissement_inscription_id              bigint REFERENCES etablissement (id),
    directeur_these_id                        bigint REFERENCES individu (id),
@@ -1605,117 +1728,3 @@ VALUES ('ADMISSION_DERNIERE_VALIDATION_AJOUTEE',
<p>Ceci est un mail envoyé automatiquement par l\'application ESUP-SyGAL.</p>
<p>Le <strong>dossier d\'admission</strong> de <strong>VAR[Individu#Denomination]</strong> a été <strong>validé</strong> par VAR[AdmissionAvis#Auteur], le VAR[AdmissionAvis#Date]</p>
<p>Le circuit de signature de votre dossier est maintenant terminé. </p>', null, 'Admission\Provider\Template');
 No newline at end of file

--Ajout de la table Composante d'enseignement
INSERT INTO source(id, code, libelle, etablissement_id, importable)
VALUES (6, 'UCN::octopus', 'Octopus UCN', 2, true);
INSERT INTO type_structure(id, code, libelle)
VALUES (4, 'composante-enseignement', 'Composante d''enseignement');

drop table if exists tmp_composante_ens;
--Création de la table TEMP de Composante d'enseignement
create table public.tmp_composante_ens
(
    id                    bigserial,
    sigle                 varchar(64),
    libelle_long          varchar(200),
    insert_date           timestamp(0) default ('now'::text)::timestamp without time zone,
    source_id             bigint                                                             not null,
    source_code           varchar(64)                                                        not null,
    source_insert_date    timestamp    default ('now'::text)::timestamp without time zone,
    histo_creation        timestamp(0) default ('now'::text)::timestamp(0) without time zone not null,
    histo_modification    timestamp(0),
    histo_destruction     timestamp(0),
    histo_createur_id     bigint                                                             not null,
    histo_modificateur_id bigint,
    histo_destructeur_id  bigint
);

create index tmp_composante_ens_source_code_index
    on public.tmp_composante_ens (source_code);

create index tmp_composante_ens_source_id_index
    on public.tmp_composante_ens (source_id);

create unique index tmp_composante_ens_unique_index
    on public.tmp_composante_ens (source_id, source_code);

drop table if exists composante_ens;
create table public.composante_ens
(
    id                    bigserial                                                    not null
        primary key,
    structure_id          bigint references structure (id),
    histo_creation        timestamp default ('now'::text)::timestamp without time zone not null,
    histo_createur_id     bigint                                                       not null
        constraint composante_ens_hcfk
            references public.utilisateur
            on delete cascade,
    histo_modification    timestamp,
    histo_modificateur_id bigint
        constraint composante_ens_hmfk
            references public.utilisateur
            on delete cascade,
    histo_destruction     timestamp,
    histo_destructeur_id  bigint
        constraint composante_ens_hdfk
            references public.utilisateur
            on delete cascade,
    source_id             bigint                                                       not null
        constraint composante_ens_source_fk
            references public.source
            on delete cascade,
    source_code           varchar(64)                                                  not null
);

create index composante_ens_hc_idx
    on public.composante_ens (histo_createur_id);

create index composante_ens_hd_idx
    on public.composante_ens (histo_destructeur_id);

create index composante_ens_hm_idx
    on public.composante_ens (histo_modificateur_id);

create unique index composante_ens_source_code_un
    on public.composante_ens (source_code);

create index composante_ens_source_idx
    on public.composante_ens (source_id);

drop view v_diff_structure;
drop view src_structure;
create or replace view src_structure(id, source_code, code, source_id, type_structure_id, sigle, libelle) as
SELECT NULL::bigint                                                                               AS id,
       tmp.source_code,
       ltrim(substr(tmp.source_code::text, strpos(tmp.source_code::text, '::'::text)), ':'::text) AS code,
       src.id                                                                                     AS source_id,
       ts.id                                                                                      AS type_structure_id,
       tmp.sigle,
       tmp.libelle
FROM tmp_structure tmp
         JOIN type_structure ts ON ts.code::text = tmp.type_structure_id::text
         JOIN source src ON src.id = tmp.source_id
union
select NULL::bigint                                                                               AS id,
       tmp.source_code,
       ltrim(substr(tmp.source_code::text, strpos(tmp.source_code::text, '::'::text)), ':'::text) AS code,
       src.id                                                                                     AS source_id,
       ts.id                                                                                      AS type_structure_id,
       tmp.sigle,
       tmp.libelle_long                                                                           as libelle
FROM tmp_composante_ens tmp
         JOIN type_structure ts ON ts.code = 'composante-enseignement'
         JOIN source src ON src.id = tmp.source_id
;

drop view src_composante_ens;
create or replace view src_composante_ens(id, source_code, source_id) as
select NULL::bigint AS id,
       tmp.source_code,
       src.id       AS source_id,
       s.id         as structure_id
FROM tmp_composante_ens tmp
         JOIN structure s ON s.source_code = tmp.source_code
         JOIN source src ON src.id = tmp.source_id
;
 No newline at end of file
+5 −4
Changes for module/Admission/src/Admission/Entity/Db/Inscription.php: 5 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Individu\Entity\Db\Individu;
use Soutenance\Entity\Qualite;
use Structure\Entity\Db\ComposanteEnseignement;
use Structure\Entity\Db\EcoleDoctorale;
use Structure\Entity\Db\Etablissement;
use Structure\Entity\Db\UniteRecherche;
@@ -69,7 +70,7 @@ class Inscription implements HistoriqueAwareInterface{
    private $ecoleDoctorale;

    /**
     * @var Etablissement
     * @var ComposanteEnseignement
     */
    private $composanteDoctorat;

@@ -420,11 +421,11 @@ class Inscription implements HistoriqueAwareInterface{
    /**
     * Set composanteDoctorat.
     *
     * @param Etablissement|null $composanteDoctorat
     * @param ComposanteEnseignement|null $composanteDoctorat
     *
     * @return Inscription
     */
    public function setComposanteDoctorat(Etablissement $composanteDoctorat = null)
    public function setComposanteDoctorat(ComposanteEnseignement $composanteDoctorat = null)
    {
        $this->composanteDoctorat = $composanteDoctorat;

@@ -434,7 +435,7 @@ class Inscription implements HistoriqueAwareInterface{
    /**
     * Get composanteDoctorat.
     *
     * @return Etablissement|null
     * @return ComposanteEnseignement|null
     */
    public function getComposanteDoctorat()
    {
+1 −1
Changes for module/Admission/src/Admission/Entity/Db/Mapping/Admission.Entity.Db.Inscription.dcm.xml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@
                <join-column name="SPECIALITE_DOCTORAT" referenced-column-name="code"/>
            </join-columns>
        </many-to-one>
        <many-to-one field="composanteDoctorat" target-entity="Structure\Entity\Db\Etablissement">
        <many-to-one field="composanteDoctorat" target-entity="Structure\Entity\Db\ComposanteEnseignement">
            <join-columns>
                <join-column name="COMPOSANTE_DOCTORAT_ID" referenced-column-name="ID"/>
            </join-columns>
+11 −15

File changed and moved.

Preview size limit exceeded, changes collapsed.

Loading