Fixed zero decimals handling (fixes #1213)

This commit is contained in:
Bernd Bestel
2020-12-23 19:56:37 +01:00
parent bd185cfa32
commit 2e3c237648
24 changed files with 54 additions and 34 deletions

View File

@@ -159,6 +159,17 @@ class BaseController
$this->View->set('permissions', User::PermissionList());
}
$decimalPlacesAmounts = intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts'));
if ($decimalPlacesAmounts <= 0)
{
$defaultMinAmount = 1;
}
else
{
$defaultMinAmount = '0.' . str_repeat('0', $decimalPlacesAmounts - 1) . '1';
}
$this->View->set('DEFAULT_MIN_AMOUNT', $defaultMinAmount);
return $this->View->render($response, $page, $data);
}
@@ -168,7 +179,6 @@ class BaseController
try
{
$usersService = $this->getUsersService();
if (defined('GROCY_USER_ID'))
{
$this->View->set('userSettings', $usersService->GetUserSettings(GROCY_USER_ID));