Remove static references

This commit is contained in:
James Cole
2023-10-29 06:33:43 +01:00
parent 075d459b7c
commit 4f2159b54d
205 changed files with 1287 additions and 1287 deletions

View File

@@ -138,7 +138,7 @@ class IndexController extends Controller
*/
public function index(Request $request, string $objectType)
{
Log::debug(sprintf('Now at %s', __METHOD__));
app('log')->debug(sprintf('Now at %s', __METHOD__));
$subTitle = (string)trans(sprintf('firefly.%s_accounts', $objectType));
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));
$types = config(sprintf('firefly.accountTypesByIdentifier.%s', $objectType));
@@ -152,7 +152,7 @@ class IndexController extends Controller
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
$inactiveCount = $this->repository->getInactiveAccountsByType($types)->count();
Log::debug(sprintf('Count of collection: %d, count of accounts: %d', $total, $accounts->count()));
app('log')->debug(sprintf('Count of collection: %d, count of accounts: %d', $total, $accounts->count()));
unset($collection);
/** @var Carbon $start */
@@ -189,13 +189,13 @@ class IndexController extends Controller
}
);
// make paginator:
Log::debug(sprintf('Count of accounts before LAP: %d', $accounts->count()));
app('log')->debug(sprintf('Count of accounts before LAP: %d', $accounts->count()));
/** @var LengthAwarePaginator $accounts */
$accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
$accounts->setPath(route('accounts.index', [$objectType]));
Log::debug(sprintf('Count of accounts after LAP (1): %d', $accounts->count()));
Log::debug(sprintf('Count of accounts after LAP (2): %d', $accounts->getCollection()->count()));
app('log')->debug(sprintf('Count of accounts after LAP (1): %d', $accounts->count()));
app('log')->debug(sprintf('Count of accounts after LAP (2): %d', $accounts->getCollection()->count()));
return view('accounts.index', compact('objectType', 'inactiveCount', 'subTitleIcon', 'subTitle', 'page', 'accounts'));
}

View File

