fix: rétablir la création des portées
This commit is contained in:
parent
b8abaa8440
commit
2029849f18
14 changed files with 35 additions and 21 deletions
|
|
@ -139,13 +139,6 @@ trait AnimalRelationshipActions
|
|||
|
||||
$baseName = trim((string) ($parents[$motherId]['name'] ?? ($parents[$fatherId]['name'] ?? 'Portée')));
|
||||
$allowedSexes = ['F', 'M', 'U'];
|
||||
try {
|
||||
PrivateMediaService::moveVisibility($animalId, (string) $photo['filename'], $isPublic === 1);
|
||||
} catch (Throwable $e) {
|
||||
http_response_code(500);
|
||||
echo h(t('error.upload_failed'));
|
||||
return;
|
||||
}
|
||||
$db->beginTransaction();
|
||||
try {
|
||||
$stmt = $db->prepare(
|
||||
|
|
|
|||
|
|
@ -116,8 +116,8 @@ final class AnimalsController
|
|||
$db = DB::pdo();
|
||||
$db->prepare(
|
||||
'
|
||||
INSERT INTO animal_history (animal_id, type, label, details, user_id)
|
||||
VALUES (:aid, :type, :label, :details, :user)
|
||||
INSERT INTO animal_history (animal_id, action, type, label, details, user_id)
|
||||
VALUES (:aid, :type, :type, :label, :details, :user)
|
||||
',
|
||||
)->execute([
|
||||
':aid' => $animalId,
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ final class CareRoundsController
|
|||
$roundDate = $roundInfo ? date('d/m/Y', strtotime((string) $roundInfo['round_date'])) : date('d/m/Y');
|
||||
$roundPeriod = t('care.' . self::period($roundInfo['period'] ?? 'morning'));
|
||||
$history = $db->prepare(
|
||||
"INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(:animal,'care_round',:label,:details,:user)",
|
||||
"INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(:animal,'care_round','care_round',:label,:details,:user)",
|
||||
);
|
||||
$history->execute([
|
||||
':animal' => $animalId,
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ final class DeathController
|
|||
$details .= '\nEuthanasie : oui';
|
||||
}
|
||||
$db->prepare(
|
||||
"INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(:id,'death',:label,:details,:user)",
|
||||
"INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(:id,'death','death',:label,:details,:user)",
|
||||
)->execute([
|
||||
':id' => $id,
|
||||
':label' => $isUpdate ? 'Informations de décès modifiées' : 'Décès enregistré',
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ final class DewormingController
|
|||
'INSERT INTO dewormings(animal_id,dewormer_id,administered_on,dose_text,weight_kg,next_due_date,notes,source_litter_id,created_by) VALUES(?,?,?,?,?,?,?,?,?)',
|
||||
);
|
||||
$history = $db->prepare(
|
||||
"INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(?,'deworming','Vermifuge administré',?,?)",
|
||||
"INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(?,'deworming','deworming','Vermifuge administré',?,?)",
|
||||
);
|
||||
foreach ($ids as $id) {
|
||||
$s = $db->prepare('SELECT name,birth_date FROM animals WHERE id=? AND deleted_at IS NULL');
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ final class MedicalDocumentsController
|
|||
private static function history(PDO $db, int $animalId, string $label, string $details): void
|
||||
{
|
||||
$db->prepare(
|
||||
"INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(?,'medical',?,?,?)",
|
||||
"INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(?,'medical','medical',?,?,?)",
|
||||
)->execute([$animalId, $label, $details, Auth::id()]);
|
||||
}
|
||||
private static function fr(string $date): string
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ final class PlacementsController
|
|||
$details[] = 'Notes : ' . $notes;
|
||||
}
|
||||
$db->prepare(
|
||||
'INSERT INTO animal_history(animal_id,type,label,details,user_id,created_at) VALUES(:animal,\'placement\',:label,:details,:user,:date)',
|
||||
'INSERT INTO animal_history(animal_id,action,type,label,details,user_id,created_at) VALUES(:animal,\'placement\',\'placement\',:label,:details,:user,:date)',
|
||||
)->execute([
|
||||
':animal' => $animalId,
|
||||
':label' => self::TYPES[$type],
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ final class SurgeriesController
|
|||
]);
|
||||
}
|
||||
$db->prepare(
|
||||
"INSERT INTO animal_history(animal_id,type,label,details,user_id) VALUES(?,'medical','Chirurgie enregistrée',?,?)",
|
||||
"INSERT INTO animal_history(animal_id,action,type,label,details,user_id) VALUES(?,'medical','medical','Chirurgie enregistrée',?,?)",
|
||||
)->execute([$animal, $name . ' — ' . $date, Auth::id()]);
|
||||
$db->commit();
|
||||
header('Location: /animal?id=' . $animal . '#tab-med');
|
||||
|
|
|
|||
|
|
@ -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.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>
|
||||
<span class="badge bg-blue-lt mb-2">1.0.0-rc.23</span>
|
||||
<h3>Fiabilité des portées</h3>
|
||||
<p class="text-muted">La création d’une fratrie ne dépend plus d’un ancien traitement de photo et
|
||||
son historique reste compatible avec les bases existantes.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue