fixed shipping note

This commit is contained in:
Luca Haid
2024-12-19 14:04:29 +01:00
parent 991568cc87
commit 93ce386615
2 changed files with 17 additions and 3 deletions

View File

@@ -54,6 +54,14 @@ class WarehouseShippingNoteController extends TTCrud {
die();
}
foreach ($postData['hoursEntries'] as $hoursEntry) {
if (!preg_match('/^[0-9,.]*$/', $hoursEntry['hourCount'])) {
http_response_code(500);
self::returnJson(['success' => false, 'message' => 'Stundenanzahl darf nur Zahlen, Komma oder Punkt enthalten']);
die();
}
}
$postData['positions'] = json_encode($postData['positions']);
return true;
}
@@ -77,6 +85,13 @@ class WarehouseShippingNoteController extends TTCrud {
die();
}
foreach ($postData['hoursEntries'] as $hoursEntry) {
if (!preg_match('/^[0-9,.]*$/', $hoursEntry['hourCount'])) {
http_response_code(500);
self::returnJson(['success' => false, 'message' => 'Stundenanzahl darf nur Zahlen, Komma oder Punkt enthalten']);
die();
}
}
$postData['positions'] = json_encode($postData['positions']);
(new WarehouseHistoryController)->create($postData, $this->mod);
@@ -256,7 +271,7 @@ class WarehouseShippingNoteController extends TTCrud {
$articleTitle = "Arbeitsstunden (100% Zuschlag)";
}
if (intval($hoursEntry['hourCount']) > 0) {
if (floatval(str_replace(",", ".", $hoursEntry['hourCount'])) > 0) {
$positions[] = [
'articleTitle' => $articleTitle,
'articleDescription' => "Datum: ". date("d.m.Y", strtotime($hoursEntry['date'])) . " | Mitarbeiter: " . UserModel::getOne($hoursEntry['userId'])->name,