fix: rendre un animal adopté indisponible
This commit is contained in:
parent
d35434c522
commit
b8abaa8440
7 changed files with 42 additions and 9 deletions
|
|
@ -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/).
|
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
|
## [1.0.0-rc.21] — 2026-09-15
|
||||||
|
|
||||||
### Suivi de la température
|
### Suivi de la température
|
||||||
|
|
|
||||||
|
|
@ -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
|
## `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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ L’option `--apply` ne doit être utilisée qu’après lecture des rapports. L
|
||||||
|
|
||||||
## État du projet
|
## É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).
|
Le contrôle de stabilisation est disponible dans [docs/AUDIT-1.0.md](docs/AUDIT-1.0.md).
|
||||||
|
|
||||||
|
|
|
||||||
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
1.0.0-rc.21
|
1.0.0-rc.22
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,9 @@ class AdoptionService
|
||||||
UPDATE animals
|
UPDATE animals
|
||||||
SET
|
SET
|
||||||
status = 'adopte',
|
status = 'adopte',
|
||||||
|
adoption_availability = 'not_available',
|
||||||
|
adoption_available_from = NULL,
|
||||||
|
adoption_unavailability_reason = 'Animal adopté',
|
||||||
refuge_room = NULL,
|
refuge_room = NULL,
|
||||||
care_box_key = NULL,
|
care_box_key = NULL,
|
||||||
updated_at = CURRENT_TIMESTAMP,
|
updated_at = CURRENT_TIMESTAMP,
|
||||||
|
|
@ -162,6 +165,7 @@ class AdoptionService
|
||||||
$stmt = $db->prepare("
|
$stmt = $db->prepare("
|
||||||
INSERT INTO animal_history (
|
INSERT INTO animal_history (
|
||||||
animal_id,
|
animal_id,
|
||||||
|
action,
|
||||||
type,
|
type,
|
||||||
label,
|
label,
|
||||||
details,
|
details,
|
||||||
|
|
@ -170,6 +174,7 @@ class AdoptionService
|
||||||
) VALUES (
|
) VALUES (
|
||||||
:animal_id,
|
:animal_id,
|
||||||
'adoption',
|
'adoption',
|
||||||
|
'adoption',
|
||||||
'Adoption finalisée',
|
'Adoption finalisée',
|
||||||
:details,
|
:details,
|
||||||
:user_id,
|
:user_id,
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<section class="card h-100">
|
<section class="card h-100">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<span class="badge bg-blue-lt mb-2">1.0.0-rc.21</span>
|
<span class="badge bg-blue-lt mb-2">1.0.0-rc.22</span>
|
||||||
<h3>Température pendant les tournées</h3>
|
<h3>Disponibilité après adoption</h3>
|
||||||
<p class="text-muted">Température proposée à 38,5 °C pendant chaque contrôle et graphique médical
|
<p class="text-muted">Une adoption finalisée rend automatiquement l’animal indisponible afin de
|
||||||
commun pour suivre son évolution avec celle du poids.</p>
|
conserver un état administratif cohérent.</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ foreach (
|
||||||
'CalendarFeedService',
|
'CalendarFeedService',
|
||||||
'NotificationService',
|
'NotificationService',
|
||||||
'PrivacyService',
|
'PrivacyService',
|
||||||
|
'GeocodeService',
|
||||||
|
'LocationHistoryService',
|
||||||
|
'AdoptionService',
|
||||||
'StatisticsService',
|
'StatisticsService',
|
||||||
'PricingService',
|
'PricingService',
|
||||||
'SpeciesService',
|
'SpeciesService',
|
||||||
|
|
@ -360,11 +363,23 @@ try {
|
||||||
$db->prepare(
|
$db->prepare(
|
||||||
"INSERT INTO medical_notes(animal_id,kind,reason,created_by) VALUES(?,'controle','Contrôle de test',?)",
|
"INSERT INTO medical_notes(animal_id,kind,reason,created_by) VALUES(?,'controle','Contrôle de test',?)",
|
||||||
)->execute([$animal, Auth::id()]);
|
)->execute([$animal, Auth::id()]);
|
||||||
$db->prepare(
|
AdoptionService::adopt([
|
||||||
"INSERT INTO adoptions(animal_id,adopter_name,adoption_date) VALUES(?,'Adoptant test',date('now'))",
|
'animal_id' => $animal,
|
||||||
)->execute([$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 medical_notes')->fetchColumn() === 1);
|
||||||
$assert((int) $db->query('SELECT COUNT(*) FROM adoptions')->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());
|
$assert(!$db->query('PRAGMA foreign_key_check')->fetchAll());
|
||||||
});
|
});
|
||||||
$test('Les contrôles médicaux conservent leur date et leur heure', function () use ($assert): void {
|
$test('Les contrôles médicaux conservent leur date et leur heure', function () use ($assert): void {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue