mirror of
https://github.com/grocy/grocy.git
synced 2025-08-28 09:01:14 +00:00
Implemented browser barcode scanning (closes #102)
This commit is contained in:
@@ -83,6 +83,7 @@ class DemoDataGeneratorService extends BaseService
|
||||
INSERT INTO products (name, location_id, qu_id_purchase, qu_id_stock, qu_factor_purchase_to_stock, product_group_id) VALUES ('{$this->__t_sql('Milk')}', 2, 10, 10, 1, 6); --23
|
||||
INSERT INTO products (name, location_id, qu_id_purchase, qu_id_stock, qu_factor_purchase_to_stock, product_group_id, parent_product_id) VALUES ('{$this->__t_sql('Milk Chocolate')}', 4, 3, 3, 1, 1, 2); --24
|
||||
INSERT INTO products (name, location_id, qu_id_purchase, qu_id_stock, qu_factor_purchase_to_stock, product_group_id, parent_product_id) VALUES ('{$this->__t_sql('Dark Chocolate')}', 4, 3, 3, 1, 1, 2); --25
|
||||
INSERT INTO products (name, location_id, qu_id_purchase, qu_id_stock, qu_factor_purchase_to_stock, product_group_id, parent_product_id, barcode) VALUES ('{$this->__t_sql('Waffle rolls')}', 4, 3, 3, 1, 1, 2, '22111289'); --26
|
||||
|
||||
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor, product_id) VALUES (3, 12, 10, 10);
|
||||
|
||||
|
@@ -78,6 +78,16 @@ class StockService extends BaseService
|
||||
|
||||
$stockCurrentRow = FindObjectinArrayByPropertyValue($this->GetCurrentStock(), 'product_id', $productId);
|
||||
|
||||
if ($stockCurrentRow == null)
|
||||
{
|
||||
$stockCurrentRow = new \stdClass();
|
||||
$stockCurrentRow->amount = 0;
|
||||
$stockCurrentRow->amount_opened = 0;
|
||||
$stockCurrentRow->amount_aggregated = 0;
|
||||
$stockCurrentRow->amount_opened_aggregated = 0;
|
||||
$stockCurrentRow->is_aggregated_amount = 0;
|
||||
}
|
||||
|
||||
$product = $this->Database->products($productId);
|
||||
$productLastPurchased = $this->Database->stock_log()->where('product_id', $productId)->where('transaction_type', self::TRANSACTION_TYPE_PURCHASE)->where('undone', 0)->max('purchased_date');
|
||||
$productLastUsed = $this->Database->stock_log()->where('product_id', $productId)->where('transaction_type', self::TRANSACTION_TYPE_CONSUME)->where('undone', 0)->max('used_date');
|
||||
|
Reference in New Issue
Block a user