Ilości ujemne w zamówieniu (Ilość)

This commit is contained in:
2026-03-30 09:43:59 +02:00
parent 9023b9a5ed
commit 7da3865110
5 changed files with 49 additions and 32 deletions
+7
View File
@@ -45,6 +45,13 @@ try {
$old_val = $stmt->fetchColumn();
if ((string)$old_val !== (string)$value) {
if ($field === 'quantity') {
$value = (int)$value;
if ($value < 1) {
die(json_encode(['success' => false, 'error' => 'Ilość musi być większa od zera.']));
}
}
if ($field === 'price_per_unit') {
$value = (float)str_replace(',', '.', $value);
}