Clarify stock forecast warning reason
This commit is contained in:
1 parent
b406ad3b10
commit
f00af08ec4
1 file changed
+9
-3
@@ -231,10 +231,16 @@ function auth_render_lager_table(string $title, array $rows, array $columns, str
|
||||
if ($forecastDate !== null && $forecastDate !== '') {
|
||||
$forecastDateObject = new DateTimeImmutable((string) $forecastDate);
|
||||
$forecastText = $forecastDateObject->format('d.m.Y');
|
||||
$forecastWarning = $forecastStatus === 'depleted';
|
||||
if (!$forecastWarning && !empty($row['expiry_date'])) {
|
||||
if ($forecastStatus === 'depleted') {
|
||||
$forecastWarning = true;
|
||||
$forecastText .= ' (CHARGE ENDE)';
|
||||
} elseif (!empty($row['expiry_date'])) {
|
||||
$expiryDate = new DateTimeImmutable((string) $row['expiry_date']);
|
||||
$forecastWarning = $forecastDateObject >= $expiryDate->modify('-3 months');
|
||||
$forecastWarning = $forecastDateObject >= $expiryDate->modify('-3 months')
|
||||
&& $forecastDateObject <= $expiryDate;
|
||||
if ($forecastWarning) {
|
||||
$forecastText .= ' (MHD: ' . $expiryDate->format('d.m.Y') . ')';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$forecastText = 'Keine Prognose';
|
||||
|
||||
Reference in new issue
Block a user