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),
]);
}

View file

@ -486,7 +486,7 @@ final class AnimalsController
try {
$svc->refreshByChip($id, $chipId);
} catch (Throwable $e) {
// Le cache conserve l'état d'erreur fourni par le service.
error_log('I-CAD refresh failed for animal ' . $id . ': ' . $e->getMessage());
}
$cached = $svc->getCachedByAnimal($id);
$stale = $svc->isStale($cached, 86400);

View file

@ -592,8 +592,26 @@ final class SettingsController
'groups' => $groups,
'saved' => isset($_GET['saved']),
'error' => (string) ($_GET['error'] ?? ''),
'speciesOptions' => SpeciesService::all(true),
]);
}
public static function addLabReferenceSpecies(): void
{
self::admin();
self::postOnly();
try {
$count = LabReferenceService::copySpecies(
(string) ($_POST['source_species'] ?? ''),
(string) ($_POST['target_species'] ?? ''),
Auth::id(),
);
AuditService::log('lab_reference_species_added', '/settings/lab-references/species', "$count références biologiques ajoutées");
header('Location: /settings/lab-references?saved=1');
} catch (Throwable $e) {
header('Location: /settings/lab-references?error=' . rawurlencode(SecurityService::publicError($e)));
}
exit();
}
public static function saveLabReferences(): void
{
self::admin();
@ -716,7 +734,7 @@ final class SettingsController
self::admin();
self::postOnly();
$theme = (string) ($_POST['public_site_theme'] ?? 'warm');
if (!in_array($theme, ['warm', 'nature', 'minimal'], true)) {
if (!in_array($theme, ['warm', 'nature', 'minimal', 'custom'], true)) {
$theme = 'warm';
}
$routing = (string) ($_POST['public_site_routing'] ?? 'integrated');
@ -732,6 +750,7 @@ final class SettingsController
foreach (
[
'public_site_home_title' => 150,
'public_site_name' => 150,
'public_site_home_text' => 5000,
'public_site_about_title' => 150,
'public_site_about_text' => 10000,
@ -745,7 +764,13 @@ final class SettingsController
) {
$values[$key] = mb_substr(trim((string) ($_POST[$key] ?? '')), 0, $max);
}
foreach (['public_site_donation_url', 'public_site_facebook_url', 'public_site_instagram_url'] as $key) {
$customCss = trim((string) ($_POST['public_site_custom_css'] ?? ''));
if (strlen($customCss) > 30000 || preg_match('/(?:<\/style|@import|expression\s*\(|javascript\s*:|behavior\s*:|-moz-binding|url\s*\()/i', $customCss)) {
header('Location: /settings/public-site?error=' . rawurlencode(t('public_site.invalid_css')));
exit();
}
$values['public_site_custom_css'] = $customCss;
foreach (['public_site_donation_url', 'public_site_facebook_url', 'public_site_instagram_url', 'public_site_mastodon_url', 'public_site_youtube_url', 'public_site_tiktok_url', 'public_site_bluesky_url'] as $key) {
$url = trim((string) ($_POST[$key] ?? ''));
$scheme = strtolower((string) parse_url($url, PHP_URL_SCHEME));
if ($url !== '' && (!filter_var($url, FILTER_VALIDATE_URL) || $scheme !== 'https')) {