Retrait de l'ancienne case « formation déjà prévue dans la répartition annuelle »
La fiche agent portait deux cases à cocher pour la formation depuis l'ajout du droit à l'enveloppe : celle-ci faisait doublon et disparaît, avec sa colonne `agent.formation_repartition_annuelle` et tout ce qui la lisait — projection SQL, création et modification d'agent, formulaires d'administration, JS, et liste des colonnes obligatoires de SchemaModel. L'enveloppe de formation ne dépend donc plus que du droit : AgentModel::trainingEnvelopeMinutes() rend 14 h ou 0. La colonne est retirée du socle (le CREATE TABLE ne la crée plus sur une base neuve) et par migration_v7_9c sur les bases existantes. migration_v7_9b perd sa clause AFTER, qui pointait sur la colonne supprimée et aurait fait échouer l'installation d'une base neuve ; sa réécriture est sans risque, le script de migration rejoue un fichier modifié et l'ALTER reste idempotent. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -361,7 +361,6 @@ final class AgentController
|
||||
$contractEndDate = $contractEnd !== '' ? DateTimeImmutable::createFromFormat('!Y-m-d', $contractEnd) : null;
|
||||
$postId = filter_var($payload['id_poste'] ?? null, FILTER_VALIDATE_INT);
|
||||
$contractType = strtoupper(trim((string) ($payload['type_contrat'] ?? 'PERMANENT')));
|
||||
$trainingPlanned = filter_var($payload['formation_repartition_annuelle'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
// Le droit à l'enveloppe de formation est acquis par défaut : un
|
||||
// formulaire ancien ou une intégration tierce ne doit pas le retirer.
|
||||
$trainingRight = filter_var($payload['droit_enveloppe_formation'] ?? true, FILTER_VALIDATE_BOOLEAN);
|
||||
@@ -408,7 +407,6 @@ final class AgentController
|
||||
'date_fin_contrat' => $contractEnd !== '' ? $contractEnd : null,
|
||||
'id_poste' => (int) $postId,
|
||||
'type_contrat' => $contractType,
|
||||
'formation_repartition_annuelle' => $trainingPlanned,
|
||||
'droit_enveloppe_formation' => $trainingRight,
|
||||
'commentaire_pta' => $ptaComment !== '' ? $ptaComment : null,
|
||||
]);
|
||||
@@ -440,7 +438,6 @@ final class AgentController
|
||||
'id_poste' => (int) $postId,
|
||||
'poste_libelle' => (string) (array_values(array_filter($this->agentModel->allPosts(), static fn(array $post): bool => (int) $post['id_poste'] === (int) $postId))[0]['libelle'] ?? ''),
|
||||
'type_contrat' => $contractType,
|
||||
'formation_repartition_annuelle' => $trainingPlanned ? 1 : 0,
|
||||
'droit_enveloppe_formation' => $trainingRight ? 1 : 0,
|
||||
'commentaire_pta' => $ptaComment !== '' ? $ptaComment : null,
|
||||
]),
|
||||
@@ -466,7 +463,6 @@ final class AgentController
|
||||
$contractEndDate = $contractEnd !== '' ? DateTimeImmutable::createFromFormat('!Y-m-d', $contractEnd) : null;
|
||||
$postId = filter_var($payload['id_poste'] ?? null, FILTER_VALIDATE_INT);
|
||||
$contractType = strtoupper(trim((string) ($payload['type_contrat'] ?? 'PERMANENT')));
|
||||
$trainingPlanned = filter_var($payload['formation_repartition_annuelle'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
// Le droit à l'enveloppe de formation est acquis par défaut : un
|
||||
// formulaire ancien ou une intégration tierce ne doit pas le retirer.
|
||||
$trainingRight = filter_var($payload['droit_enveloppe_formation'] ?? true, FILTER_VALIDATE_BOOLEAN);
|
||||
@@ -510,7 +506,6 @@ final class AgentController
|
||||
'date_fin_contrat' => $contractEnd !== '' ? $contractEnd : null,
|
||||
'id_poste' => (int) $postId,
|
||||
'type_contrat' => $contractType,
|
||||
'formation_repartition_annuelle' => $trainingPlanned,
|
||||
'droit_enveloppe_formation' => $trainingRight,
|
||||
'commentaire_pta' => $ptaComment !== '' ? $ptaComment : null,
|
||||
'structure_id' => $structureId !== null ? (int) $structureId : null,
|
||||
|
||||
@@ -25,25 +25,19 @@ final class AgentModel extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Minutes de formation ouvertes à l'agent sur l'année : rien s'il n'y a pas
|
||||
* droit, rien non plus si sa formation est déjà comptée dans la répartition
|
||||
* annuelle, l'enveloppe complémentaire sinon.
|
||||
* Minutes de formation ouvertes à l'agent sur l'année : l'enveloppe de 14 h
|
||||
* s'il y a droit, rien sinon.
|
||||
*/
|
||||
public static function trainingEnvelopeMinutes(array $agent): int
|
||||
{
|
||||
if (!self::hasTrainingRight($agent) || !empty($agent['formation_repartition_annuelle'])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return self::ENVELOPPE_FORMATION_MINUTES;
|
||||
return self::hasTrainingRight($agent) ? self::ENVELOPPE_FORMATION_MINUTES : 0;
|
||||
}
|
||||
|
||||
private const AGENT_SELECT = <<<'SQL'
|
||||
SELECT a.id_agent, a.matricule, a.nom, a.prenom, a.email,
|
||||
a.telephone, a.adresse, a.est_diplome, a.diplome_libelle,
|
||||
a.date_debut_contrat, a.date_fin_contrat, a.type_contrat,
|
||||
a.formation_repartition_annuelle, a.droit_enveloppe_formation,
|
||||
a.commentaire_pta,
|
||||
a.droit_enveloppe_formation, a.commentaire_pta,
|
||||
a.id_poste, po.code AS poste_code, po.libelle AS poste_libelle,
|
||||
po.famille AS poste_famille, po.heures_mercredi_minutes,
|
||||
po.heures_extrascolaire_minutes, po.autorise_preparation,
|
||||
@@ -160,7 +154,6 @@ final class AgentModel extends BaseModel
|
||||
$quotaTarget = (int) round($quotaReference * ((float) $data['quotite_travail'] / 100));
|
||||
$trainingEnvelope = self::trainingEnvelopeMinutes([
|
||||
'droit_enveloppe_formation' => !empty($data['droit_enveloppe_formation']) ? 1 : 0,
|
||||
'formation_repartition_annuelle' => $data['formation_repartition_annuelle'],
|
||||
]);
|
||||
|
||||
try {
|
||||
@@ -171,14 +164,14 @@ final class AgentModel extends BaseModel
|
||||
matricule, nom, prenom, email, telephone, adresse,
|
||||
est_diplome, diplome_libelle, date_debut_contrat,
|
||||
id_poste, type_contrat, date_fin_contrat,
|
||||
formation_repartition_annuelle, droit_enveloppe_formation,
|
||||
commentaire_pta, id_structure, actif
|
||||
droit_enveloppe_formation, commentaire_pta,
|
||||
id_structure, actif
|
||||
) VALUES (
|
||||
:matricule, :nom, :prenom, :email, :telephone, :adresse,
|
||||
:est_diplome, :diplome_libelle, :date_debut_contrat,
|
||||
:id_poste, :type_contrat, :date_fin_contrat,
|
||||
:formation_repartition_annuelle, :droit_enveloppe_formation,
|
||||
:commentaire_pta, :structure_id, TRUE
|
||||
:droit_enveloppe_formation, :commentaire_pta,
|
||||
:structure_id, TRUE
|
||||
)'
|
||||
);
|
||||
$insertAgent->execute([
|
||||
@@ -194,7 +187,6 @@ final class AgentModel extends BaseModel
|
||||
'id_poste' => $data['id_poste'],
|
||||
'type_contrat' => $data['type_contrat'],
|
||||
'date_fin_contrat' => $contractEnd?->format('Y-m-d'),
|
||||
'formation_repartition_annuelle' => $data['formation_repartition_annuelle'] ? 1 : 0,
|
||||
'droit_enveloppe_formation' => !empty($data['droit_enveloppe_formation']) ? 1 : 0,
|
||||
'commentaire_pta' => $data['commentaire_pta'],
|
||||
'structure_id' => $data['structure_id'],
|
||||
@@ -293,7 +285,6 @@ final class AgentModel extends BaseModel
|
||||
id_poste = :id_poste,
|
||||
type_contrat = :type_contrat,
|
||||
date_fin_contrat = :date_fin_contrat,
|
||||
formation_repartition_annuelle = :formation_repartition_annuelle,
|
||||
droit_enveloppe_formation = :droit_enveloppe_formation,
|
||||
commentaire_pta = :commentaire_pta,
|
||||
id_structure = :structure_id
|
||||
@@ -309,7 +300,6 @@ final class AgentModel extends BaseModel
|
||||
$update->bindValue(':id_poste', $data['id_poste'], PDO::PARAM_INT);
|
||||
$update->bindValue(':type_contrat', $data['type_contrat']);
|
||||
$update->bindValue(':date_fin_contrat', $data['date_fin_contrat']);
|
||||
$update->bindValue(':formation_repartition_annuelle', $data['formation_repartition_annuelle'] ? 1 : 0, PDO::PARAM_INT);
|
||||
$update->bindValue(':droit_enveloppe_formation', !empty($data['droit_enveloppe_formation']) ? 1 : 0, PDO::PARAM_INT);
|
||||
$update->bindValue(':commentaire_pta', $data['commentaire_pta']);
|
||||
if ($newStructureId === null) {
|
||||
|
||||
@@ -52,7 +52,7 @@ final class SchemaModel extends BaseModel
|
||||
$requiredColumns = [
|
||||
'creneau_horaire' => ['id_motif'],
|
||||
'planning' => ['date_validation'],
|
||||
'agent' => ['email', 'telephone', 'adresse', 'est_diplome', 'diplome_libelle', 'id_structure', 'id_poste', 'type_contrat', 'date_debut_contrat', 'date_fin_contrat', 'formation_repartition_annuelle', 'droit_enveloppe_formation', 'commentaire_pta'],
|
||||
'agent' => ['email', 'telephone', 'adresse', 'est_diplome', 'diplome_libelle', 'id_structure', 'id_poste', 'type_contrat', 'date_debut_contrat', 'date_fin_contrat', 'droit_enveloppe_formation', 'commentaire_pta'],
|
||||
'structure' => ['type_affectation'],
|
||||
];
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@ window.PTA_PAGE_CONFIG = <?= json_encode([
|
||||
'params' => $pageConfig,
|
||||
], JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE) ?>;
|
||||
</script>
|
||||
<script src="assets/js/core.js?v=7.12"></script>
|
||||
<script src="assets/js/core.js?v=7.13"></script>
|
||||
<?php foreach ($scripts as $script): ?>
|
||||
<script src="assets/js/<?= htmlspecialchars($script) ?>?v=7.12"></script>
|
||||
<script src="assets/js/<?= htmlspecialchars($script) ?>?v=7.13"></script>
|
||||
<?php endforeach; ?>
|
||||
<script src="assets/js/page-bootstrap.js?v=7.12"></script>
|
||||
<script src="assets/js/page-bootstrap.js?v=7.13"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -67,7 +67,7 @@ $showGroupLabels = $visiblePageCount > 4;
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?= htmlspecialchars($pageTitle) ?> — PTA</title>
|
||||
<link rel="stylesheet" href="assets/style.css?v=7.12">
|
||||
<link rel="stylesheet" href="assets/style.css?v=7.13">
|
||||
</head>
|
||||
<body>
|
||||
<main class="app-shell">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Choisir votre accès — PTA</title>
|
||||
<link rel="stylesheet" href="assets/style.css?v=7.12">
|
||||
<link rel="stylesheet" href="assets/style.css?v=7.13">
|
||||
</head>
|
||||
<body class="role-page-body">
|
||||
<main class="role-page-shell">
|
||||
|
||||
@@ -126,10 +126,6 @@
|
||||
<input id="new-agent-training-right" type="checkbox" checked>
|
||||
<span>Droit à l’enveloppe de formation de 14 h. Décoché, le motif « Formation » ne pourra pas être affecté à cet agent lors de la saisie des horaires.</span>
|
||||
</label>
|
||||
<label class="check-field admin-field-wide">
|
||||
<input id="new-agent-training-planned" type="checkbox">
|
||||
<span>Une formation est déjà prévue dans la répartition annuelle : ne pas ajouter l’enveloppe complémentaire de 14 h</span>
|
||||
</label>
|
||||
<label class="field admin-field-wide">
|
||||
<span>Observations utiles à la construction du PTA</span>
|
||||
<textarea id="new-agent-pta-comment" maxlength="1000" rows="3" placeholder="Disponibilités particulières, organisation connue…"></textarea>
|
||||
@@ -246,7 +242,6 @@
|
||||
data-date-fin-contrat="<?= htmlspecialchars((string) ($agent['date_fin_contrat'] ?? ''), ENT_QUOTES) ?>"
|
||||
data-id-poste="<?= (int) ($agent['id_poste'] ?? 0) ?>"
|
||||
data-type-contrat="<?= htmlspecialchars((string) ($agent['type_contrat'] ?? 'PERMANENT'), ENT_QUOTES) ?>"
|
||||
data-formation-repartition-annuelle="<?= !empty($agent['formation_repartition_annuelle']) ? '1' : '0' ?>"
|
||||
data-droit-enveloppe-formation="<?= !isset($agent['droit_enveloppe_formation']) || !empty($agent['droit_enveloppe_formation']) ? '1' : '0' ?>"
|
||||
data-commentaire-pta="<?= htmlspecialchars((string) ($agent['commentaire_pta'] ?? ''), ENT_QUOTES) ?>"
|
||||
data-structure-id="<?= (int) ($agent['id_structure'] ?? 0) ?>"
|
||||
@@ -334,10 +329,6 @@
|
||||
<input id="edit-agent-profile-training-right" type="checkbox">
|
||||
<span>Droit à l’enveloppe de formation de 14 h</span>
|
||||
</label>
|
||||
<label class="check-field admin-field-wide">
|
||||
<input id="edit-agent-profile-training-planned" type="checkbox">
|
||||
<span>Formation déjà intégrée dans la répartition annuelle</span>
|
||||
</label>
|
||||
<label class="field admin-field-wide">
|
||||
<span>Observations PTA</span>
|
||||
<textarea id="edit-agent-profile-pta-comment" maxlength="1000" rows="3"></textarea>
|
||||
|
||||
Reference in New Issue
Block a user