Permet de modifier et supprimer les tarifs

Refs #24
This commit is contained in:
Alexandre NOEL 2026-09-08 00:57:43 +02:00
commit b906cf7b88
11 changed files with 96 additions and 13 deletions

View file

@ -54,6 +54,19 @@ final class PricingService
}
return (int) $rule[$sterilized ? 'fee_after_sterilization' : 'fee_before_sterilization'];
}
public static function deleteTariff(int $id): ?string
{
$db = DB::pdo();
$stmt = $db->prepare('SELECT label FROM clinic_tariffs WHERE id=:id');
$stmt->execute([':id' => $id]);
$label = $stmt->fetchColumn();
if ($label === false) {
return null;
}
$db->prepare('DELETE FROM clinic_tariffs WHERE id=:id')->execute([':id' => $id]);
return (string) $label;
}
public static function tariffs(bool $active = false): array
{
$w = $active ? 'WHERE ct.active=1 AND dc.deleted_at IS NULL' : '';