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>
|
||||
|
||||
@@ -211,7 +211,6 @@
|
||||
row.dataset.dateFinContrat = agent.date_fin_contrat || '';
|
||||
row.dataset.idPoste = agent.id_poste ? String(Number(agent.id_poste)) : '';
|
||||
row.dataset.typeContrat = agent.type_contrat || 'PERMANENT';
|
||||
row.dataset.formationRepartitionAnnuelle = Number(agent.formation_repartition_annuelle) ? '1' : '0';
|
||||
row.dataset.droitEnveloppeFormation = Number(agent.droit_enveloppe_formation ?? 1) ? '1' : '0';
|
||||
row.dataset.commentairePta = agent.commentaire_pta || '';
|
||||
row.dataset.structureId = agent.id_structure ? String(Number(agent.id_structure)) : '';
|
||||
@@ -256,7 +255,6 @@
|
||||
document.querySelector('#edit-agent-profile-contract-end').value = row.dataset.dateFinContrat || '';
|
||||
document.querySelector('#edit-agent-profile-post').value = row.dataset.idPoste || '';
|
||||
document.querySelector('#edit-agent-profile-contract-type').value = row.dataset.typeContrat || 'PERMANENT';
|
||||
document.querySelector('#edit-agent-profile-training-planned').checked = row.dataset.formationRepartitionAnnuelle === '1';
|
||||
document.querySelector('#edit-agent-profile-training-right').checked = row.dataset.droitEnveloppeFormation !== '0';
|
||||
document.querySelector('#edit-agent-profile-pta-comment').value = row.dataset.commentairePta || '';
|
||||
document.querySelector('#edit-agent-profile-structure').value = row.dataset.structureId || '';
|
||||
@@ -304,7 +302,6 @@
|
||||
date_fin_contrat: document.querySelector('#edit-agent-profile-contract-end').value,
|
||||
id_poste: Number(document.querySelector('#edit-agent-profile-post').value),
|
||||
type_contrat: document.querySelector('#edit-agent-profile-contract-type').value,
|
||||
formation_repartition_annuelle: document.querySelector('#edit-agent-profile-training-planned').checked,
|
||||
droit_enveloppe_formation: document.querySelector('#edit-agent-profile-training-right').checked,
|
||||
commentaire_pta: document.querySelector('#edit-agent-profile-pta-comment').value,
|
||||
structure_id: structureValue ? Number(structureValue) : null,
|
||||
@@ -410,7 +407,6 @@
|
||||
date_fin_contrat: document.querySelector('#new-agent-contract-end').value,
|
||||
id_poste: Number(document.querySelector('#new-agent-post').value),
|
||||
type_contrat: document.querySelector('#new-agent-contract-type').value,
|
||||
formation_repartition_annuelle: document.querySelector('#new-agent-training-planned').checked,
|
||||
droit_enveloppe_formation: document.querySelector('#new-agent-training-right').checked,
|
||||
commentaire_pta: document.querySelector('#new-agent-pta-comment').value,
|
||||
}),
|
||||
@@ -423,7 +419,6 @@
|
||||
form.reset();
|
||||
document.querySelector('#new-agent-rate').value = '100';
|
||||
document.querySelector('#new-agent-contract-type').value = 'PERMANENT';
|
||||
document.querySelector('#new-agent-training-planned').checked = false;
|
||||
document.querySelector('#new-agent-qualified').value = '0';
|
||||
toggleDiplomaField(document.querySelector('#new-agent-qualified'), document.querySelector('#new-agent-diploma'));
|
||||
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
-- « Formation » lors de la saisie des horaires, et son enveloppe de formation
|
||||
-- au PTA annuel vaut 0.
|
||||
--
|
||||
-- À ne pas confondre avec `formation_repartition_annuelle`, déjà présente :
|
||||
-- celle-ci signale que la formation est DÉJÀ comptée dans la répartition
|
||||
-- annuelle de l'agent — l'agent y a droit, l'enveloppe complémentaire n'est
|
||||
-- simplement pas ajoutée par-dessus.
|
||||
-- La colonne ne porte volontairement pas de clause AFTER : `migration_v7_9c`
|
||||
-- retire `formation_repartition_annuelle`, qui aurait servi de repère, et le
|
||||
-- socle ne la crée plus du tout sur une base neuve.
|
||||
--
|
||||
-- Nommage : les migrations sont jouées dans l'ordre alphabétique. Le suffixe
|
||||
-- « 9b » place ce fichier après migration_v7_9_tableau_de_bord.sql, ce qu'un
|
||||
@@ -21,5 +20,4 @@
|
||||
|
||||
ALTER TABLE agent
|
||||
ADD COLUMN IF NOT EXISTS droit_enveloppe_formation BOOLEAN NOT NULL DEFAULT TRUE
|
||||
COMMENT 'Droit à l''enveloppe annuelle complémentaire de 14 h de formation'
|
||||
AFTER formation_repartition_annuelle;
|
||||
COMMENT 'Droit à l''enveloppe annuelle de 14 h de formation';
|
||||
|
||||
17
database/migration_v7_9c_retrait_formation_repartition.sql
Normal file
17
database/migration_v7_9c_retrait_formation_repartition.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- ============================================================================
|
||||
-- PTA — Retrait de `agent.formation_repartition_annuelle`
|
||||
-- ============================================================================
|
||||
-- Cette colonne portait une seconde case à cocher sur la fiche agent : « une
|
||||
-- formation est déjà prévue dans la répartition annuelle, ne pas ajouter
|
||||
-- l'enveloppe complémentaire de 14 h ». Elle faisait doublon avec le droit à
|
||||
-- l'enveloppe de formation (`droit_enveloppe_formation`, migration v7_9b), seul
|
||||
-- conservé : l'enveloppe vaut 14 h si l'agent y a droit, 0 sinon.
|
||||
--
|
||||
-- Le calcul de `pta_annuel.enveloppe_formation_minutes` ne dépend donc plus que
|
||||
-- de `droit_enveloppe_formation` (AgentModel::trainingEnvelopeMinutes()).
|
||||
--
|
||||
-- Idempotente : rejouable sans effet de bord.
|
||||
-- ============================================================================
|
||||
|
||||
ALTER TABLE agent
|
||||
DROP COLUMN IF EXISTS formation_repartition_annuelle;
|
||||
@@ -105,7 +105,6 @@ CREATE TABLE agent (
|
||||
id_poste INT UNSIGNED NULL,
|
||||
type_contrat ENUM('PERMANENT', 'TEMPORAIRE') NOT NULL DEFAULT 'PERMANENT',
|
||||
date_fin_contrat DATE NULL,
|
||||
formation_repartition_annuelle BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
commentaire_pta VARCHAR(1000) NULL,
|
||||
id_structure INT UNSIGNED NULL COMMENT 'Lieu principal de rattachement',
|
||||
actif BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
|
||||
Reference in New Issue
Block a user