From 2029849f18278abd9994ef7b82af10451de93c3e Mon Sep 17 00:00:00 2001 From: oversu <95a7002b-481b-4ef3-b578-f9c421550aa4@localhost> Date: Tue, 15 Sep 2026 18:27:40 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20r=C3=A9tablir=20la=20cr=C3=A9ation=20des?= =?UTF-8?q?=20port=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 ++++++++ HISTORIQUE.md | 4 ++++ README.md | 2 +- VERSION | 2 +- app/Controllers/AnimalRelationshipActions.php | 7 ------- app/Controllers/AnimalsController.php | 4 ++-- app/Controllers/CareRoundsController.php | 2 +- app/Controllers/DeathController.php | 2 +- app/Controllers/DewormingController.php | 2 +- app/Controllers/MedicalDocumentsController.php | 2 +- app/Controllers/PlacementsController.php | 2 +- app/Controllers/SurgeriesController.php | 2 +- app/Views/evolutions.php | 8 ++++---- tests/run.php | 9 +++++++++ 14 files changed, 35 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85b35b6..6c4bbcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ Toutes les modifications importantes du projet sont consignées ici. Le format s’inspire de [Keep a Changelog](https://keepachangelog.com/fr/1.1.0/) et le projet suit le [versionnage sémantique](https://semver.org/lang/fr/). +## [1.0.0-rc.23] — 2026-09-15 + +### Création des portées + +- retrait d’un bloc de téléversement résiduel qui interrompait systématiquement l’enregistrement d’une portée ; +- correction du message trompeur « Le téléversement a échoué » rencontré sans aucun fichier envoyé ; +- compatibilité des événements de portée, de soins, de décès, de chirurgie et de placement avec l’historique des bases existantes. + ## [1.0.0-rc.22] — 2026-09-15 ### Disponibilité après adoption diff --git a/HISTORIQUE.md b/HISTORIQUE.md index 16a2e1b..e08f0e6 100644 --- a/HISTORIQUE.md +++ b/HISTORIQUE.md @@ -97,3 +97,7 @@ Ajout d’une température préremplie à 38,5 °C lors du contrôle de chaque a ## `1.0.0-rc.22` — Disponibilité après adoption Une adoption finalisée rend désormais automatiquement l’animal indisponible à l’adoption afin que son état administratif et sa visibilité restent cohérents. + +## `1.0.0-rc.23` — Fiabilité des portées + +Suppression d’un ancien bloc de téléversement qui bloquait la création des fratries et harmonisation de leur écriture dans l’historique des animaux. diff --git a/README.md b/README.md index fd19de9..6840add 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ L’option `--apply` ne doit être utilisée qu’après lecture des rapports. L ## État du projet -La candidate actuelle est `1.0.0-rc.22`. La branche 1.0 est gelée fonctionnellement : seuls les défauts bloquants découverts pendant les validations terrain sont corrigés avant `1.0.0`. +La candidate actuelle est `1.0.0-rc.23`. La branche 1.0 est gelée fonctionnellement : seuls les défauts bloquants découverts pendant les validations terrain sont corrigés avant `1.0.0`. Le contrôle de stabilisation est disponible dans [docs/AUDIT-1.0.md](docs/AUDIT-1.0.md). diff --git a/VERSION b/VERSION index 49eb7f4..96b536f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0-rc.22 +1.0.0-rc.23 diff --git a/app/Controllers/AnimalRelationshipActions.php b/app/Controllers/AnimalRelationshipActions.php index e799555..f3eb7c9 100644 --- a/app/Controllers/AnimalRelationshipActions.php +++ b/app/Controllers/AnimalRelationshipActions.php @@ -139,13 +139,6 @@ trait AnimalRelationshipActions $baseName = trim((string) ($parents[$motherId]['name'] ?? ($parents[$fatherId]['name'] ?? 'Portée'))); $allowedSexes = ['F', 'M', 'U']; - try { - PrivateMediaService::moveVisibility($animalId, (string) $photo['filename'], $isPublic === 1); - } catch (Throwable $e) { - http_response_code(500); - echo h(t('error.upload_failed')); - return; - } $db->beginTransaction(); try { $stmt = $db->prepare( diff --git a/app/Controllers/AnimalsController.php b/app/Controllers/AnimalsController.php index 58e5757..209c6dd 100644 --- a/app/Controllers/AnimalsController.php +++ b/app/Controllers/AnimalsController.php @@ -116,8 +116,8 @@ final class AnimalsController $db = DB::pdo(); $db->prepare( ' - INSERT INTO animal_history (animal_id, type, label, details, user_id) - VALUES (:aid, :type, :label, :details, :user) + INSERT INTO animal_history (animal_id, action, type, label, details, user_id) + VALUES (:aid, :type, :type, :label, :details, :user) ', )->execute([ ':aid' => $animalId, diff --git a/app/Controllers/CareRoundsController.php b/app/Controllers/CareRoundsController.php index 5e899b1..1cbf058 100644 --- a/app/Controllers/CareRoundsController.php +++ b/app/Controllers/CareRoundsController.php @@ -295,7 +295,7 @@ final class CareRoundsController $roundDate = $roundInfo ? date('d/m/Y', strtotime((string) $roundInfo['round_date'])) : date('d/m/Y'); $roundPeriod = t('care.' . self::period($roundInfo['period'] ?? 'morning')); $history = $db->prepare( - "INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(:animal,'care_round',:label,:details,:user)", + "INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(:animal,'care_round','care_round',:label,:details,:user)", ); $history->execute([ ':animal' => $animalId, diff --git a/app/Controllers/DeathController.php b/app/Controllers/DeathController.php index 4518524..dd7a2e7 100644 --- a/app/Controllers/DeathController.php +++ b/app/Controllers/DeathController.php @@ -175,7 +175,7 @@ final class DeathController $details .= '\nEuthanasie : oui'; } $db->prepare( - "INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(:id,'death',:label,:details,:user)", + "INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(:id,'death','death',:label,:details,:user)", )->execute([ ':id' => $id, ':label' => $isUpdate ? 'Informations de décès modifiées' : 'Décès enregistré', diff --git a/app/Controllers/DewormingController.php b/app/Controllers/DewormingController.php index dfe0e1a..3ce8082 100644 --- a/app/Controllers/DewormingController.php +++ b/app/Controllers/DewormingController.php @@ -85,7 +85,7 @@ final class DewormingController 'INSERT INTO dewormings(animal_id,dewormer_id,administered_on,dose_text,weight_kg,next_due_date,notes,source_litter_id,created_by) VALUES(?,?,?,?,?,?,?,?,?)', ); $history = $db->prepare( - "INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(?,'deworming','Vermifuge administré',?,?)", + "INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(?,'deworming','deworming','Vermifuge administré',?,?)", ); foreach ($ids as $id) { $s = $db->prepare('SELECT name,birth_date FROM animals WHERE id=? AND deleted_at IS NULL'); diff --git a/app/Controllers/MedicalDocumentsController.php b/app/Controllers/MedicalDocumentsController.php index 698af5b..a331e87 100644 --- a/app/Controllers/MedicalDocumentsController.php +++ b/app/Controllers/MedicalDocumentsController.php @@ -314,7 +314,7 @@ final class MedicalDocumentsController private static function history(PDO $db, int $animalId, string $label, string $details): void { $db->prepare( - "INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(?,'medical',?,?,?)", + "INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(?,'medical','medical',?,?,?)", )->execute([$animalId, $label, $details, Auth::id()]); } private static function fr(string $date): string diff --git a/app/Controllers/PlacementsController.php b/app/Controllers/PlacementsController.php index 4366c64..4fa878a 100644 --- a/app/Controllers/PlacementsController.php +++ b/app/Controllers/PlacementsController.php @@ -126,7 +126,7 @@ final class PlacementsController $details[] = 'Notes : ' . $notes; } $db->prepare( - 'INSERT INTO animal_history(animal_id,type,label,details,user_id,created_at) VALUES(:animal,\'placement\',:label,:details,:user,:date)', + 'INSERT INTO animal_history(animal_id,action,type,label,details,user_id,created_at) VALUES(:animal,\'placement\',\'placement\',:label,:details,:user,:date)', )->execute([ ':animal' => $animalId, ':label' => self::TYPES[$type], diff --git a/app/Controllers/SurgeriesController.php b/app/Controllers/SurgeriesController.php index 01fab0d..a0739d8 100644 --- a/app/Controllers/SurgeriesController.php +++ b/app/Controllers/SurgeriesController.php @@ -104,7 +104,7 @@ final class SurgeriesController ]); } $db->prepare( - "INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(?,'medical','Chirurgie enregistrée',?,?)", + "INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(?,'medical','medical','Chirurgie enregistrée',?,?)", )->execute([$animal, $name . ' — ' . $date, Auth::id()]); $db->commit(); header('Location: /animal?id=' . $animal . '#tab-med'); diff --git a/app/Views/evolutions.php b/app/Views/evolutions.php index 5ed43da..983078b 100644 --- a/app/Views/evolutions.php +++ b/app/Views/evolutions.php @@ -31,10 +31,10 @@
- 1.0.0-rc.22 -

Disponibilité après adoption

-

Une adoption finalisée rend automatiquement l’animal indisponible afin de - conserver un état administratif cohérent.

+ 1.0.0-rc.23 +

Fiabilité des portées

+

La création d’une fratrie ne dépend plus d’un ancien traitement de photo et + son historique reste compatible avec les bases existantes.

diff --git a/tests/run.php b/tests/run.php index 56a6761..729c36c 100644 --- a/tests/run.php +++ b/tests/run.php @@ -78,6 +78,15 @@ try { ); $assert(in_array('temperature_c', $columns, true), 'Colonne temperature_c absente'); }); + $test('La création d’une portée ne dépend pas d’un téléversement', function () use ($assert): void { + $relationships = file_get_contents(__DIR__ . '/../app/Controllers/AnimalRelationshipActions.php'); + $animals = file_get_contents(__DIR__ . '/../app/Controllers/AnimalsController.php'); + $assert(!str_contains($relationships, 'PrivateMediaService::moveVisibility'), 'Bloc de photo résiduel dans les portées'); + $assert( + str_contains($animals, 'animal_id, action, type, label, details, user_id'), + 'L’historique des portées ne renseigne pas son action', + ); + }); $test("Les voies d’administration des médicaments sont initialisées", function () use ($db, $assert): void { $routes = $db ->query('SELECT accro FROM ref_med_administration ORDER BY id')