mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Some code cleanup.
This commit is contained in:
parent
d872484607
commit
2b4088c5f7
@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Generator\Chart\Basic;
|
||||
|
||||
use FireflyIII\Support\ChartColour;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class ChartJsGenerator.
|
||||
@ -130,7 +129,7 @@ class ChartJsGenerator implements GeneratorInterface
|
||||
$index = 0;
|
||||
foreach ($data as $key => $value) {
|
||||
// make larger than 0
|
||||
$chartData['datasets'][0]['data'][] = (float)Steam::positive($value);
|
||||
$chartData['datasets'][0]['data'][] = (float)app('steam')->positive($value);
|
||||
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
||||
$chartData['labels'][] = $key;
|
||||
++$index;
|
||||
|
@ -34,7 +34,6 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class MonthReportGenerator.
|
||||
@ -199,7 +198,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end);
|
||||
$journals = $collector->getJournals();
|
||||
$journals = $journals->reverse();
|
||||
$dayBeforeBalance = Steam::balance($account, $date);
|
||||
$dayBeforeBalance = app('steam')->balance($account, $date);
|
||||
$startBalance = $dayBeforeBalance;
|
||||
$currency = $currencyRepos->findNull((int)$accountRepository->getMetaValue($account, 'currency_id'));
|
||||
|
||||
@ -225,7 +224,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
'journals' => $journals->reverse(),
|
||||
'exists' => $journals->count() > 0,
|
||||
'end' => $this->end->formatLocalized((string)trans('config.month_and_day')),
|
||||
'endBalance' => Steam::balance($account, $this->end),
|
||||
'endBalance' => app('steam')->balance($account, $this->end),
|
||||
'dayBefore' => $date->formatLocalized((string)trans('config.month_and_day')),
|
||||
'dayBeforeBalance' => $dayBeforeBalance,
|
||||
];
|
||||
|
@ -38,7 +38,6 @@ use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class MetaPieChart.
|
||||
@ -363,7 +362,7 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
$object = $repository->find((int)$objectId);
|
||||
$names[$objectId] = $object->name ?? $object->tag;
|
||||
}
|
||||
$amount = Steam::positive($amount);
|
||||
$amount = app('steam')->positive($amount);
|
||||
$this->total = bcadd($this->total, $amount);
|
||||
$chartData[$names[$objectId]] = $amount;
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* TODO rename references to journals to transactions
|
||||
@ -282,10 +281,10 @@ class JournalCollector implements JournalCollectorInterface
|
||||
$set->each(
|
||||
function (Transaction $transaction) {
|
||||
$transaction->date = new Carbon($transaction->date);
|
||||
$transaction->description = Steam::decrypt((int)$transaction->encrypted, $transaction->description);
|
||||
$transaction->description = app('steam')->decrypt((int)$transaction->encrypted, $transaction->description);
|
||||
|
||||
if (null !== $transaction->bill_name) {
|
||||
$transaction->bill_name = Steam::decrypt((int)$transaction->bill_name_encrypted, $transaction->bill_name);
|
||||
$transaction->bill_name = app('steam')->decrypt((int)$transaction->bill_name_encrypted, $transaction->bill_name);
|
||||
}
|
||||
$transaction->account_name = app('steam')->tryDecrypt($transaction->account_name);
|
||||
$transaction->opposing_account_name = app('steam')->tryDecrypt($transaction->opposing_account_name);
|
||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Helpers\Filter;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class TransferFilter.
|
||||
@ -53,7 +52,7 @@ class TransferFilter implements FilterInterface
|
||||
}
|
||||
// make property string:
|
||||
$journalId = $transaction->transaction_journal_id;
|
||||
$amount = Steam::positive($transaction->transaction_amount);
|
||||
$amount = app('steam')->positive($transaction->transaction_amount);
|
||||
$accountIds = [(int)$transaction->account_id, (int)$transaction->opposing_account_id];
|
||||
$transactionIds = [$transaction->id, (int)$transaction->opposing_id];
|
||||
sort($accountIds);
|
||||
|
@ -40,7 +40,6 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Preferences;
|
||||
use Steam;
|
||||
use View;
|
||||
|
||||
/**
|
||||
@ -228,9 +227,9 @@ class AccountController extends Controller
|
||||
$start->subDay();
|
||||
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
$startBalances = Steam::balancesByAccounts($accounts, $start);
|
||||
$endBalances = Steam::balancesByAccounts($accounts, $end);
|
||||
$activities = Steam::getLastActivities($ids);
|
||||
$startBalances = app('steam')->balancesByAccounts($accounts, $start);
|
||||
$endBalances = app('steam')->balancesByAccounts($accounts, $end);
|
||||
$activities = app('steam')->getLastActivities($ids);
|
||||
|
||||
$accounts->each(
|
||||
function (Account $account) use ($activities, $startBalances, $endBalances) {
|
||||
@ -289,11 +288,11 @@ class AccountController extends Controller
|
||||
if (0 === $currencyId) {
|
||||
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
||||
}
|
||||
$fStart = $start->formatLocalized($this->monthAndDayFormat);
|
||||
$fEnd = $end->formatLocalized($this->monthAndDayFormat);
|
||||
$subTitle = trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
|
||||
$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
|
||||
$periods = $this->getPeriodOverview($account, $end);
|
||||
$fStart = $start->formatLocalized($this->monthAndDayFormat);
|
||||
$fEnd = $end->formatLocalized($this->monthAndDayFormat);
|
||||
$subTitle = trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
|
||||
$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
|
||||
$periods = $this->getPeriodOverview($account, $end);
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
|
||||
@ -336,8 +335,8 @@ class AccountController extends Controller
|
||||
if (0 === $currencyId) {
|
||||
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
||||
}
|
||||
$subTitle = trans('firefly.all_journals_for_account', ['name' => $account->name]);
|
||||
$periods = new Collection;
|
||||
$subTitle = trans('firefly.all_journals_for_account', ['name' => $account->name]);
|
||||
$periods = new Collection;
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
|
||||
|
@ -147,8 +147,10 @@ class UserController extends Controller
|
||||
$subTitleIcon = 'fa-user';
|
||||
$information = $repository->getUserData($user);
|
||||
|
||||
return view('admin.users.show', compact('title', 'mainTitleIcon', 'subTitle', 'subTitleIcon', 'information', 'user'
|
||||
)
|
||||
return view(
|
||||
'admin.users.show', compact(
|
||||
'title', 'mainTitleIcon', 'subTitle', 'subTitleIcon', 'information', 'user'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,11 @@ use FireflyConfig;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Contracts\Validation\Validator as ValidatorContract;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Contracts\Validation\Validator as ValidatorContract;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class RegisterController
|
||||
|
@ -444,7 +444,7 @@ class BudgetController extends Controller
|
||||
|
||||
// prep for "specific date" view.
|
||||
if ('all' !== $moment && \strlen($moment) > 0) {
|
||||
$start = new Carbon($moment);
|
||||
$start = new Carbon($moment);
|
||||
/** @var Carbon $end */
|
||||
$end = app('navigation')->endOfPeriod($start, $range);
|
||||
$subTitle = trans(
|
||||
|
@ -38,7 +38,6 @@ use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class CategoryController.
|
||||
@ -400,7 +399,7 @@ class CategoryController extends Controller
|
||||
$collector->setAllAssetAccounts()->setRange($date['start'], $date['end'])->withoutCategory()
|
||||
->withOpposingAccount()->setTypes([TransactionType::TRANSFER]);
|
||||
$collector->removeFilter(InternalTransferFilter::class);
|
||||
$transferred = Steam::positive($collector->getJournals()->sum('transaction_amount'));
|
||||
$transferred = app('steam')->positive($collector->getJournals()->sum('transaction_amount'));
|
||||
|
||||
// amount spent
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
@ -482,7 +481,7 @@ class CategoryController extends Controller
|
||||
$collector->setAllAssetAccounts()->setRange($currentDate['start'], $currentDate['end'])->setCategory($category)
|
||||
->withOpposingAccount()->setTypes([TransactionType::TRANSFER]);
|
||||
$collector->removeFilter(InternalTransferFilter::class);
|
||||
$transferred = Steam::positive($collector->getJournals()->sum('transaction_amount'));
|
||||
$transferred = app('steam')->positive($collector->getJournals()->sum('transaction_amount'));
|
||||
|
||||
$entries->push(
|
||||
[
|
||||
|
@ -38,7 +38,6 @@ use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Collection;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class BudgetController.
|
||||
@ -230,7 +229,7 @@ class BudgetController extends Controller
|
||||
public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit): JsonResponse
|
||||
{
|
||||
$budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id;
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($budget->id);
|
||||
$cache->addProperty($budgetLimitId);
|
||||
$cache->addProperty('chart.budget.expense-category');
|
||||
@ -278,7 +277,7 @@ class BudgetController extends Controller
|
||||
public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit): JsonResponse
|
||||
{
|
||||
$budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id;
|
||||
$cache = new CacheProperties;
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($budget->id);
|
||||
$cache->addProperty($budgetLimitId);
|
||||
$cache->addProperty('chart.budget.expense-expense');
|
||||
@ -486,7 +485,7 @@ class BudgetController extends Controller
|
||||
$budgeted = [];
|
||||
while ($current < $end) {
|
||||
/** @var Carbon $currentStart */
|
||||
$currentStart = app('navigation')->startOfPeriod($current, $range);
|
||||
$currentStart = app('navigation')->startOfPeriod($current, $range);
|
||||
/** @var Carbon $currentEnd */
|
||||
$currentEnd = app('navigation')->endOfPeriod($current, $range);
|
||||
$budgetLimits = $this->repository->getBudgetLimits($budget, $currentStart, $currentEnd);
|
||||
@ -581,7 +580,7 @@ class BudgetController extends Controller
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($limits as $budgetLimit) {
|
||||
$expenses = $this->repository->spentInPeriod(new Collection([$budget]), new Collection, $budgetLimit->start_date, $budgetLimit->end_date);
|
||||
$expenses = Steam::positive($expenses);
|
||||
$expenses = app('steam')->positive($expenses);
|
||||
|
||||
if ($limits->count() > 1) {
|
||||
$name = $budget->name . ' ' . trans(
|
||||
@ -603,7 +602,7 @@ class BudgetController extends Controller
|
||||
|
||||
$left = $hasOverspent ? '0' : bcsub($amount, $expenses);
|
||||
$spent = $hasOverspent ? $amount : $expenses;
|
||||
$overspent = $hasOverspent ? Steam::positive($leftInLimit) : '0';
|
||||
$overspent = $hasOverspent ? app('steam')->positive($leftInLimit) : '0';
|
||||
|
||||
$return[$name] = [
|
||||
'left' => $left,
|
||||
|
@ -30,7 +30,6 @@ use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class ReportController.
|
||||
@ -74,7 +73,7 @@ class ReportController extends Controller
|
||||
$current = clone $start;
|
||||
$chartData = [];
|
||||
while ($current < $end) {
|
||||
$balances = Steam::balancesByAccounts($accounts, $current);
|
||||
$balances = app('steam')->balancesByAccounts($accounts, $current);
|
||||
$sum = $this->arraySum($balances);
|
||||
$label = $current->formatLocalized((string)trans('config.month_and_day'));
|
||||
$chartData[$label] = $sum;
|
||||
|
@ -213,7 +213,7 @@ class CurrencyController extends Controller
|
||||
public function index(Request $request)
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
|
||||
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||
$collection = $this->repository->get();
|
||||
|
@ -118,7 +118,7 @@ class HomeController extends Controller
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
/** @noinspection NullPointerExceptionInspection */
|
||||
$accounts = $repository->getAccountsById($frontPage->data);
|
||||
$today = new Carbon;
|
||||
|
@ -198,7 +198,7 @@ class IndexController extends Controller
|
||||
{
|
||||
// get and filter all import routines:
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
/** @var array $config */
|
||||
$providerNames = array_keys(config('import.enabled'));
|
||||
$providers = [];
|
||||
|
@ -87,7 +87,7 @@ class PrerequisitesController extends Controller
|
||||
throw new FireflyException(sprintf('No class to handle prerequisites for "%s".', $importProvider)); // @codeCoverageIgnore
|
||||
}
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
/** @var PrerequisitesInterface $object */
|
||||
$object = app($class);
|
||||
$object->setUser($user);
|
||||
@ -143,7 +143,7 @@ class PrerequisitesController extends Controller
|
||||
throw new FireflyException(sprintf('Cannot find class %s', $class)); // @codeCoverageIgnore
|
||||
}
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
/** @var PrerequisitesInterface $object */
|
||||
$object = app($class);
|
||||
$object->setUser($user);
|
||||
|
@ -179,7 +179,7 @@ class JavascriptController extends Controller
|
||||
/** @var Carbon $todayStart */
|
||||
$todayStart = app('navigation')->startOfPeriod($today, $viewRange);
|
||||
/** @var Carbon $todayEnd */
|
||||
$todayEnd = app('navigation')->endOfPeriod($todayStart, $viewRange);
|
||||
$todayEnd = app('navigation')->endOfPeriod($todayStart, $viewRange);
|
||||
if ($todayStart->ne($start) || $todayEnd->ne($end)) {
|
||||
$ranges[ucfirst((string)trans('firefly.today'))] = [$todayStart, $todayEnd];
|
||||
}
|
||||
|
@ -130,7 +130,6 @@ class ReportController extends Controller
|
||||
$account = $this->accountRepository->findNull((int)$attributes['accountId']);
|
||||
|
||||
|
||||
|
||||
switch (true) {
|
||||
case BalanceLine::ROLE_DEFAULTROLE === $role && null !== $budget && null !== $account:
|
||||
// normal row with a budget:
|
||||
@ -160,8 +159,8 @@ class ReportController extends Controller
|
||||
*/
|
||||
private function budgetSpentAmount(array $attributes): string
|
||||
{
|
||||
$budget = $this->budgetRepository->findNull((int)$attributes['budgetId']);
|
||||
if(null === $budget) {
|
||||
$budget = $this->budgetRepository->findNull((int)$attributes['budgetId']);
|
||||
if (null === $budget) {
|
||||
throw new FireflyException('This is an unknown budget. Apologies.');
|
||||
}
|
||||
$journals = $this->popupHelper->byBudget($budget, $attributes);
|
||||
@ -182,7 +181,7 @@ class ReportController extends Controller
|
||||
{
|
||||
$category = $this->categoryRepository->findNull((int)$attributes['categoryId']);
|
||||
|
||||
if(null === $category) {
|
||||
if (null === $category) {
|
||||
throw new FireflyException('This is an unknown category. Apologies.');
|
||||
}
|
||||
|
||||
@ -202,9 +201,9 @@ class ReportController extends Controller
|
||||
*/
|
||||
private function expenseEntry(array $attributes): string
|
||||
{
|
||||
$account = $this->accountRepository->findNull((int)$attributes['accountId']);
|
||||
$account = $this->accountRepository->findNull((int)$attributes['accountId']);
|
||||
|
||||
if(null === $account) {
|
||||
if (null === $account) {
|
||||
throw new FireflyException('This is an unknown account. Apologies.');
|
||||
}
|
||||
|
||||
@ -224,9 +223,9 @@ class ReportController extends Controller
|
||||
*/
|
||||
private function incomeEntry(array $attributes): string
|
||||
{
|
||||
$account = $this->accountRepository->findNull((int)$attributes['accountId']);
|
||||
$account = $this->accountRepository->findNull((int)$attributes['accountId']);
|
||||
|
||||
if(null === $account) {
|
||||
if (null === $account) {
|
||||
throw new FireflyException('This is an unknown category. Apologies.');
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,8 @@ class PreferencesController extends Controller
|
||||
*/
|
||||
public function index(AccountRepositoryInterface $repository)
|
||||
{
|
||||
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
$viewRangePref = Preferences::get('viewRange', '1M');
|
||||
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
$viewRangePref = Preferences::get('viewRange', '1M');
|
||||
/** @noinspection NullPointerExceptionInspection */
|
||||
$viewRange = $viewRangePref->data;
|
||||
$frontPageAccounts = Preferences::get('frontPageAccounts', []);
|
||||
|
@ -182,7 +182,7 @@ class ProfileController extends Controller
|
||||
public function enable2FA(UserRepositoryInterface $repository)
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
if ($repository->hasRole($user, 'demo')) {
|
||||
return redirect(route('profile.index'));
|
||||
}
|
||||
@ -289,7 +289,7 @@ class ProfileController extends Controller
|
||||
$current = $request->get('current_password');
|
||||
$new = $request->get('new_password');
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
try {
|
||||
$this->validatePassword($user, $current, $new);
|
||||
} catch (ValidationException $e) {
|
||||
@ -351,7 +351,7 @@ class ProfileController extends Controller
|
||||
public function regenerate()
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
$token = $user->generateAccessToken();
|
||||
Preferences::set('access_token', $token);
|
||||
session()->flash('success', (string)trans('firefly.token_regenerated'));
|
||||
|
@ -185,7 +185,7 @@ class ReportController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|string
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|string
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
|
@ -293,7 +293,7 @@ class RuleController extends Controller
|
||||
public function index()
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
$this->createDefaultRuleGroup();
|
||||
$this->createDefaultRule();
|
||||
$ruleGroups = $this->ruleGroupRepos->getRuleGroupsWithRules($user);
|
||||
|
@ -97,8 +97,8 @@ class RuleGroupController extends Controller
|
||||
public function destroy(Request $request, RuleGroupRepositoryInterface $repository, RuleGroup $ruleGroup)
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$title = $ruleGroup->title;
|
||||
$user = auth()->user();
|
||||
$title = $ruleGroup->title;
|
||||
|
||||
/** @var RuleGroup $moveTo */
|
||||
$moveTo = $user->ruleGroups()->find((int)$request->get('move_rules_before_delete'));
|
||||
|
@ -193,7 +193,7 @@ class TagController extends Controller
|
||||
|
||||
// prep for "specific date" view.
|
||||
if ('all' !== $moment && \strlen($moment) > 0) {
|
||||
$start = new Carbon($moment);
|
||||
$start = new Carbon($moment);
|
||||
/** @var Carbon $end */
|
||||
$end = app('navigation')->endOfPeriod($start, $range);
|
||||
$subTitle = trans(
|
||||
|
@ -124,7 +124,7 @@ class MassController extends Controller
|
||||
public function edit(Collection $journals): IlluminateView
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
$subTitle = trans('firefly.mass_edit_journals');
|
||||
|
||||
|
||||
|
@ -39,7 +39,6 @@ use FireflyIII\Transformers\TransactionTransformer;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Preferences;
|
||||
use Steam;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
use View;
|
||||
|
||||
@ -94,7 +93,7 @@ class SplitController extends Controller
|
||||
return $this->redirectToAccount($journal); // @codeCoverageIgnore
|
||||
}
|
||||
// basic fields:
|
||||
$uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size')));
|
||||
$uploadSize = min(app('steam')->phpBytes(ini_get('upload_max_filesize')), app('steam')->phpBytes(ini_get('post_max_size')));
|
||||
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
|
||||
$subTitleIcon = 'fa-pencil';
|
||||
|
||||
|
@ -275,9 +275,9 @@ class TransactionController extends Controller
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
$entries->push(
|
||||
[
|
||||
'name' => $dateName,
|
||||
'sums' => $sums,
|
||||
'sum' => $sum,
|
||||
'name' => $dateName,
|
||||
'sums' => $sums,
|
||||
'sum' => $sum,
|
||||
|
||||
'start' => $currentDate['start']->format('Y-m-d'),
|
||||
'end' => $currentDate['end']->format('Y-m-d'),
|
||||
|
@ -117,6 +117,7 @@ class Authenticate
|
||||
);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
return $this->auth->authenticate();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class AuthenticateTwoFactor
|
||||
$is2faEnabled = app('preferences')->get('twoFactorAuthEnabled', false)->data;
|
||||
$has2faSecret = null !== app('preferences')->get('twoFactorAuthSecret');
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
$is2faAuthed = 'true' === $request->cookie('twoFactorAuthenticated');
|
||||
$is2faAuthed = 'true' === $request->cookie('twoFactorAuthenticated');
|
||||
|
||||
if ($is2faEnabled && $has2faSecret && !$is2faAuthed) {
|
||||
Log::debug('Does not seem to be 2 factor authed, redirect.');
|
||||
|
@ -27,7 +27,6 @@ use Crypt;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Steam;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
@ -149,7 +148,7 @@ class PiggyBank extends Model
|
||||
*/
|
||||
public function leftOnAccount(Carbon $date): string
|
||||
{
|
||||
$balance = Steam::balanceIgnoreVirtual($this->account, $date);
|
||||
$balance = app('steam')->balanceIgnoreVirtual($this->account, $date);
|
||||
/** @var PiggyBank $piggyBank */
|
||||
foreach ($this->account->piggyBanks as $piggyBank) {
|
||||
$currentAmount = $piggyBank->currentRelevantRep()->currentamount ?? '0';
|
||||
|
@ -29,7 +29,6 @@ use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class AccountTasker.
|
||||
@ -50,8 +49,8 @@ class AccountTasker implements AccountTaskerInterface
|
||||
{
|
||||
$yesterday = clone $start;
|
||||
$yesterday->subDay();
|
||||
$startSet = Steam::balancesByAccounts($accounts, $yesterday);
|
||||
$endSet = Steam::balancesByAccounts($accounts, $end);
|
||||
$startSet = app('steam')->balancesByAccounts($accounts, $yesterday);
|
||||
$endSet = app('steam')->balancesByAccounts($accounts, $end);
|
||||
|
||||
Log::debug('Start of accountreport');
|
||||
|
||||
|
@ -26,7 +26,6 @@ use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use Log;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class Modifier
|
||||
@ -42,8 +41,8 @@ class Modifier
|
||||
*/
|
||||
public static function amountCompare(Transaction $transaction, string $amount, int $expected): bool
|
||||
{
|
||||
$amount = Steam::positive($amount);
|
||||
$transactionAmount = Steam::positive($transaction->transaction_amount);
|
||||
$amount = app('steam')->positive($amount);
|
||||
$transactionAmount = app('steam')->positive($transaction->transaction_amount);
|
||||
|
||||
$compare = bccomp($amount, $transactionAmount);
|
||||
Log::debug(sprintf('%s vs %s is %d', $amount, $transactionAmount, $compare));
|
||||
@ -64,12 +63,12 @@ class Modifier
|
||||
$res = true;
|
||||
switch ($modifier['type']) {
|
||||
case 'source':
|
||||
$name = Steam::tryDecrypt($transaction->account_name);
|
||||
$name = app('steam')->tryDecrypt($transaction->account_name);
|
||||
$res = self::stringCompare($name, $modifier['value']);
|
||||
Log::debug(sprintf('Source is %s? %s', $modifier['value'], var_export($res, true)));
|
||||
break;
|
||||
case 'destination':
|
||||
$name = Steam::tryDecrypt($transaction->opposing_account_name);
|
||||
$name = app('steam')->tryDecrypt($transaction->opposing_account_name);
|
||||
$res = self::stringCompare($name, $modifier['value']);
|
||||
Log::debug(sprintf('Destination is %s? %s', $modifier['value'], var_export($res, true)));
|
||||
break;
|
||||
@ -82,7 +81,7 @@ class Modifier
|
||||
Log::debug(sprintf('Budget is %s? %s', $modifier['value'], var_export($res, true)));
|
||||
break;
|
||||
case 'bill':
|
||||
$name = Steam::tryDecrypt($transaction->bill_name);
|
||||
$name = app('steam')->tryDecrypt($transaction->bill_name);
|
||||
$res = self::stringCompare($name, $modifier['value']);
|
||||
Log::debug(sprintf('Bill is %s? %s', $modifier['value'], var_export($res, true)));
|
||||
break;
|
||||
@ -166,11 +165,11 @@ class Modifier
|
||||
{
|
||||
$journalBudget = '';
|
||||
if (null !== $transaction->transaction_journal_budget_name) {
|
||||
$journalBudget = Steam::decrypt((int)$transaction->transaction_journal_budget_encrypted, $transaction->transaction_journal_budget_name);
|
||||
$journalBudget = app('steam')->decrypt((int)$transaction->transaction_journal_budget_encrypted, $transaction->transaction_journal_budget_name);
|
||||
}
|
||||
$transactionBudget = '';
|
||||
if (null !== $transaction->transaction_budget_name) {
|
||||
$journalBudget = Steam::decrypt((int)$transaction->transaction_budget_encrypted, $transaction->transaction_budget_name);
|
||||
$journalBudget = app('steam')->decrypt((int)$transaction->transaction_budget_encrypted, $transaction->transaction_budget_name);
|
||||
}
|
||||
|
||||
return self::stringCompare($journalBudget, $search) || self::stringCompare($transactionBudget, $search);
|
||||
@ -186,11 +185,13 @@ class Modifier
|
||||
{
|
||||
$journalCategory = '';
|
||||
if (null !== $transaction->transaction_journal_category_name) {
|
||||
$journalCategory = Steam::decrypt((int)$transaction->transaction_journal_category_encrypted, $transaction->transaction_journal_category_name);
|
||||
$journalCategory = app('steam')->decrypt(
|
||||
(int)$transaction->transaction_journal_category_encrypted, $transaction->transaction_journal_category_name
|
||||
);
|
||||
}
|
||||
$transactionCategory = '';
|
||||
if (null !== $transaction->transaction_category_name) {
|
||||
$journalCategory = Steam::decrypt((int)$transaction->transaction_category_encrypted, $transaction->transaction_category_name);
|
||||
$journalCategory = app('steam')->decrypt((int)$transaction->transaction_category_encrypted, $transaction->transaction_category_name);
|
||||
}
|
||||
|
||||
return self::stringCompare($journalCategory, $search) || self::stringCompare($transactionCategory, $search);
|
||||
|
Loading…
Reference in New Issue
Block a user