Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Lot of debug info for #619
James Coled618ddc8c5a6
diff --git a/app/Support/Amount.php b/app/Support/Amount.phpindex 107e70b8e9..4db387fc99 100644--- a/app/Support/Amount.php+++ b/app/Support/Amount.php@@ -111,6 +111,8 @@ class Amount*/public function format(string $amount, bool $coloured = true): string{+ Log::debug(sprintf('Now in format("%s", %s).', $amount, var_export($coloured, true)));+return $this->formatAnything($this->getDefaultCurrency(), $amount, $coloured);}@@ -126,12 +128,19 @@ class Amount*/public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true): string{+ Log::debug(sprintf('Now in formatAnything($format, "%s",%s)', $amount, var_export($coloured, true)));+ Log::debug('Currency $format: ', $format->toArray());$locale = explode(',', trans('config.locale'));$locale = array_map('trim', $locale);+ Log::debug('Locale is ', $locale);setlocale(LC_MONETARY, $locale);$float = round($amount, 12);$info = localeconv();- $formatted = number_format($float, $format->decimal_places, $info['mon_decimal_point'], $info['mon_thousands_sep']);+ Log::debug('Localeconv is', $info);+ Log::debug(sprintf('Now calling number_format(%f, %d, "%s", "%s")', $float, $format->decimal_places, $info['mon_decimal_point'], $info['mon_thousands_sep']));+ Log::debug('Decimal places raw: %s', var_export($format->decimal_places, true));++ $formatted = number_format($float, intval($format->decimal_places), $info['mon_decimal_point'], $info['mon_thousands_sep']);// some complicated switches to format the amount correctly:$precedes = $amount < 0 ? $info['n_cs_precedes'] : $info['p_cs_precedes'];@@ -262,20 +271,29 @@ class Amount*/public function getDefaultCurrency(): TransactionCurrency{+ Log::debug('Now in getDefaultCurrency()');$cache = new CacheProperties;$cache->addProperty('getDefaultCurrency');if ($cache->has()) {+ Log::debug('Return cache value: ', $cache->get()->toArray());+return $cache->get(); // @codeCoverageIgnore}+ Log::debug('getDefaultCurrency() is not in cache.');$currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR'));- $currency = TransactionCurrency::where('code', $currencyPreference->data)->first();+ Log::debug('currencyPreference is', $currencyPreference->toArray());+ $currency = TransactionCurrency::where('code', $currencyPreference->data)->first();if (is_null($currency)) {+ Log::debug('Currency is NULL!');throw new FireflyException(sprintf('No currency found with code "%s"', $currencyPreference->data));}+ Log::debug('Currency is ', $currency->toArray());$cache->store($currency);+ Log::debug('Return $currency');+return $currency;}