Commit 426be5c4 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'release_3.0.9'

parents 86f3b835 0bfbc080
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
Journal des modifications
=========================

3.0.9
-----
- Dépôt des rapports d'activité, CSI, mi-parcours : possibilité de sélectionner l'année univ précédente.

3.0.8
-----
- Changement pour récupération des logos sur la page de couvertures (les co-directions sont maintenant utilisée)
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
        "twig/twig":                     "^3.0",
        "unicaen/app":                   "^3.1",
        "unicaen/auth":                  "^3.2",
        "unicaen/auth-token":            "dev-master",
        "unicaen/auth-token":            "1.0.0",
        "unicaen/bjy-authorize":         "^3.0",
        "unicaen/code":                  "^3.0",
        "unicaen/db-import":             "^3.1",
+6 −8
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": "f0ead10f7c5c518783aad301f65ee894",
    "content-hash": "5b8b879682519d8c03acc4125e53b298",
    "packages": [
        {
            "name": "beberlei/assert",
@@ -3816,11 +3816,11 @@
        },
        {
            "name": "unicaen/auth-token",
            "version": "dev-master",
            "version": "1.0.0",
            "source": {
                "type": "git",
                "url": "https://git.unicaen.fr/lib/unicaen/auth-token.git",
                "reference": "e8b733e301532699881dc816999b7a5f935f0648"
                "reference": "f30302097a28a4b7b0d1137c0a5c24e66b59a72d"
            },
            "require": {
                "ramsey/uuid": "^3.7",
@@ -3840,7 +3840,7 @@
                ]
            },
            "description": "Authentification à l'aide d'un token",
            "time": "2021-07-06T10:19:08+00:00"
            "time": "2021-10-08T08:27:50+00:00"
        },
        {
            "name": "unicaen/bjy-authorize",
@@ -8944,9 +8944,7 @@
    ],
    "aliases": [],
    "minimum-stability": "stable",
    "stability-flags": {
        "unicaen/auth-token": 20
    },
    "stability-flags": [],
    "prefer-stable": false,
    "prefer-lowest": false,
    "platform": {
@@ -8964,5 +8962,5 @@
        "ext-zip": "*"
    },
    "platform-dev": [],
    "plugin-api-version": "2.1.0"
    "plugin-api-version": "1.1.0"
}
+18 −0
Original line number Diff line number Diff line
# Version 3.0.9

## 1. Sur le serveur d'application

- Placez-vous dans le répertoire de l'application puis lancez la commande suivante
  pour installer la nouvelle version :

```bash
git fetch --tags && git checkout --force 3.0.9 && bash ./install.sh
```

- Selon le moteur PHP que vous avez installé, rechargez le service, exemple :
    - php7.3-fpm         : `service php7.3-fpm reload`
    - apache2-mod-php7.3 : `service apache2 reload`

## 2. Dans la base de données

Néant.
+86 −11
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Application\Controller\Rapport;

use Application\Entity\AnneeUniv;
use Application\Entity\Db\Rapport;
use Application\Provider\Privilege\RapportPrivileges;

