Only show in-stock products on the /consume page (closes #1429)

This commit is contained in:
Bernd Bestel 2021-07-06 19:31:55 +02:00
parent ffad8bfa7f
commit 70d51c757b
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 2 additions and 1 deletions

View File

@ -28,6 +28,7 @@
### Stock improvements/fixes ### Stock improvements/fixes
- Product barcodes are now enforced to be unique across products - Product barcodes are now enforced to be unique across products
- On the stock overview page it's now also possible to search/filter by product barcodes (via the general search field) - On the stock overview page it's now also possible to search/filter by product barcodes (via the general search field)
- The product picker on the consume page now only shows products which are currently in stock
- Fixed that editing stock entries was not possible - Fixed that editing stock entries was not possible
- Fixed that consuming with Scan Mode was not possible - Fixed that consuming with Scan Mode was not possible
- Fixed that the current stock total value (header of the stock overview page) didn't include decimal amounts (thanks @Ape) - Fixed that the current stock total value (header of the stock overview page) didn't include decimal amounts (thanks @Ape)

View File

@ -11,7 +11,7 @@ class StockController extends BaseController
public function Consume(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) public function Consume(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{ {
return $this->renderPage($response, 'consume', [ return $this->renderPage($response, 'consume', [
'products' => $this->getDatabase()->products()->where('active = 1')->orderBy('name'), 'products' => $this->getDatabase()->products()->where('active = 1')->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)')->orderBy('name'),
'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(), 'barcodes' => $this->getDatabase()->product_barcodes_comma_separated(),
'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE'), 'recipes' => $this->getDatabase()->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->orderBy('name', 'COLLATE NOCASE'),
'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'), 'locations' => $this->getDatabase()->locations()->orderBy('name', 'COLLATE NOCASE'),