Fixed /stockedit opened checkbox (references #506)

This commit is contained in:
Bernd Bestel
2020-01-21 20:04:33 +01:00
parent f543a3a472
commit c22496ca7c
5 changed files with 19 additions and 11 deletions

View File

@@ -562,7 +562,7 @@ class StockService extends BaseService
return $this->Database->lastInsertId();
}
public function EditStock(int $stockRowId, int $amount, $bestBeforeDate, $locationId, $price)
public function EditStockEntry(int $stockRowId, int $amount, $bestBeforeDate, $locationId, $price, $open)
{
$stockRow = $this->Database->stock()->where('id = :1', $stockRowId)->fetch();
@@ -572,8 +572,8 @@ class StockService extends BaseService
throw new \Exception('Stock does not exist');
}
$correlationId = uniqid();
$transactionId = uniqid();
$correlationId = uniqid();
$transactionId = uniqid();
$logOldRowForStockUpdate = $this->Database->stock_log()->createRow(array(
'product_id' => $stockRow->product_id,
'amount' => $stockRow->amount,
@@ -594,7 +594,8 @@ class StockService extends BaseService
'amount' => $amount,
'price' => $price,
'best_before_date' => $bestBeforeDate,
'location_id' => $locationId
'location_id' => $locationId,
'open' => $open
));
$logNewRowForStockUpdate = $this->Database->stock_log()->createRow(array(
@@ -613,10 +614,9 @@ class StockService extends BaseService
));
$logNewRowForStockUpdate->save();
$returnValue = $this->Database->lastInsertId();
return $returnValue;
return $this->Database->lastInsertId();
}
public function InventoryProduct(int $productId, float $newAmount, $bestBeforeDate, $locationId = null, $price = null)
{
if (!$this->ProductExists($productId))