mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 03:40:10 +00:00
Add purchased date to inventory (#1102)
* Add purchased date to inventory * Clarify stock settings label Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
@@ -427,6 +427,13 @@ class StockApiController extends BaseApiController
|
||||
$bestBeforeDate = $requestBody['best_before_date'];
|
||||
}
|
||||
|
||||
$purchasedDate = null;
|
||||
|
||||
if (array_key_exists('purchased_date', $requestBody) && IsIsoDate($requestBody['purchased_date']))
|
||||
{
|
||||
$bestBeforeDate = $requestBody['purchased_date'];
|
||||
}
|
||||
|
||||
$locationId = null;
|
||||
|
||||
if (array_key_exists('location_id', $requestBody) && is_numeric($requestBody['location_id']))
|
||||
@@ -448,7 +455,7 @@ class StockApiController extends BaseApiController
|
||||
$shoppingLocationId = $requestBody['shopping_location_id'];
|
||||
}
|
||||
|
||||
$bookingId = $this->getStockService()->InventoryProduct($args['productId'], $requestBody['new_amount'], $bestBeforeDate, $locationId, $price, $shoppingLocationId);
|
||||
$bookingId = $this->getStockService()->InventoryProduct($args['productId'], $requestBody['new_amount'], $bestBeforeDate, $locationId, $price, $shoppingLocationId, $purchasedDate);
|
||||
return $this->ApiResponse($response, $this->getDatabase()->stock_log($bookingId));
|
||||
}
|
||||
catch (\Exception $ex)
|
||||
|
Reference in New Issue
Block a user