@@ -33,10 +34,20 @@ class RapportActiviteController extends RapportController
     */
    protected $rapportsTeleversesFintheses = [];

    /**
     * @var array [int => bool]
     */
    protected $canTeleverserRapportAnnuel;

    /**
     * @var array [int => bool]
     */
    protected $canTeleverserRapportFinthese;

    protected function loadRapportsTeleverses()

    protected function fetchRapportsTeleverses()
    {
        parent::loadRapportsTeleverses();
        parent::fetchRapportsTeleverses();

        $this->rapportsTeleversesAnnuels = array_filter($this->rapportsTeleverses, function(Rapport $rapport) {
            return $rapport->estFinal() === false;
@@ -44,31 +55,95 @@ class RapportActiviteController extends RapportController
        $this->rapportsTeleversesFintheses = array_filter($this->rapportsTeleverses, function(Rapport $rapport) {
            return $rapport->estFinal() === true;
        });

        $this->canTeleverserRapportAnnuel = [];
        foreach ($this->anneesUnivs as $anneeUniv) {
            $this->canTeleverserRapportAnnuel[$anneeUniv->getPremiereAnnee()] =
                $this->canTeleverserRapportAnnuelForAnneeUniv($anneeUniv);
        }
        $this->canTeleverserRapportFinthese = [];
        foreach ($this->anneesUnivs as $anneeUniv) {
            $this->canTeleverserRapportFinthese[$anneeUniv->getPremiereAnnee()] =
                $this->canTeleverserRapportFintheseForAnneeUniv($anneeUniv);
        }
    }

    protected function isTeleversementPossible(): bool
    {
        return
            count(array_filter($this->canTeleverserRapportAnnuel)) > 0 ||
            count(array_filter($this->canTeleverserRapportFinthese)) > 0;
    }

    protected function getAnneesPrises(): array
    {
        return array_keys(
            array_intersect_key(
                array_filter($this->canTeleverserRapportAnnuel, function(bool $can) { return $can === false; }),
                array_filter($this->canTeleverserRapportFinthese, function(bool $can) { return $can === false; })
            )
        );
    }

    protected function canTeleverserRapport(Rapport $rapport): bool
    {
        if ($rapport->estFinal()) {
            return $this->canTeleverserRapportFintheseForAnneeUniv($rapport->getAnneeUniv());
        } else {
            return $this->canTeleverserRapportAnnuelForAnneeUniv($rapport->getAnneeUniv());
        }
    }

    protected function canTeleverserRapportAnnuel(): bool
    {
        // Peut être téléversé : 1 rapport annuel par année universitaire.

        $rapportsSurAnneeCourante = array_filter($this->rapportsTeleversesAnnuels, function(Rapport $rapport) {
            return $rapport->getAnneeUniv() === $this->anneeUnivCourante->getPremiereAnnee();
        });
        foreach ($this->anneesUnivs as $anneeUniv) {
            $rapportsTeleverses = array_filter(
                $this->rapportsTeleversesAnnuels,
                $this->rapportService->getFilterRapportsByAnneeUniv($anneeUniv)
            );
            if (empty($rapportsTeleverses)) {
                return true;
            }
        }

        return count($rapportsSurAnneeCourante) === 0;
        return false;
    }

    protected function canTeleverserRapportAnnuelForAnneeUniv(AnneeUniv $anneeUniv): bool
    {
        // Peut être téléversé : 1 rapport annuel.

        $rapportsTeleverses = array_filter(
            $this->rapportsTeleversesAnnuels,
            $this->rapportService->getFilterRapportsByAnneeUniv($anneeUniv)
        );

        return empty($rapportsTeleverses);
    }

    protected function canTeleverserRapportFinthese(): bool
    {
        // Peut être téléversé : 1 rapport de fin de thèse, toutes années univ confondues.
        // Dépôt d'1 rapport de fin de thèse maxi toutes années univ confondues.

        return count($this->rapportsTeleversesFintheses) === 0;
    }

    protected function isTeleversementPossible(): bool
    protected function canTeleverserRapportFintheseForAnneeUniv(AnneeUniv $anneeUniv): bool
    {
        return
            $this->canTeleverserRapportAnnuel() ||
            $this->canTeleverserRapportFinthese();
        // Dépôt d'un rapport de fin de thèse seulement sur la dernière année univ.

        if ($anneeUniv !== $this->getAnneeUnivMax()) {
            return false;
        }

        $rapportsTeleverses = array_filter(
            $this->rapportsTeleversesFintheses,
            $this->rapportService->getFilterRapportsByAnneeUniv($anneeUniv)
        );

        return empty($rapportsTeleverses);
    }

    protected function initForm()
Loading