fix: traiter le premier lot de tickets

Refs #4 #5 #6 #9 #12 #16 #18 #20
This commit is contained in:
Alexandre NOEL 2026-09-07 23:31:29 +02:00
commit 04cbe54dd1
14 changed files with 87 additions and 12 deletions

View file

@ -266,6 +266,11 @@ final class SettingsController
$color = preg_match('/^#[0-9a-fA-F]{6}$/', (string) ($new['color'] ?? ''))
? (string) $new['color']
: '#6c757d';
$duplicate = $db->prepare('SELECT 1 FROM shelter_rooms WHERE code=? OR name=? COLLATE NOCASE');
$duplicate->execute([$code, $newName]);
if ($duplicate->fetchColumn()) {
throw new RuntimeException(t('rooms.duplicate'));
}
$db->prepare(
'INSERT INTO shelter_rooms(code,name,room_type,status_code,color,bulk_validation,sort_order) VALUES(?,?,?,?,?,?,?)',
)->execute([$code, $newName, $type, $status, $color, isset($new['bulk_validation']) ? 1 : 0, 100]);
@ -351,6 +356,13 @@ final class SettingsController
exit();
}
try {
$duplicate = $db->prepare(
'SELECT 1 FROM ref_species WHERE id<>:id AND (code=:code OR name=:name COLLATE NOCASE)',
);
$duplicate->execute([':id' => $id, ':code' => $code, ':name' => $name]);
if ($duplicate->fetchColumn()) {
throw new RuntimeException(t('settings.species_duplicate'));
}
if ($id > 0) {
$old = $db->prepare('SELECT code,is_system FROM ref_species WHERE id=:id');
$old->execute([':id' => $id]);