mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Added a new API endpoint to get all stock entries per location
References https://www.reddit.com/r/grocy/comments/srfwfs
This commit is contained in:
@@ -820,6 +820,16 @@ class StockService extends BaseService
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function GetLocationStockEntries($locationId)
|
||||
{
|
||||
if (!$this->LocationExists($locationId))
|
||||
{
|
||||
throw new \Exception('Location does not exist');
|
||||
}
|
||||
|
||||
return $this->getDatabase()->stock()->where('location_id', $locationId);
|
||||
}
|
||||
|
||||
public function GetProductStockEntriesForLocation($productId, $locationId, $excludeOpened = false, $allowSubproductSubstitution = false)
|
||||
{
|
||||
$stockEntries = $this->GetProductStockEntries($productId, $excludeOpened, $allowSubproductSubstitution, true);
|
||||
|
Reference in New Issue
Block a user