Préparer la version 1.0.0-rc.4

This commit is contained in:
Alexandre NOEL 2026-09-07 14:15:45 +02:00
commit 6e3beea211
38 changed files with 388 additions and 56 deletions

View file

@ -13,6 +13,8 @@ trait AnimalBrowseActions
$quality = trim((string) ($_GET['quality'] ?? ''));
$availability = trim((string) ($_GET['availability'] ?? ''));
$species = SpeciesService::normalize((string) ($_GET['species'] ?? ''));
$attribute = (string) ($_GET['attribute'] ?? '');
$attributeValue = trim((string) ($_GET['value'] ?? ''));
$sort = (string) ($_GET['sort'] ?? 'updated_at');
$dir = strtolower((string) ($_GET['dir'] ?? 'desc')) === 'asc' ? 'ASC' : 'DESC';
$requestedView = (string) ($_GET['view'] ?? '');
@ -59,6 +61,20 @@ trait AnimalBrowseActions
} else {
$species = '';
}
$attributeColumns = [
'color' => 'a.color',
'breed' => 'a.breed',
'hair_type' => 'a.hair_type',
'sex' => 'a.sex',
'status' => 'a.status',
];
if (isset($attributeColumns[$attribute]) && $attributeValue !== '') {
$where[] = 'lower(trim(' . $attributeColumns[$attribute] . '))=lower(trim(:attribute_value))';
$params[':attribute_value'] = $attributeValue;
} else {
$attribute = '';
$attributeValue = '';
}
if ($q !== '') {
$where[] = '(a.name LIKE :q OR a.internal_code LIKE :q OR a.chip_id LIKE :q)';
@ -407,6 +423,8 @@ trait AnimalBrowseActions
'availability' => $availability,
'viewMode' => $viewMode,
'species' => $species,
'attribute' => $attribute,
'attributeValue' => $attributeValue,
'speciesOptions' => SpeciesService::all(false),
]);
}