From 59fae290e5b690f90aa45fcbf4c69f230b55c6f3 Mon Sep 17 00:00:00 2001 From: yparitcher Date: Fri, 15 Nov 2024 00:03:21 -0500 Subject: [PATCH] Transaction Model: explicitly cast decimal to string Laravel defers to PDO & the underlying database as to what type decimals are cast as. When using sqlite text that match a float will be returned as a float, while mySql always returns a string for a decimal. This leads to crashes with sqlite while trying to import tranansactions. (It does not happen every transaction, only when the balance{before,after} coming from the database is floatable) `FireflyIII\Support\Models\AccountBalanceCalculator::getLatesBalance(): Return value must be of type string, float returned.` Fixes: #9458 Signed-off-by: yparitcher --- app/Models/Transaction.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index 87f7b139e2..f10e2cb6b1 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -54,6 +54,8 @@ class Transaction extends Model 'bill_name_encrypted' => 'boolean', 'reconciled' => 'boolean', 'balance_dirty' => 'boolean', + 'balance_before' => 'string' + 'balance_after' => 'string' 'date' => 'datetime', ];