Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix for #1938
James Cole7fa2fed147da
diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.phpindex 1e1d5c6729..d595249e59 100644--- a/app/Import/Converter/Amount.php+++ b/app/Import/Converter/Amount.php@@ -219,10 +219,10 @@ class Amount implements ConverterInterfaceif (0 === strpos($value, '--')) {$value = substr($value, 2);}--- $str = preg_replace('/[^\-\(\)\.\,0-9 ]/', '', $value);- $len = \strlen($str);+ // have to strip the € because apparantly the Postbank (DE) thinks "1.000,00 €" is a normal way to format a number.+ $value = trim((string)str_replace(['€'], '', $value));+ $str = preg_replace('/[^\-\(\)\.\,0-9 ]/', '', $value);+ $len = \strlen($str);if ('(' === $str[0] && ')' === $str[$len - 1]) {$str = '-' . substr($str, 1, $len - 2);}diff --git a/tests/Unit/Import/Converter/AmountTest.php b/tests/Unit/Import/Converter/AmountTest.phpindex 775f30a9a8..e38fcfb801 100644--- a/tests/Unit/Import/Converter/AmountTest.php+++ b/tests/Unit/Import/Converter/AmountTest.php@@ -174,6 +174,12 @@ class AmountTest extends TestCase'--$1.23' => '1.23','--63 5212.4440' => '635212.4440','--,2' => '0.2',++ // Postbank (DE) tests+ '1.000,00 €' => '1000.00',+ '120,34 €' => '120.34',+ '-120,34 €' => '-120.34',+ '-1.000,00 €' => '-1000.00',];foreach ($values as $value => $expected) {$converter = new Amount;