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:
@@ -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'],
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user