PHP 8 support

This commit is contained in:
Bernd Bestel
2021-07-05 17:48:34 +02:00
parent d9470cb377
commit b0d38b87de
6 changed files with 72 additions and 59 deletions

View File

@@ -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));
}
}
}

View File

@@ -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