Fixed that editing stock entries was not possible (fixes #1268)

This commit is contained in:
Bernd Bestel 2021-01-12 18:04:20 +01:00
parent e42f4b405d
commit bfa3347a20
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
3 changed files with 9 additions and 3 deletions

View File

@ -1 +1,2 @@
- Fixed that tracking chores with "Done by" a different user was not possible - Fixed that tracking chores with "Done by" a different user was not possible
- Fixed that editing stock entries was not possible

View File

@ -156,6 +156,11 @@ function BoolToString(bool $bool)
return $bool ? 'true' : 'false'; return $bool ? 'true' : 'false';
} }
function BoolToInt(bool $bool)
{
return $bool ? 1 : 0;
}
function ExternalSettingValue(string $value) function ExternalSettingValue(string $value)
{ {
$tvalue = rtrim($value, "\r\n"); $tvalue = rtrim($value, "\r\n");

View File

@ -402,11 +402,11 @@ class StockService extends BaseService
$openedDate = $stockRow->opened_date; $openedDate = $stockRow->opened_date;
if ($open && $openedDate == null) if (boolval($open) && $openedDate == null)
{ {
$openedDate = date('Y-m-d'); $openedDate = date('Y-m-d');
} }
elseif (!$open) elseif (!boolval($open))
{ {
$openedDate = null; $openedDate = null;
} }
@ -418,7 +418,7 @@ class StockService extends BaseService
'location_id' => $locationId, 'location_id' => $locationId,
'shopping_location_id' => $shoppingLocationId, 'shopping_location_id' => $shoppingLocationId,
'opened_date' => $openedDate, 'opened_date' => $openedDate,
'open' => $open, 'open' => BoolToInt($open),
'purchased_date' => $purchasedDate 'purchased_date' => $purchasedDate
]); ]);