Update source account detection.

This commit is contained in:
James Cole
2024-02-25 18:14:30 +01:00
parent 9222c82af0
commit 2564470197
11 changed files with 95 additions and 95 deletions

View File

@@ -115,12 +115,12 @@ class DebugController extends Controller
*/
public function index()
{
$table = $this->generateTable();
$table = str_replace(["\n", "\t", ' '], '', $table);
$now = now(config('app.timezone'))->format('Y-m-d H:i:s');
$table = $this->generateTable();
$table = str_replace(["\n", "\t", ' '], '', $table);
$now = now(config('app.timezone'))->format('Y-m-d H:i:s');
// get latest log file:
$logger = Log::driver();
$logger = Log::driver();
// PHPstan doesn't recognize the method because of its polymorphic nature.
$handlers = $logger->getHandlers(); // @phpstan-ignore-line
$logContent = '';
@@ -134,7 +134,7 @@ class DebugController extends Controller
}
if ('' !== $logContent) {
// last few lines
$logContent = 'Truncated from this point <----|' . substr((string)$logContent, -16384);
$logContent = 'Truncated from this point <----|'.substr((string)$logContent, -16384);
}
return view('debug', compact('table', 'now', 'logContent'));
@@ -214,7 +214,7 @@ class DebugController extends Controller
private function getAppInfo(): array
{
$userGuard = config('auth.defaults.guard');
$userGuard = config('auth.defaults.guard');
$config = app('fireflyconfig')->get('last_rt_job', 0);
$lastTime = (int)$config->data;
@@ -239,24 +239,24 @@ class DebugController extends Controller
// any of the cron jobs will do, they always run at the same time.
// but this job is the oldest, so the biggest chance it ran once
'last_cronjob' => $lastCronjob,
'last_cronjob_ago' => $lastCronjobAgo,
'last_cronjob' => $lastCronjob,
'last_cronjob_ago' => $lastCronjobAgo,
];
}
private function getuserInfo(): array
{
$userFlags = $this->getUserFlags();
$userFlags = $this->getUserFlags();
// user info
$userAgent = request()->header('user-agent');
$userAgent = request()->header('user-agent');
// set languages, see what happens:
$original = setlocale(LC_ALL, '0');
$localeAttempts = [];
$parts = app('steam')->getLocaleArray(app('steam')->getLocale());
foreach ($parts as $code) {
$code = trim($code);
$code = trim($code);
app('log')->debug(sprintf('Trying to set %s', $code));
$result = setlocale(LC_ALL, $code);
$localeAttempts[$code] = $result === $code;
@@ -280,7 +280,7 @@ class DebugController extends Controller
$flags = [];
/** @var User $user */
$user = auth()->user();
$user = auth()->user();
// has liabilities
if ($user->accounts()->accountTypeIn([AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE])->count() > 0) {
@@ -293,7 +293,7 @@ class DebugController extends Controller
}
// has stored reconciliations
$type = TransactionType::whereType(TransactionType::RECONCILIATION)->first();
$type = TransactionType::whereType(TransactionType::RECONCILIATION)->first();
if ($user->transactionJournals()->where('transaction_type_id', $type->id)->count() > 0) {
$flags[] = '<span title="Has reconciled">:ledger:</span>';
}