Little refinements for #507

This commit is contained in:
Bernd Bestel
2020-01-22 21:17:04 +01:00
parent ef9f28d154
commit ec2551d263
2 changed files with 15 additions and 6 deletions

View File

@@ -591,11 +591,14 @@ class StockService extends BaseService
));
$logOldRowForStockUpdate->save();
$openDate = $stockRow->opened_date;
if ($open && $openDate == null) {
$openDate = date('Y-m-d');
} else if (!$open) {
$openDate = null;
$openedDate = $stockRow->opened_date;
if ($open && $openDate == null)
{
$openedDate = date('Y-m-d');
}
else if (!$open)
{
$openedDate = null;
}
$stockRow->update(array(
@@ -603,7 +606,7 @@ class StockService extends BaseService
'price' => $price,
'best_before_date' => $bestBeforeDate,
'location_id' => $locationId,
'opened_date' => $openDate,
'opened_date' => $openedDate,
'open' => $open
));