@@ -169,14 +169,14 @@ class ReconcileController extends Controller
return $this->redirectAccountToAccount($account);
}
Log::debug('In ReconcileController::submit()');
app('log')->debug('In ReconcileController::submit()');
$data = $request->getAll();
/** @var string $journalId */
foreach ($data['journals'] as $journalId) {
$this->repository->reconcileById((int)$journalId);
}
Log::debug('Reconciled all transactions.');
app('log')->debug('Reconciled all transactions.');
// switch dates if necessary
if ($end->lt($start)) {
@@ -188,7 +188,7 @@ class ReconcileController extends Controller
if ('create' === $data['reconcile']) {
$result = $this->createReconciliation($account, $start, $end, $data['difference']);
}
Log::debug('End of routine.');
app('log')->debug('End of routine.');
app('preferences')->mark();
if ('' === $result) {
session()->flash('success', (string)trans('firefly.reconciliation_stored'));

View File

@@ -120,7 +120,7 @@ class HomeController extends Controller
Log::channel('audit')->info('User sends test message.');
/** @var User $user */
$user = auth()->user();
Log::debug('Now in testMessage() controller.');
app('log')->debug('Now in testMessage() controller.');
event(new AdminRequestedTestMessage($user));
session()->flash('info', (string)trans('firefly.send_test_triggered'));

View File

@@ -94,13 +94,13 @@ class UserController extends Controller
*/
public function deleteInvite(InvitedUser $invitedUser): JsonResponse
{
Log::debug('Will now delete invitation');
app('log')->debug('Will now delete invitation');
if ($invitedUser->redeemed) {
Log::debug('Is already redeemed.');
app('log')->debug('Is already redeemed.');
session()->flash('error', trans('firefly.invite_is_already_redeemed', ['address' => $invitedUser->email]));
return response()->json(['success' => false]);
}
Log::debug('Delete!');
app('log')->debug('Delete!');
session()->flash('success', trans('firefly.invite_is_deleted', ['address' => $invitedUser->email]));
$this->repository->deleteInvite($invitedUser);
return response()->json(['success' => true]);
@@ -246,7 +246,7 @@ class UserController extends Controller
*/
public function update(UserFormRequest $request, User $user)
{
Log::debug('Actually here');
app('log')->debug('Actually here');
$data = $request->getUserData();
//var_dump($data);

View File

@@ -90,7 +90,7 @@ class LoginController extends Controller
app('log')->info('User is trying to login.');
$this->validateLogin($request);
Log::debug('Login data is present.');
app('log')->debug('Login data is present.');
/** Copied directly from AuthenticatesUsers, but with logging added: */
// If the class is using the ThrottlesLogins trait, we can automatically throttle
@@ -106,7 +106,7 @@ class LoginController extends Controller
/** Copied directly from AuthenticatesUsers, but with logging added: */
if ($this->attemptLogin($request)) {
Log::channel('audit')->info(sprintf('User "%s" has been logged in.', $request->get($this->username())));
Log::debug(sprintf('Redirect after login is %s.', $this->redirectPath()));
app('log')->debug(sprintf('Redirect after login is %s.', $this->redirectPath()));
// if you just logged in, it can't be that you have a valid 2FA cookie.

View File

@@ -190,8 +190,8 @@ class IndexController extends Controller
{
$avg = bcdiv(bcadd((string)$bill['amount_min'], (string)$bill['amount_max']), '2');
Log::debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));
Log::debug(sprintf('Average is %s', $avg));
app('log')->debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));
app('log')->debug(sprintf('Average is %s', $avg));
// calculate amount per year:
$multiplies = [
'yearly' => '1',
@@ -202,7 +202,7 @@ class IndexController extends Controller
'daily' => '365.24',
];
$yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
app('log')->debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
// per period:
$division = [
@@ -222,7 +222,7 @@ class IndexController extends Controller
];
$perPeriod = bcdiv($yearAmount, $division[$range]);
Log::debug(sprintf('Amount per %s is %s (%s / %s)', $range, $perPeriod, $yearAmount, $division[$range]));
app('log')->debug(sprintf('Amount per %s is %s (%s / %s)', $range, $perPeriod, $yearAmount, $division[$range]));
return $perPeriod;
}

View File

@@ -130,7 +130,7 @@ class BudgetLimitController extends Controller
*/
public function store(Request $request): RedirectResponse | JsonResponse
{
Log::debug('Going to store new budget-limit.', $request->all());
app('log')->debug('Going to store new budget-limit.', $request->all());
// first search for existing one and update it if necessary.
$currency = $this->currencyRepos->find((int)$request->get('transaction_currency_id'));
$budget = $this->repository->find((int)$request->get('budget_id'));
@@ -147,7 +147,7 @@ class BudgetLimitController extends Controller
return response()->json([]);
}
Log::debug(sprintf('Start: %s, end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
app('log')->debug(sprintf('Start: %s, end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
$limit = $this->blRepository->find($budget, $currency, $start, $end);

View File

@@ -102,7 +102,7 @@ class IndexController extends Controller
public function index(Request $request, Carbon $start = null, Carbon $end = null)
{
$this->abRepository->cleanup();
Log::debug(sprintf('Start of IndexController::index("%s", "%s")', $start?->format('Y-m-d'), $end?->format('Y-m-d')));
app('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);
@@ -219,12 +219,12 @@ class IndexController extends Controller
// get all budgets, and paginate them into $budgets.
$collection = $this->repository->getActiveBudgets();
$budgets = [];
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')));
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')));
// complement budget with budget limits in range, and expenses in currency X in range.
/** @var Budget $current */
foreach ($collection as $current) {
Log::debug(sprintf('Working on budget #%d ("%s")', $current->id, $current->name));
app('log')->debug(sprintf('Working on budget #%d ("%s")', $current->id, $current->name));
$array = $current->toArray();
$array['spent'] = [];
$array['spent_total'] = [];
@@ -234,7 +234,7 @@ class IndexController extends Controller
$budgetLimits = $this->blRepository->getBudgetLimits($current, $start, $end);
/** @var BudgetLimit $limit */
foreach ($budgetLimits as $limit) {
Log::debug(sprintf('Working on budget limit #%d', $limit->id));
app('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'][] = [
@@ -248,7 +248,7 @@ class IndexController extends Controller
'currency_name' => $currency->name,
'currency_decimal_places' => $currency->decimal_places,
];
Log::debug(sprintf('The amount budgeted for budget limit #%d is %s %s', $limit->id, $currency->code, $amount));
app('log')->debug(sprintf('The amount budgeted for budget limit #%d is %s %s', $limit->id, $currency->code, $amount));
}
/** @var TransactionCurrency $currency */
@@ -348,7 +348,7 @@ class IndexController extends Controller
$budgetId = (int)$budgetId;
$budget = $repository->find($budgetId);
if (null !== $budget) {
Log::debug(sprintf('Set budget #%d ("%s") to position %d', $budget->id, $budget->name, $index + 1));
app('log')->debug(sprintf('Set budget #%d ("%s") to position %d', $budget->id, $budget->name, $index + 1));
$repository->setBudgetOrder($budget, $index + 1);
}
}

View File

@@ -83,7 +83,7 @@ class NoCategoryController extends Controller
*/
public function show(Request $request, Carbon $start = null, Carbon $end = null)
{
Log::debug('Start of noCategory()');
app('log')->debug('Start of noCategory()');
/** @var Carbon $start */
$start = $start ?? session('start');
/** @var Carbon $end */
@@ -96,8 +96,8 @@ class NoCategoryController extends Controller
);
$periods = $this->getNoCategoryPeriodOverview($start);
Log::debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
Log::debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
@@ -128,13 +128,13 @@ class NoCategoryController extends Controller
$periods = new Collection();
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
Log::debug('Start of noCategory()');
app('log')->debug('Start of noCategory()');
$subTitle = (string)trans('firefly.all_journals_without_category');
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon() : $first->date;
$end = today(config('app.timezone'));
Log::debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
Log::debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);

View File

@@ -335,12 +335,12 @@ class AccountController extends Controller
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
$defaultSet = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray();
Log::debug('Default set is ', $defaultSet);
app('log')->debug('Default set is ', $defaultSet);
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
Log::debug('Frontpage preference set is ', $frontPage->data);
app('log')->debug('Frontpage preference set is ', $frontPage->data);
if (0 === count($frontPage->data)) {
app('preferences')->set('frontPageAccounts', $defaultSet);
Log::debug('frontpage set is empty!');
app('log')->debug('frontpage set is empty!');
}
$accounts = $repository->getAccountsById($frontPage->data);

View File

@@ -98,7 +98,7 @@ class ReportController extends Controller
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
if (false === $result) {
Log::debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
app('log')->debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
}
return $result;
@@ -160,7 +160,7 @@ class ReportController extends Controller
if ($cache->has()) {
return response()->json($cache->get());
}
Log::debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
app('log')->debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
$format = app('navigation')->preferredCarbonFormat($start, $end);
$titleFormat = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
$preferredRange = app('navigation')->preferredRangeFormat($start, $end);

View File

@@ -69,7 +69,7 @@ class DebugController extends Controller
*/
public function displayError(): void
{
Log::debug('This is a test message at the DEBUG level.');
app('log')->debug('This is a test message at the DEBUG level.');
app('log')->info('This is a test message at the INFO level.');
Log::notice('This is a test message at the NOTICE level.');
app('log')->warning('This is a test message at the WARNING level.');
@@ -92,21 +92,21 @@ class DebugController extends Controller
{
app('preferences')->mark();
$request->session()->forget(['start', 'end', '_previous', 'viewRange', 'range', 'is_custom_range', 'temp-mfa-secret', 'temp-mfa-codes']);
Log::debug('Call cache:clear...');
app('log')->debug('Call cache:clear...');
Artisan::call('cache:clear');
Log::debug('Call config:clear...');
app('log')->debug('Call config:clear...');
Artisan::call('config:clear');
Log::debug('Call route:clear...');
app('log')->debug('Call route:clear...');
Artisan::call('route:clear');
Log::debug('Call twig:clean...');
app('log')->debug('Call twig:clean...');
try {
Artisan::call('twig:clean');
} catch (Exception $e) { // intentional generic exception
throw new FireflyException($e->getMessage(), 0, $e);
}
Log::debug('Call view:clear...');
app('log')->debug('Call view:clear...');
Artisan::call('view:clear');
return redirect(route('index'));
@@ -202,7 +202,7 @@ class DebugController extends Controller
$return['build'] = trim(file_get_contents('/var/www/counter-main.txt'));
}
} catch (Exception $e) { // generic catch for open basedir.
Log::debug('Could not check build counter, but thats ok.');
app('log')->debug('Could not check build counter, but thats ok.');
app('log')->warning($e->getMessage());
}
try {
@@ -210,7 +210,7 @@ class DebugController extends Controller
$return['build_date'] = trim(file_get_contents('/var/www/build-date-main.txt'));
}
} catch (Exception $e) { // generic catch for open basedir.
Log::debug('Could not check build date, but thats ok.');
app('log')->debug('Could not check build date, but thats ok.');
app('log')->warning($e->getMessage());
}
if ('' !== (string)env('BASE_IMAGE_BUILD')) {
@@ -275,7 +275,7 @@ class DebugController extends Controller
$parts = app('steam')->getLocaleArray(app('steam')->getLocale());
foreach ($parts as $code) {
$code = trim($code);
Log::debug(sprintf('Trying to set %s', $code));
app('log')->debug(sprintf('Trying to set %s', $code));
$result = setlocale(LC_ALL, $code);
$localeAttempts[$code] = $result === $code;
}

View File

@@ -84,12 +84,12 @@ class HomeController extends Controller
$label = $request->get('label');
$isCustomRange = false;
Log::debug('Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
app('log')->debug('Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
// check if the label is "everything" or "Custom range" which will betray
// a possible problem with the budgets.
if ($label === (string)trans('firefly.everything') || $label === (string)trans('firefly.customRange')) {
$isCustomRange = true;
Log::debug('Range is now marked as "custom".');
app('log')->debug('Range is now marked as "custom".');
}
$diff = $start->diffInDays($end) + 1;
@@ -99,11 +99,11 @@ class HomeController extends Controller
}
$request->session()->put('is_custom_range', $isCustomRange);
Log::debug(sprintf('Set is_custom_range to %s', var_export($isCustomRange, true)));
app('log')->debug(sprintf('Set is_custom_range to %s', var_export($isCustomRange, true)));
$request->session()->put('start', $start);
Log::debug(sprintf('Set start to %s', $start->format('Y-m-d H:i:s')));
app('log')->debug(sprintf('Set start to %s', $start->format('Y-m-d H:i:s')));
$request->session()->put('end', $end);
Log::debug(sprintf('Set end to %s', $end->format('Y-m-d H:i:s')));
app('log')->debug(sprintf('Set end to %s', $end->format('Y-m-d H:i:s')));
return response()->json(['ok' => 'ok']);
}
@@ -138,7 +138,7 @@ class HomeController extends Controller
// sort frontpage accounts by order
$accounts = $accounts->sortBy('order');
Log::debug('Frontpage accounts are ', $frontPage->data);
app('log')->debug('Frontpage accounts are ', $frontPage->data);
/** @var BillRepositoryInterface $billRepository */
$billRepository = app(BillRepositoryInterface::class);

View File

@@ -253,7 +253,7 @@ class BoxController extends Controller
$allAccounts = $accountRepository->getActiveAccountsByType(
[AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]
);
Log::debug(sprintf('Found %d accounts.', $allAccounts->count()));
app('log')->debug(sprintf('Found %d accounts.', $allAccounts->count()));
// filter list on preference of being included.
$filtered = $allAccounts->filter(
@@ -261,7 +261,7 @@ class BoxController extends Controller
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
if (false === $result) {
Log::debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
app('log')->debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
}
return $result;

View File

@@ -46,12 +46,12 @@ class IntroController extends Controller
*/
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
{
Log::debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
$specificPage = $specificPage ?? '';
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (0 === count($specificSteps)) {
Log::debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
app('log')->debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
return response()->json($steps);
}
@@ -81,7 +81,7 @@ class IntroController extends Controller
public function hasOutroStep(string $route): bool
{
$routeKey = str_replace('.', '_', $route);
Log::debug(sprintf('Has outro step for route %s', $routeKey));
app('log')->debug(sprintf('Has outro step for route %s', $routeKey));
$elements = config(sprintf('intro.%s', $routeKey));
if (!is_array($elements)) {
return false;
@@ -89,9 +89,9 @@ class IntroController extends Controller
$hasStep = array_key_exists('outro', $elements);
Log::debug('Elements is array', $elements);
Log::debug('Keys is', array_keys($elements));
Log::debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
app('log')->debug('Elements is array', $elements);
app('log')->debug('Keys is', array_keys($elements));
app('log')->debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
return $hasStep;
}
@@ -113,7 +113,7 @@ class IntroController extends Controller
if ('' !== $specialPage) {
$key .= '_' . $specialPage;
}
Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('log')->debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('preferences')->set($key, false);
app('preferences')->mark();
@@ -136,7 +136,7 @@ class IntroController extends Controller
if ('' !== $specialPage) {
$key .= '_' . $specialPage;
}
Log::debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('log')->debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('preferences')->set($key, true);
return response()->json(['result' => sprintf('Reported demo watched for route "%s" (%s): %s.', $route, $specialPage, $key)]);

View File

@@ -116,13 +116,13 @@ class ReconcileController extends Controller
$clearedJournals = $collector->getExtractedJournals();
}
Log::debug('Start transaction loop');
app('log')->debug('Start transaction loop');
/** @var array $journal */
foreach ($journals as $journal) {
$amount = $this->processJournal($account, $accountCurrency, $journal, $amount);
}
Log::debug(sprintf('Final amount is %s', $amount));
Log::debug('End transaction loop');
app('log')->debug(sprintf('Final amount is %s', $amount));
app('log')->debug('End transaction loop');
/** @var array $journal */
foreach ($clearedJournals as $journal) {
@@ -156,7 +156,7 @@ class ReconcileController extends Controller
)
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('View error: %s', $e->getMessage()));
app('log')->debug(sprintf('View error: %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
$view = sprintf('Could not render accounts.reconcile.overview: %s', $e->getMessage());
throw new FireflyException($view, 0, $e);
@@ -181,7 +181,7 @@ class ReconcileController extends Controller
private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
{
$toAdd = '0';
Log::debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
app('log')->debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
// not much magic below we need to cover using tests.
@@ -203,9 +203,9 @@ class ReconcileController extends Controller
}
Log::debug(sprintf('Going to add %s to %s', $toAdd, $amount));
app('log')->debug(sprintf('Going to add %s to %s', $toAdd, $amount));
$amount = bcadd($amount, $toAdd);
Log::debug(sprintf('Result is %s', $amount));
app('log')->debug(sprintf('Result is %s', $amount));
return $amount;
}
@@ -258,7 +258,7 @@ class ReconcileController extends Controller
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
)->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render: %s', $e->getMessage()));
app('log')->debug(sprintf('Could not render: %s', $e->getMessage()));
app('log')->error($e->getTraceAsString());
$html = sprintf('Could not render accounts.reconcile.transactions: %s', $e->getMessage());
throw new FireflyException($html, 0, $e);

View File

@@ -156,12 +156,12 @@ class RecurrenceController extends Controller
$preSelected = (string)$request->get('pre_select');
$locale = app('steam')->getLocale();
Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
Log::debug(sprintf('past = true? %s', var_export('true' === (string)$request->get('past'), true)));
app('log')->debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
app('log')->debug(sprintf('past = true? %s', var_export('true' === (string)$request->get('past'), true)));
$result = [];
if ($date > $today || 'true' === (string)$request->get('past')) {
Log::debug('Will fill dropdown.');
app('log')->debug('Will fill dropdown.');
$weekly = sprintf('weekly,%s', $date->dayOfWeekIso);
$monthly = sprintf('monthly,%s', $date->day);
$dayOfWeek = (string)trans(sprintf('config.dow_%s', $date->dayOfWeekIso));
@@ -188,7 +188,7 @@ class RecurrenceController extends Controller
],
];
}
Log::debug('Dropdown is', $result);
app('log')->debug('Dropdown is', $result);
return response()->json($result);
}

View File

@@ -82,7 +82,7 @@ class IndexController extends Controller
*/
public function setOrder(Request $request, ObjectGroup $objectGroup)
{
Log::debug(sprintf('Found object group #%d "%s"', $objectGroup->id, $objectGroup->title));
app('log')->debug(sprintf('Found object group #%d "%s"', $objectGroup->id, $objectGroup->title));
$newOrder = (int)$request->get('order');
$this->repository->setOrder($objectGroup, $newOrder);

View File

@@ -90,7 +90,7 @@ class ProfileController extends Controller
);
$authGuard = config('firefly.authentication_guard');
$this->internalAuth = 'web' === $authGuard;
Log::debug(sprintf('ProfileController::__construct(). Authentication guard is "%s"', $authGuard));
app('log')->debug(sprintf('ProfileController::__construct(). Authentication guard is "%s"', $authGuard));
$this->middleware(IsDemoUser::class)->except(['index']);
}

View File

@@ -62,14 +62,14 @@ class TriggerController extends Controller
$job->setDate($date);
$job->setForce(false);
$job->handle();
Log::debug('Done with recurrence.');
app('log')->debug('Done with recurrence.');
$groups = $job->getGroups();
/** @var TransactionGroup $group */
foreach ($groups as $group) {
/** @var TransactionJournal $journal */
foreach ($group->transactionJournals as $journal) {
Log::debug(sprintf('Set date of journal #%d to today!', $journal->id));
app('log')->debug(sprintf('Set date of journal #%d to today!', $journal->id));
$journal->date = today(config('app.timezone'));
$journal->save();
}

View File

@@ -729,7 +729,7 @@ class CategoryController extends Controller
try {
$result = view('reports.category.partials.top-expenses', compact('result'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($e->getMessage(), 0, $e);
}
@@ -780,7 +780,7 @@ class CategoryController extends Controller
try {
$result = view('reports.category.partials.top-income', compact('result'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($e->getMessage(), 0, $e);
}

View File

@@ -308,7 +308,7 @@ class TagController extends Controller
try {
$result = view('reports.tag.partials.avg-expenses', compact('result'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
@@ -361,7 +361,7 @@ class TagController extends Controller
try {
$result = view('reports.tag.partials.avg-income', compact('result'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
@@ -520,7 +520,7 @@ class TagController extends Controller
try {
$result = view('reports.tag.partials.top-expenses', compact('result'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}
@@ -571,7 +571,7 @@ class TagController extends Controller
try {
$result = view('reports.tag.partials.top-income', compact('result'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
throw new FireflyException($result, 0, $e);
}

View File

@@ -346,7 +346,7 @@ class ReportController extends Controller
$double = implode(',', $request->getDoubleList()->pluck('id')->toArray());
if (0 === $request->getAccountList()->count()) {
Log::debug('Account count is zero');
app('log')->debug('Account count is zero');
session()->flash('error', (string)trans('firefly.select_at_least_one_account'));
return redirect(route('reports.index'));

View File

@@ -173,7 +173,7 @@ class EditController extends Controller
)->render();
} catch (Throwable $e) {
$message = sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage());
Log::debug($message);
app('log')->debug($message);
app('log')->error($e->getTraceAsString());
throw new FireflyException($message, 0, $e);
}

View File

@@ -107,12 +107,12 @@ class InstallController extends Controller
'errorMessage' => null,
];
Log::debug(sprintf('Will now run commands. Request index is %d', $requestIndex));
app('log')->debug(sprintf('Will now run commands. Request index is %d', $requestIndex));
$indexes = array_values(array_keys($this->upgradeCommands));
if (array_key_exists($requestIndex, $indexes)) {
$command = $indexes[$requestIndex];
$parameters = $this->upgradeCommands[$command];
Log::debug(sprintf('Will now execute command "%s" with parameters', $command), $parameters);
app('log')->debug(sprintf('Will now execute command "%s" with parameters', $command), $parameters);
try {
$result = $this->executeCommand($command, $parameters);
} catch (FireflyException $e) {
@@ -144,14 +144,14 @@ class InstallController extends Controller
*/
private function executeCommand(string $command, array $args): bool
{
Log::debug(sprintf('Will now call command %s with args.', $command), $args);
app('log')->debug(sprintf('Will now call command %s with args.', $command), $args);
try {
if ('generate-keys' === $command) {
$this->keys();
}
if ('generate-keys' !== $command) {
Artisan::call($command, $args);
Log::debug(Artisan::output());
app('log')->debug(Artisan::output());
}
} catch (Exception $e) { // intentional generic exception
throw new FireflyException($e->getMessage(), 0, $e);

View File

@@ -317,10 +317,10 @@ class TagController extends Controller
public function store(TagFormRequest $request): RedirectResponse
{
$data = $request->collectTagData();
Log::debug('Data from request', $data);
app('log')->debug('Data from request', $data);
$result = $this->repository->store($data);
Log::debug('Data after storage', $result->toArray());
app('log')->debug('Data after storage', $result->toArray());
session()->flash('success', (string)trans('firefly.created_tag', ['tag' => $data['tag']]));
app('preferences')->mark();

View File

@@ -146,7 +146,7 @@ class BulkController extends Controller
if (true === $ignoreUpdate) {
return false;
}
Log::debug(sprintf('Set budget to %d', $budgetId));
app('log')->debug(sprintf('Set budget to %d', $budgetId));
$this->repository->updateBudget($journal, $budgetId);
return true;
@@ -162,7 +162,7 @@ class BulkController extends Controller
private function updateJournalTags(TransactionJournal $journal, string $action, array $tags): bool
{
if ('do_replace' === $action) {
Log::debug(sprintf('Set tags to %s', implode(',', $tags)));
app('log')->debug(sprintf('Set tags to %s', implode(',', $tags)));
$this->repository->updateTags($journal, $tags);
}
if ('do_append' === $action) {
@@ -186,7 +186,7 @@ class BulkController extends Controller
if (true === $ignoreUpdate) {
return false;
}
Log::debug(sprintf('Set budget to %s', $category));
app('log')->debug(sprintf('Set budget to %s', $category));
$this->repository->updateCategory($journal, $category);
return true;

View File

@@ -119,7 +119,7 @@ class ConvertController extends Controller
];
if ($sourceType->type === $destinationType->type) { // cannot convert to its own type.
Log::debug('This is already a transaction of the expected type..');
app('log')->debug('This is already a transaction of the expected type..');
session()->flash('info', (string)trans('firefly.convert_is_already_type_' . $destinationType->type));
return redirect(route('transactions.show', [$group->id]));

View File

@@ -79,7 +79,7 @@ class DeleteController extends Controller
return $this->redirectGroupToAccount($group);
}
Log::debug(sprintf('Start of delete view for group #%d', $group->id));
app('log')->debug(sprintf('Start of delete view for group #%d', $group->id));
$journal = $group->transactionJournals->first();
if (null === $journal) {
@@ -89,7 +89,7 @@ class DeleteController extends Controller
$subTitle = (string)trans('firefly.delete_' . $objectType, ['description' => $group->title ?? $journal->description]);
$previous = app('steam')->getSafePreviousUrl();
// put previous url in session
Log::debug('Will try to remember previous URL');
app('log')->debug('Will try to remember previous URL');
$this->rememberPreviousUrl('transactions.delete.url');
return view('transactions.delete', compact('group', 'journal', 'subTitle', 'objectType', 'previous'));
@@ -104,7 +104,7 @@ class DeleteController extends Controller
*/
public function destroy(TransactionGroup $group): RedirectResponse
{
Log::debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
app('log')->debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
if (!$this->isEditableGroup($group)) {
return $this->redirectGroupToAccount($group);
}
@@ -134,7 +134,7 @@ class DeleteController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
Log::debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
app('log')->debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
event(new UpdatedAccount($account));
}
app('preferences')->mark();

View File

@@ -123,7 +123,7 @@ class LinkController extends Controller
{
$linkInfo = $request->getLinkInfo();
Log::debug('We are here (store)');
app('log')->debug('We are here (store)');
$other = $this->journalRepository->find($linkInfo['transaction_journal_id']);
if (null === $other) {
session()->flash('error', (string)trans('firefly.invalid_link_selection'));
@@ -144,7 +144,7 @@ class LinkController extends Controller
return redirect(route('transactions.show', [$journal->transaction_group_id]));
}
Log::debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));
app('log')->debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));
$this->repository->storeLink($linkInfo, $other, $journal);
session()->flash('success', (string)trans('firefly.journals_linked'));

View File

@@ -98,23 +98,23 @@ class MassController extends Controller
*/
public function destroy(MassDeleteJournalRequest $request)
{
Log::debug(sprintf('Now in %s', __METHOD__));
app('log')->debug(sprintf('Now in %s', __METHOD__));
$ids = $request->get('confirm_mass_delete');
$count = 0;
if (is_array($ids)) {
Log::debug('Array of IDs', $ids);
app('log')->debug('Array of IDs', $ids);
/** @var string $journalId */
foreach ($ids as $journalId) {
Log::debug(sprintf('Searching for ID #%d', $journalId));
app('log')->debug(sprintf('Searching for ID #%d', $journalId));
/** @var TransactionJournal $journal */
$journal = $this->repository->find((int)$journalId);
if (null !== $journal && (int)$journalId === (int)$journal->id) {
$this->repository->destroyJournal($journal);
++$count;
Log::debug(sprintf('Deleted transaction journal #%d', $journalId));
app('log')->debug(sprintf('Deleted transaction journal #%d', $journalId));
continue;
}
Log::debug(sprintf('Could not find transaction journal #%d', $journalId));
app('log')->debug(sprintf('Could not find transaction journal #%d', $journalId));
}
}
app('preferences')->mark();
@@ -224,7 +224,7 @@ class MassController extends Controller
'amount' => $this->getStringFromRequest($request, $journal->id, 'amount'),
'foreign_amount' => $this->getStringFromRequest($request, $journal->id, 'foreign_amount'),
];
Log::debug(sprintf('Will update journal #%d with data.', $journal->id), $data);
app('log')->debug(sprintf('Will update journal #%d with data.', $journal->id), $data);
// call service to update.
$service->setData($data);