Remove floats.

This commit is contained in:
James Cole
2022-12-27 21:13:18 +01:00
parent 75ce777090
commit 5e654786be
19 changed files with 48 additions and 49 deletions

View File

@@ -85,7 +85,7 @@ class UpdateRequest extends FormRequest
'notes',
];
$this->floatFields = [
$this->floatFields = [ // not really floats, for validation.
'amount',
'foreign_amount',
];
@@ -406,8 +406,7 @@ class UpdateRequest extends FormRequest
if (array_key_exists($fieldName, $transaction)) {
$value = $transaction[$fieldName];
if (is_float($value)) {
// TODO this effectively limits the max number of decimals in currencies to 14.
$current[$fieldName] = sprintf('%.14f', $value);
$current[$fieldName] = sprintf('%.24f', $value);
}
if (!is_float($value)) {
$current[$fieldName] = (string) $value;

View File

@@ -46,9 +46,8 @@ class PreferenceStoreRequest extends FormRequest
if ('false' === $array['data']) {
$array['data'] = false;
}
// TODO remove float
if (is_numeric($array['data'])) {
$array['data'] = (float) $array['data'];
$array['data'] = (float) $array['data']; // intentional float.
}
return $array;

View File

@@ -47,9 +47,8 @@ class PreferenceUpdateRequest extends FormRequest
if ('false' === $array['data']) {
$array['data'] = false;
}
// TODO remove float
if (is_numeric($array['data'])) {
$array['data'] = (float) $array['data'];
$array['data'] = (float) $array['data']; // intentional float.
}
return $array;