Warenwirtschaft: F-08 — Füllgewicht mit Nachkommastellen
fill_weight decimal(10,3) + float-Cast; deutsche Eingabe normalisiert, positiv validiert, Fehler im Formular sichtbar. Tests für F-07/F-08. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
fd1572df35
commit
2796b1103e
5 changed files with 114 additions and 2 deletions
|
|
@ -100,8 +100,17 @@ class ProductController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// F-08: Füllgewicht deutsch normalisieren („39,5“) und positiv validieren.
|
||||
if (Request::has('fill_weight')) {
|
||||
$fillRaw = trim((string) Request::input('fill_weight'));
|
||||
$fillNormalized = $fillRaw === '' ? null : reFormatWawiNumber($fillRaw);
|
||||
// Unbrauchbare Eingabe („abc“) nicht zu leer normalisieren, sonst greift nullable.
|
||||
Request::merge(['fill_weight' => $fillNormalized === '' || $fillNormalized === false ? $fillRaw : $fillNormalized]);
|
||||
}
|
||||
|
||||
$rules = [
|
||||
'name' => 'required',
|
||||
'fill_weight' => ['nullable', 'numeric', 'gt:0'],
|
||||
];
|
||||
/*if(isset($data['number']) && $data['number'] != ""){
|
||||
$rules['number'] = 'int';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue