Commit 80747d39 authored by Bertrand Gauthier's avatar Bertrand Gauthier Committed by Thomas Hamel
Browse files

Version fonctionnelle Portfolio : Affichage informations thèse, publications, formations

parent ef5647ac
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -15,7 +15,8 @@
        "phpcompatibility/php-compatibility": "*",

        "unicaen/code": "^6.0",
        "unicaen/test": "^6.1"
        "unicaen/test": "^6.1",
        "unicaen/db-import": "dev-feature_select_generator"
    },
    "require": {
        "php": "^8.2",
@@ -59,6 +60,7 @@
        "unicaen/console": "^6.0",
        "unicaen/db-anonym": "^4.0",
        "unicaen/db-import": "^7.2",
        "unicaen/db-import": "dev-feature_select_generator",
        "unicaen/etat": "^6.0",
        "unicaen/faq": "^7.0",
        "unicaen/idref": "^2.0",
+8 −7
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
        "This file is @generated automatically"
    ],
    "content-hash": "30888d6e3783a3db724e1b2f869c4cbd",
    "content-hash": "1ca0678d489e14bbb2672c4796775da5",
    "packages": [
        {
            "name": "apereo/phpcas",
@@ -12130,11 +12130,11 @@
        },
        {
            "name": "unicaen/db-import",
            "version": "7.2.1",
            "version": "dev-feature_select_generator",
            "source": {
                "type": "git",
                "url": "https://git.unicaen.fr/lib/unicaen/db-import.git",
                "reference": "49c966fc3cd0dd465e260eee65077e4c8b25de60"
                "reference": "88d6dfef6e3acebb5707c4f711e36c7eb01f1240"
            },
            "require": {
                "beberlei/assert": "^3.3",
@@ -12151,9 +12151,9 @@
            "require-dev": {
                "phpunit/phpunit": "^8.0"
            },
            "type": "module",
            "type": "library",
            "autoload": {
                "psr-0": {
                "psr-4": {
                    "UnicaenDbImport\\": "src/"
                },
                "classmap": [
@@ -12162,11 +12162,11 @@
            },
            "autoload-dev": {
                "psr-4": {
                    "UnicaenDbImportUnitTest\\": "test/UnicaenDbImportUnitTest"
                    "UnicaenDbImportUnitTest\\": "test/"
                }
            },
            "description": "Module d'import entre bases de données",
            "time": "2025-07-15T07:14:19+00:00"
            "time": "2026-02-19T09:12:35+00:00"
        },
        {
            "name": "unicaen/etat",
@@ -15504,6 +15504,7 @@
    "aliases": [],
    "minimum-stability": "dev",
    "stability-flags": {
        "unicaen/db-import": 20,
        "unicaen/pdf": 20,
        "unicaen/renderer": 20,
        "unicaen/sygal-api": 20,
+75 −1
Original line number Diff line number Diff line
@@ -6,7 +6,12 @@ use Application\Entity\Db\Source;
use Application\Navigation\NavigationFactoryFactory;
use Import\Model\ImportObserv;
use Import\Model\ImportObservResult;
use Portfolio\Import\Extractor\HalResponseDataExtractor;
use Portfolio\Service\PublicationSelectProvider;
use Retraitement\Filter\Command\RetraitementShellCommandMines;
use UnicaenDbImport\Filter\ColumnValue\ArrayToStringColumnValueFilter;
use UnicaenDbImport\Filter\ColumnValue\ConcatColumnValueFilter;
use UnicaenDbImport\Filter\ColumnValue\SameColumnValueFilter;

$config = [
    'api-tools-content-negotiation' => [
@@ -149,7 +154,7 @@ $config = [
                'source' => [
                    'name' => 'HAL',
                    'connection' => 'api-archives-ouvertes',
                    'select' => '/domain/?q=*:*&wt=json&fl=*&rows=500',
                    'select' => '/ref/domain/?q=*:*&wt=json&fl=*&rows=500',
                    'code' => 'HAL',
                    'columns' => [
                        'docid',
@@ -182,6 +187,55 @@ $config = [
                    'id_strategy' => null,
                    'id_sequence' => null,
                ],
            ],
            [
                'name' => 'publications-hal',
                'order' => 170,
                'source' => [
                    'name' => 'PUBLICATIONS_HAL',
                    'connection' => 'api-archives-ouvertes',
                    'select' => PublicationSelectProvider::class,
                    'code' => 'PUBLICATIONS_HAL',
                    'data_extractor' => HalResponseDataExtractor::class,
                    'columns' => [
                        'title_s',
                        'authFullName_s',
                        'authIdHal_i',
                        'publicationDate_s',
                        'docType_s',
                        'publisher_s',
                        'halId_s',
                        'uri_s',
                        'individu_hal_id', // ajouté dynamiquement, cf. PublicationSelectProvider
                    ],
                    'column_name_filter' => [
                        'title_s' => 'title_s',
                        'authFullName_s' => 'auth_full_name_s',
                        'authIdHal_i' => 'auth_id_hal_i',
                        'publicationDate_s' => 'publication_date_s',
                        'docType_s' => 'doc_type_s',
                        'publisher_s' => 'publisher_s',
                        'halId_s' => 'source_code',
                    ],
                    'column_value_filter' => [
                        ['name' => ArrayToStringColumnValueFilter::class, 'params' => ['column' => 'authFullName_s']],
                        ['name' => ArrayToStringColumnValueFilter::class, 'params' => ['column' => 'authIdHal_i']],
                        ['name' => ArrayToStringColumnValueFilter::class, 'params' => ['column' => 'title_s']],
                        ['name' => ArrayToStringColumnValueFilter::class, 'params' => ['column' => 'publisher_s']],
                    ],
                    'source_code_column' => 'source_code',
                    'request_options' => [
                        'debug' => true,
                    ],
                ],
                'destination' => [
                    'name' => 'application',
                    'table' => 'tmp_publication_hal',
                    'connection' => 'default',
                    'source_code_column' => 'source_code',
                    'id_strategy' => null,
                    'id_sequence' => null,
                ],
            ]
        ],

@@ -211,6 +265,26 @@ $config = [
                    'where' => NULL,
                ],
            ],
            [
                'name' => 'publications-hal',
                'order' => 170,
                'source' => [
                    'name' => 'sygal',
                    'code' => 'app',
                    'table' => 'src_publication_hal',
                    'connection' => 'default',
                    'source_code_column' => 'source_code',
                ],
                'destination' => [
                    'name' => 'application',
                    'table' => 'publication_hal',
                    'connection' => 'default',
                    'source_code_column' => 'source_code',
                    'id_strategy' => 'SEQUENCE',
                    'id_sequence' => null,
                    'where' => NULL,
                ],
            ],
        ],
    ],
    // Options pour le service de notification par mail
+83 −7
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ WHERE NOT EXISTS (SELECT 1
                  WHERE p.CODE = d.code);

-- ajout des privilèges au profil BDD (Maison du Doctorat), ADMIN_TECH, GEST_ED
select privilege__grant_privileges_to_profiles('formation_formation',
call privilege__grant_privileges_to_profiles('formation_formation',
                                               ARRAY[
                                                   'configurer-module'
                                               ],
@@ -113,7 +113,7 @@ VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'rncp'), 'resta
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'rncp'), 'supprimer-competence', 'Supprimer une compétence et/ou un bloc de compétences', 4);

select privilege__grant_privileges_to_profiles('rncp',
call privilege__grant_privileges_to_profiles('rncp',
                                               ARRAY[
                                                   'modifier-competence',
                                                   'historiser-competence',
@@ -304,7 +304,7 @@ VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'portfolio'), '
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'portfolio'), 'exporter', 'Exporter le portfolio au format PDF', 2);

select privilege__grant_privileges_to_profiles('portfolio',
call privilege__grant_privileges_to_profiles('portfolio',
                                               ARRAY['afficher', 'exporter'],
                                               ARRAY['ADMIN_TECH', 'DOCTORANT']
);
@@ -349,9 +349,83 @@ VALUES (

<div style="page-break-before: always;"></div>

<div class="informations_publications">
<h1>Publications</h1>
{% set publicationsGroupes = doctorant.getPublicationsHAL %}
{% set hasPublications = false %}

{% for key, publications in publicationsGroupes %}

    <h3 class="mt-4">{{ key }}</h3>

    <table class="table table-sm publications mb-4">
        <thead>
        <tr>
            <th>Titre</th>
            <th>Date</th>
            <th>Auteur(s)</th>
            <th>Éditeur</th>
            <th>Compétences RNCP</th>
        </tr>
        </thead>

        <tbody>
        {% if publications is not empty %}
            {% set hasPublications = true %}

            {% for item in publications %}
                {% set publication = item.publicationHAL %}
                <tr>
                    <td>{{ publication.getTitleFormatted }}</td>

                    <td>{{ publication.publicationDate }}</td>

                    <td>
                        {{ publication.getAuthFullNameFormatted
                            ?: ''<i>Auteur(s) inconnu(s)</i>''|raw }}
                    </td>

                    <td>
                        {{ publication.getPublisherFormatted
                            ?: ''<i>Éditeur(s) inconnu(s)</i>''|raw }}
                    </td>

                    <td>
                        {% if item.sousCompetences is not empty %}
                            <ul class="mb-0 ps-3">
                                {% for sc in item.sousCompetences %}
                                    <li>{{ sc.libelle }}</li>
                                {% endfor %}
                            </ul>
                        {% else %}
                            <span class="text-muted">Aucune</span>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
        {% else %}
            <tr>
                <td colspan="6" class="text-muted text-center">
                    Aucune publication pour {{ key }}
                </td>
            </tr>
        {% endif %}
        </tbody>
    </table>

{% endfor %}

{% if not hasPublications %}
    <div class="text-muted text-center mt-3">
        Aucune publication trouvée
    </div>
{% endif %}

<div style="page-break-before: always;"></div>

<div class="informations_formations">
 <h1>Formations</h1>
 <h2>Formations suivies dans ESUP-SyGAL</h2>
 <h3>Formations suivies dans ESUP-SyGAL</h3>
<table class="table table-sm inscriptions-terminees mt-2">
    <thead>
    <tr>
@@ -430,7 +504,7 @@ VALUES (

<div style="page-break-before: always;"></div>

 <h2>Formations suivies à l''extérieur</h2>
 <h3>Formations suivies à l''extérieur</h3>
<table class="table table-sm formations-externes mt-2">
    <thead>
        <tr>
@@ -506,14 +580,16 @@ VALUES (
    </tbody>
</table>
</div>',
           '.formations-externes, .inscriptions-terminees {
           '.formations-externes, .inscriptions-terminees, .publications{
 border-collapse: collapse;  width: 100%; 
 }

.formations-externes th,
.formations-externes td,
.inscriptions-terminees th,
.inscriptions-terminees td {
.inscriptions-terminees td,
.publications th,
.publications td {
  border: 1px solid #000;
  padding: 8px;
}',
+152 −0
Original line number Diff line number Diff line
-- INSERT INTO source(id, code, libelle, etablissement_id, importable)
-- VALUES (nextval('source_id_seq'), 'PUBLICATIONS_HAL', 'PUBLICATIONS_HAL', null, true) ;

--Suppression des possibles données existantes concernant l'import des publications
drop view if exists v_diff_publication_hal;
drop view if exists src_publication_hal;
drop table if exists tmp_publication_hal;
drop table if exists publication_hal;

--Création de la table TEMP de publication
create table if not exists public.tmp_publication_hal
(
    id                    bigserial,
    title_s               varchar(2048),
    auth_full_name_s        text,
    auth_id_hal_i        varchar(2048),
    individu_hal_id      varchar(264),
    publication_date_s     varchar(264),
    publisher_s           varchar(264),
    doc_type_s             varchar(264),
    uri_s             text,
    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_publication_hal_source_code_index
    on public.tmp_publication_hal (source_code);

create index tmp_publication_hal_source_id_index
    on public.tmp_publication_hal (source_id);

-- create unique index tmp_publication_hal_unique_index
--     on public.tmp_publication_hal (source_id, source_code);

--Création de la table publication_hal
create table if not exists public.publication_hal
(
    id                    bigserial                                                    not null
    primary key,
    individu_id bigint,
    title_s               varchar(2048),
    auth_full_name_s        text,
    auth_id_hal_i        varchar(2048),
    publication_date_s     varchar(264),
    publisher_s           varchar(264),
    doc_type_s           varchar(264),
    uri_s             text,
    histo_creation        timestamp default ('now'::text)::timestamp without time zone not null,
    histo_createur_id     bigint                                                       not null
    constraint publication_hal_hcfk
    references public.utilisateur
                                                                     on delete cascade,
    histo_modification    timestamp,
    histo_modificateur_id bigint
    constraint publication_hal_hmfk
    references public.utilisateur
                                                                     on delete cascade,
    histo_destruction     timestamp,
    histo_destructeur_id  bigint
    constraint publication_hal_hdfk
    references public.utilisateur
                                                                     on delete cascade,
    source_id             bigint                                                       not null
    constraint publication_hal_source_fk
    references public.source
                                                                     on delete cascade,
    source_code           varchar(64)                                                  not null
    );

create index publication_hal_hc_idx
    on public.publication_hal (histo_createur_id);

create index publication_hal_hd_idx
    on public.publication_hal (histo_destructeur_id);

create index publication_hal_hm_idx
    on public.publication_hal (histo_modificateur_id);

create unique index publication_hal_source_code_un
    on public.publication_hal (source_code);

create index publication_hal_source_idx
    on public.publication_hal (source_id);


--Création de la vue src_publication_hal avec les infos de tmp_publication_hal
create or replace view src_publication_hal
            (id, source_code, source_id, individu_id, title_s, auth_full_name_s, auth_id_hal_i, publication_date_s, doc_type_s, publisher_s, uri_s) as
select NULL::bigint                                                 AS id,
       tmp.individu_hal_id||'_'||tmp.source_code                    as source_code,
       src.id                                                       AS source_id,
       i.id as individu_id,
       tmp.title_s,
       tmp.auth_full_name_s,
       tmp.auth_id_hal_i,
       tmp.publication_date_s,
       tmp.doc_type_s,
       tmp.publisher_s,
       tmp.uri_s
FROM tmp_publication_hal tmp
         JOIN source src ON src.id = tmp.source_id
    join individu i on trim(i.id_hal) = trim(tmp.individu_hal_id)
;

-- Transfert des ID_HAL de diffusion vers individu
WITH pick AS (
    SELECT DISTINCT ON (doc.individu_id)
    doc.individu_id,
    d.hal_id
FROM diffusion d
    JOIN these t       ON t.id = d.these_id
    JOIN doctorant doc ON doc.id = t.doctorant_id
WHERE d.hal_id IS NOT NULL AND d.hal_id not like ''
ORDER BY doc.individu_id, d.histo_modification DESC
    )
UPDATE individu i
SET id_hal = btrim(pick.hal_id)
    FROM pick
WHERE i.id = pick.individu_id;

SELECT t.id, ind.id_hal
FROM these t
         LEFT JOIN doctorant doc ON doc.id = t.doctorant_id
         LEFT JOIN individu ind ON ind.id = doc.individu_id
WHERE ind.id_hal IS NOT NULL AND ind.id_hal not like '';

-- Privilèges
INSERT INTO unicaen_privilege_categorie (ID, CODE, LIBELLE, ORDRE)
SELECT nextval('categorie_privilege_id_seq'),
       'publicationhal',
       'Publication HAL',
       5009 WHERE NOT EXISTS (SELECT 1
                               FROM unicaen_privilege_categorie
                               WHERE CODE = 'publicationhal');

INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'publicationhal'), 'modifier', 'Modifier une publication HAL', 1);

select privilege__grant_privileges_to_profiles('publicationhal',
                                               ARRAY[
                                                   'modifier'
                                               ],
                                               ARRAY['ADMIN_TECH', 'BDD', 'GEST_ED']
);
 No newline at end of file
Loading