From b8abaa844070e36e549a37372c7ccb4525e20e84 Mon Sep 17 00:00:00 2001 From: oversu <95a7002b-481b-4ef3-b578-f9c421550aa4@localhost> Date: Tue, 15 Sep 2026 15:58:30 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20rendre=20un=20animal=20adopt=C3=A9=20ind?= =?UTF-8?q?isponible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 +++++++++ HISTORIQUE.md | 4 ++++ README.md | 2 +- VERSION | 2 +- app/Services/AdoptionService.php | 5 +++++ app/Views/evolutions.php | 8 ++++---- tests/run.php | 21 ++++++++++++++++++--- 7 files changed, 42 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a4a30a..85b35b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ 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.22] — 2026-09-15 + +### Disponibilité après adoption + +- passage automatique de la disponibilité à « Indisponible » lorsqu’une adoption est finalisée ; +- suppression de l’ancienne date de disponibilité et ajout du motif « Animal adopté » ; +- correction de l’écriture de l’événement correspondant dans l’historique des bases existantes ; +- ajout d’un test couvrant l’ensemble du parcours d’adoption et cette règle métier. + ## [1.0.0-rc.21] — 2026-09-15 ### Suivi de la température diff --git a/HISTORIQUE.md b/HISTORIQUE.md index e2934d6..16a2e1b 100644 --- a/HISTORIQUE.md +++ b/HISTORIQUE.md @@ -93,3 +93,7 @@ Simplification des lieux affichés dans la fiche, conservation de l’adresse ac ## `1.0.0-rc.21` — Température pendant les tournées Ajout d’une température préremplie à 38,5 °C lors du contrôle de chaque animal et affichage conjoint des courbes de poids et de température dans son dossier médical. + +## `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. diff --git a/README.md b/README.md index 45914f2..fd19de9 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.21`. 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.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`. 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 fee2ed6..49eb7f4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0-rc.21 +1.0.0-rc.22 diff --git a/app/Services/AdoptionService.php b/app/Services/AdoptionService.php index 5b1b8a5..55d35f0 100644 --- a/app/Services/AdoptionService.php +++ b/app/Services/AdoptionService.php @@ -99,6 +99,9 @@ class AdoptionService UPDATE animals SET status = 'adopte', + adoption_availability = 'not_available', + adoption_available_from = NULL, + adoption_unavailability_reason = 'Animal adopté', refuge_room = NULL, care_box_key = NULL, updated_at = CURRENT_TIMESTAMP, @@ -162,6 +165,7 @@ class AdoptionService $stmt = $db->prepare(" INSERT INTO animal_history ( animal_id, + action, type, label, details, @@ -170,6 +174,7 @@ class AdoptionService ) VALUES ( :animal_id, 'adoption', + 'adoption', 'Adoption finalisée', :details, :user_id, diff --git a/app/Views/evolutions.php b/app/Views/evolutions.php index a0e2506..5ed43da 100644 --- a/app/Views/evolutions.php +++ b/app/Views/evolutions.php @@ -31,10 +31,10 @@
- 1.0.0-rc.21 -

Température pendant les tournées

-

Température proposée à 38,5 °C pendant chaque contrôle et graphique médical - commun pour suivre son évolution avec celle du poids.

+ 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.

diff --git a/tests/run.php b/tests/run.php index 66c4864..56a6761 100644 --- a/tests/run.php +++ b/tests/run.php @@ -26,6 +26,9 @@ foreach ( 'CalendarFeedService', 'NotificationService', 'PrivacyService', + 'GeocodeService', + 'LocationHistoryService', + 'AdoptionService', 'StatisticsService', 'PricingService', 'SpeciesService', @@ -360,11 +363,23 @@ try { $db->prepare( "INSERT INTO medical_notes(animal_id,kind,reason,created_by) VALUES(?,'controle','Contrôle de test',?)", )->execute([$animal, Auth::id()]); - $db->prepare( - "INSERT INTO adoptions(animal_id,adopter_name,adoption_date) VALUES(?,'Adoptant test',date('now'))", - )->execute([$animal]); + AdoptionService::adopt([ + 'animal_id' => $animal, + 'adopter_name' => 'Adoptant test', + 'adopter_phone' => '', + 'adopter_email' => '', + 'adopter_address' => '', + 'adopter_postal_code' => '', + 'adopter_city' => '', + 'adoption_date' => date('Y-m-d'), + 'notes' => '', + 'adopter_contact_id' => null, + ]); $assert((int) $db->query('SELECT COUNT(*) FROM medical_notes')->fetchColumn() === 1); $assert((int) $db->query('SELECT COUNT(*) FROM adoptions')->fetchColumn() === 1); + $availability = $db->query("SELECT adoption_availability FROM animals WHERE internal_code='TEST-001'") + ->fetchColumn(); + $assert($availability === 'not_available', 'Un animal adopté reste disponible à l’adoption'); $assert(!$db->query('PRAGMA foreign_key_check')->fetchAll()); }); $test('Les contrôles médicaux conservent leur date et leur heure', function () use ($assert): void {