fix StockManager lot/serial coercion + add document flow test suite

This commit is contained in:
Thanakorn S
2026-05-21 14:20:41 +07:00
parent 6eeebfeacb
commit e1135d2bce
3 changed files with 403 additions and 6 deletions
@@ -64,7 +64,11 @@ class PostingWindowGuard
$date = "{$m[3]}-{$m[2]}-{$m[1]}";
}
if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $date)) {
if (preg_match("#^([0-9]{4}-[0-9]{2}-[0-9]{2})[ T]#", $date, $m)) {
$date = $m[1];
}
if (!preg_match("#^[0-9]{4}-[0-9]{2}-[0-9]{2}$#", $date)) {
throw new Exception("Invalid posting date {$date}. Use YYYY-MM-DD.");
}