From 9f3c114d57ca430a427a6b62ab2900435ad56fed Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 2 Mar 2019 09:18:26 +0100 Subject: [PATCH] Add JSON decrypt for #2125 --- app/Console/Commands/UpgradeDatabase.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Console/Commands/UpgradeDatabase.php b/app/Console/Commands/UpgradeDatabase.php index b3f4c3cac6..8b5ef9267e 100644 --- a/app/Console/Commands/UpgradeDatabase.php +++ b/app/Console/Commands/UpgradeDatabase.php @@ -147,6 +147,11 @@ class UpgradeDatabase extends Command } $currencyCode = $this->tryDecrypt($currencyPreference->data); + // try json decrypt just in case. + if (\strlen($currencyCode) > 3) { + $currencyCode = json_decode($currencyCode) ?? 'EUR'; + } + $currency = TransactionCurrency::where('code', $currencyCode)->first(); if (null === $currency) { $this->line('Fall back to default currency in migrateBillsToRules().');