Little refinements for #507

This commit is contained in:
Bernd Bestel 2020-01-22 21:17:04 +01:00
parent ef9f28d154
commit ec2551d263
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 15 additions and 6 deletions

View File

@ -368,3 +368,9 @@ Grocy.Components.RecipePicker.GetPicker().on('change', function (e)
}
);
});
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
// Just save the current recipe on every change of the product picker as a workflow could be started which leaves the page...
Grocy.Api.Put('objects/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function () { }, function () { });
});

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
));