Add purchased date to inventory (#1102)

* Add purchased date to inventory

* Clarify stock settings label

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
kriddles
2020-10-29 11:04:34 -05:00
committed by GitHub
parent fb17c57dd3
commit 9bbcdafab9
6 changed files with 35 additions and 7 deletions

View File

@@ -677,7 +677,7 @@ class StockService extends BaseService
return $this->getDatabase()->stock()->where('id', $entryId)->fetch();
}
public function InventoryProduct(int $productId, float $newAmount, $bestBeforeDate, $locationId = null, $price = null, $shoppingLocationId = null)
public function InventoryProduct(int $productId, float $newAmount, $bestBeforeDate, $locationId = null, $price = null, $shoppingLocationId = null, $purchasedDate)
{
if (!$this->ProductExists($productId))
{
@@ -720,7 +720,7 @@ class StockService extends BaseService
$bookingAmount = $newAmount;
}
return $this->AddProduct($productId, $bookingAmount, $bestBeforeDate, self::TRANSACTION_TYPE_INVENTORY_CORRECTION, date('Y-m-d'), $price, null, $locationId, $shoppingLocationId);
return $this->AddProduct($productId, $bookingAmount, $bestBeforeDate, self::TRANSACTION_TYPE_INVENTORY_CORRECTION, $purchasedDate, $price, null, $locationId, $shoppingLocationId);
}
elseif ($newAmount < $productDetails->stock_amount + $containerWeight)
{