mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
PHP 8 support
This commit is contained in:
@@ -86,7 +86,14 @@ class LocalizationService
|
||||
}
|
||||
else
|
||||
{
|
||||
return vsprintf($this->Translator->gettext($text), ...$placeholderValues);
|
||||
if (is_array(...$placeholderValues))
|
||||
{
|
||||
return vsprintf($this->Translator->gettext($text), ...$placeholderValues);
|
||||
}
|
||||
else
|
||||
{
|
||||
return sprintf($this->Translator->gettext($text), array_shift($placeholderValues));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -777,7 +777,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, $purchasedDate)
|
||||
public function InventoryProduct(int $productId, float $newAmount, $bestBeforeDate, $locationId = null, $price = null, $shoppingLocationId = null, $purchasedDate = null)
|
||||
{
|
||||
if (!$this->ProductExists($productId))
|
||||
{
|
||||
@@ -796,6 +796,11 @@ class StockService extends BaseService
|
||||
$shoppingLocationId = $productDetails->last_shopping_location_id;
|
||||
}
|
||||
|
||||
if ($purchasedDate == null)
|
||||
{
|
||||
$purchasedDate = date('Y-m-d');
|
||||
}
|
||||
|
||||
// Tare weight handling
|
||||
// The given amount is the new total amount including the container weight (gross)
|
||||
// So assume that the amount in stock is the amount also including the container weight
|
||||
|
Reference in New Issue
Block a user