mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
added button to add expired products to shoppinglist (#1026)
* added button to add expired products to shoppinglist
* Localizations are managed via Transifex
Revert "added button to add expired products to shoppinglist"
This reverts commit ad1ab5d6a0
.
* Revert unnecessary change
* Reuse existing function (GetExpiringProducts) to get expired products
Co-authored-by: Mario Klug <mario.klug@sourcefactory.at>
Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
@@ -31,6 +31,30 @@ class StockApiController extends BaseApiController
|
||||
}
|
||||
}
|
||||
|
||||
public function AddExpiredProductsToShoppingList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
User::checkPermission($request, User::PERMISSION_SHOPPINGLIST_ITEMS_ADD);
|
||||
|
||||
try
|
||||
{
|
||||
$requestBody = $request->getParsedBody();
|
||||
|
||||
$listId = 1;
|
||||
|
||||
if (array_key_exists('list_id', $requestBody) && !empty($requestBody['list_id']) && is_numeric($requestBody['list_id']))
|
||||
{
|
||||
$listId = intval($requestBody['list_id']);
|
||||
}
|
||||
|
||||
$this->getStockService()->AddExpiredProductsToShoppingList($listId);
|
||||
return $this->EmptyApiResponse($response);
|
||||
}
|
||||
catch (\Exception $ex)
|
||||
{
|
||||
return $this->GenericErrorResponse($response, $ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function AddProduct(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
User::checkPermission($request, User::PERMISSION_STOCK_PURCHASE);
|
||||
|
Reference in New Issue
Block a user