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/).
|
||||
|
||||
## [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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
||||
|
|
|
|||
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
|||
1.0.0-rc.21
|
||||
1.0.0-rc.22
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@
|
|||
<div class="col-lg-6">
|
||||
<section class="card h-100">
|
||||
<div class="card-body">
|
||||
<span class="badge bg-blue-lt mb-2">1.0.0-rc.21</span>
|
||||
<h3>Température pendant les tournées</h3>
|
||||
<p class="text-muted">Température proposée à 38,5 °C pendant chaque contrôle et graphique médical
|
||||
commun pour suivre son évolution avec celle du poids.</p>
|
||||
<span class="badge bg-blue-lt mb-2">1.0.0-rc.22</span>
|
||||
<h3>Disponibilité après adoption</h3>
|
||||
<p class="text-muted">Une adoption finalisée rend automatiquement l’animal indisponible afin de
|
||||
conserver un état administratif cohérent.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue