mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Fixes/changes for pull request #349
This commit is contained in:
parent
6ec3872518
commit
a4454f825a
@ -10,6 +10,7 @@
|
||||
- Fixed that the Userfield type "Preset list" had always the caption "Product group" instead of the configured one (thanks @oncleben31)
|
||||
- Userfields of type "checkbox" are rendered as a checkmark in tables when checked (instead of "1" as till now)
|
||||
- API improvements
|
||||
- New endpoint `/stock/shoppinglist/add-product` to add a product to a shopping list (thanks @Forceu)
|
||||
- New endpoint `/stock/shoppinglist/remove-product` to remove a product from a shopping list (thanks @Forceu)
|
||||
- When adding a product (through `stock/product/{productId}/add` or `stock/product/{productId}/inventory`) with omitted best before date and if the given product has "Default best before days" set, the best before date is calculated based on that (so far always today was used which is still the case when no date is supplied and also the product has no "Default best before days set) (thanks @Forceu)
|
||||
- Field `stock_amount` of endpoint `/stock/products/{productId}´ now returns `0` instead of `null` when the given product is not in stock (thanks @Forceu)
|
||||
|
@ -556,7 +556,12 @@ class StockService extends BaseService
|
||||
throw new \Exception('Shopping list does not exist');
|
||||
}
|
||||
|
||||
$alreadyExistingEntry = $this->Database->shopping_list()->where('product_id', $productId->id)->fetch();
|
||||
if (!$this->ProductExists($productId))
|
||||
{
|
||||
throw new \Exception('Product does not exist');
|
||||
}
|
||||
|
||||
$alreadyExistingEntry = $this->Database->shopping_list()->where('product_id = :1 AND shopping_list_id = :2', $productId, $listId)->fetch();
|
||||
if ($alreadyExistingEntry) // Update
|
||||
{
|
||||
$alreadyExistingEntry->update(array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user