diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php index 9623781c1a..5326871710 100644 --- a/app/Http/Controllers/Budget/IndexController.php +++ b/app/Http/Controllers/Budget/IndexController.php @@ -91,7 +91,7 @@ class IndexController extends Controller public function index(?Carbon $start = null, ?Carbon $end = null) { $this->abRepository->cleanup(); - app('log')->debug(sprintf('Start of IndexController::index("%s", "%s")', $start?->format('Y-m-d'), $end?->format('Y-m-d'))); + Log::debug(sprintf('Start of IndexController::index("%s", "%s")', $start?->format('Y-m-d'), $end?->format('Y-m-d'))); // collect some basic vars: $range = app('navigation')->getViewRange(true); @@ -199,12 +199,12 @@ class IndexController extends Controller // get all budgets, and paginate them into $budgets. $collection = $this->repository->getActiveBudgets(); $budgets = []; - app('log')->debug(sprintf('7) Start is "%s", end is "%s"', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); + Log::debug(sprintf('(getAllBudgets) Start is "%s", end is "%s"', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); // complement budget with budget limits in range, and expenses in currency X in range. /** @var Budget $current */ foreach ($collection as $current) { - app('log')->debug(sprintf('Working on budget #%d ("%s")', $current->id, $current->name)); + Log::debug(sprintf('Working on budget #%d ("%s")', $current->id, $current->name)); $array = $current->toArray(); $array['spent'] = []; $array['spent_total'] = []; @@ -215,7 +215,7 @@ class IndexController extends Controller /** @var BudgetLimit $limit */ foreach ($budgetLimits as $limit) { - app('log')->debug(sprintf('Working on budget limit #%d', $limit->id)); + Log::debug(sprintf('Working on budget limit #%d', $limit->id)); $currency = $limit->transactionCurrency ?? $defaultCurrency; $amount = app('steam')->bcround($limit->amount, $currency->decimal_places); $array['budgeted'][] = [ @@ -231,9 +231,11 @@ class IndexController extends Controller 'currency_name' => $currency->name, 'currency_decimal_places' => $currency->decimal_places, ]; - app('log')->debug(sprintf('The amount budgeted for budget limit #%d is %s %s', $limit->id, $currency->code, $amount)); + Log::debug(sprintf('The amount budgeted for budget limit #%d is %s %s', $limit->id, $currency->code, $amount)); } + // #10463 + /** @var TransactionCurrency $currency */ foreach ($currencies as $currency) { $spentArr = $this->opsRepository->sumExpenses($start, $end, null, new Collection([$current]), $currency, false); @@ -260,6 +262,7 @@ class IndexController extends Controller /** @var array $budget */ foreach ($budgets as $budget) { + Log::debug(sprintf('Now working on budget #%d ("%s")', $budget['id'], $budget['name'])); /** @var array $spent */ foreach ($budget['spent'] as $spent) { $currencyId = $spent['currency_id']; diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php index d6d95e2d31..726d06c212 100644 --- a/app/Repositories/Budget/OperationsRepository.php +++ b/app/Repositories/Budget/OperationsRepository.php @@ -204,7 +204,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?TransactionCurrency $currency = null, bool $convertToNative = false ): array { - Log::debug(sprintf('Start of %s(date, date, array, array, "%s", "%s").', __METHOD__, $currency?->code, var_export($convertToNative, true))); + Log::debug(sprintf('Start of %s(date, date, array, array, "%s", %s).', __METHOD__, $currency?->code, var_export($convertToNative, true))); // this collector excludes all transfers TO liabilities (which are also withdrawals) // because those expenses only become expenses once they move from the liability to the friend. // 2024-12-24 disable the exclusion for now. diff --git a/app/Repositories/Budget/OperationsRepositoryInterface.php b/app/Repositories/Budget/OperationsRepositoryInterface.php index 632574a81c..e4348e2821 100644 --- a/app/Repositories/Budget/OperationsRepositoryInterface.php +++ b/app/Repositories/Budget/OperationsRepositoryInterface.php @@ -70,6 +70,7 @@ interface OperationsRepositoryInterface Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null, - ?TransactionCurrency $currency = null + ?TransactionCurrency $currency = null, + bool $convertToNative = false ): array; } diff --git a/app/Support/Report/Summarizer/TransactionSummarizer.php b/app/Support/Report/Summarizer/TransactionSummarizer.php index 54d13dd2cd..25196bb19a 100644 --- a/app/Support/Report/Summarizer/TransactionSummarizer.php +++ b/app/Support/Report/Summarizer/TransactionSummarizer.php @@ -51,7 +51,7 @@ class TransactionSummarizer public function groupByCurrencyId(array $journals, string $method = 'negative', bool $includeForeign = true): array { - Log::debug(sprintf('Now in groupByCurrencyId([%d journals], "%s")', count($journals), $method)); + Log::debug(sprintf('Now in groupByCurrencyId([%d journals], "%s", %s)', count($journals), $method, var_export($includeForeign, true))); $array = []; foreach ($journals as $journal) { $field = 'amount'; diff --git a/database/seeders/TransactionCurrencySeeder.php b/database/seeders/TransactionCurrencySeeder.php index ea8adf0e78..0ed4ce9132 100644 --- a/database/seeders/TransactionCurrencySeeder.php +++ b/database/seeders/TransactionCurrencySeeder.php @@ -66,7 +66,8 @@ class TransactionCurrencySeeder extends Seeder // asian currencies $currencies[] = ['code' => 'JPY', 'name' => 'Japanese yen', 'symbol' => '¥', 'decimal_places' => 0]; - $currencies[] = ['code' => 'CNY', 'name' => 'Chinese yuan', 'symbol' => '¥', 'decimal_places' => 2]; + //$currencies[] = ['code' => 'CNY', 'name' => 'Chinese yuan', 'symbol' => '¥', 'decimal_places' => 2]; + $currencies[] = ['code' => 'RMB', 'name' => 'Chinese yuan', 'symbol' => '¥', 'decimal_places' => 2]; $currencies[] = ['code' => 'RUB', 'name' => 'Russian ruble', 'symbol' => '₽', 'decimal_places' => 2]; $currencies[] = ['code' => 'INR', 'name' => 'Indian rupee', 'symbol' => '₹', 'decimal_places' => 2];