mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Various code cleanup.
This commit is contained in:
@@ -156,7 +156,7 @@ class CreateController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
|
@@ -72,7 +72,7 @@ class DeleteController extends Controller
|
||||
public function delete(Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$typeName = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
|
||||
@@ -98,7 +98,7 @@ class DeleteController extends Controller
|
||||
public function destroy(Request $request, Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$type = $account->accountType->type;
|
||||
|
@@ -84,7 +84,7 @@ class EditController extends Controller
|
||||
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$objectType = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
||||
@@ -177,7 +177,7 @@ class EditController extends Controller
|
||||
public function update(AccountFormRequest $request, Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$data = $request->getAccountData();
|
||||
@@ -195,7 +195,7 @@ class EditController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
|
||||
// redirect
|
||||
|
@@ -91,14 +91,14 @@ class ReconcileController extends Controller
|
||||
public function reconcile(Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
if (AccountType::ASSET !== $account->accountType->type) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->flash('error', (string)trans('firefly.must_be_asset_account'));
|
||||
|
||||
return redirect(route('accounts.index', [config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type))]));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
$currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
|
||||
@@ -106,7 +106,7 @@ class ReconcileController extends Controller
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
|
||||
// get start and end
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
if (null === $start && null === $end) {
|
||||
|
||||
/** @var Carbon $start */
|
||||
@@ -118,7 +118,7 @@ class ReconcileController extends Controller
|
||||
/** @var Carbon $end */
|
||||
$end = app('navigation')->endOfPeriod($start, $range);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
if ($end->lt($start)) {
|
||||
[$start, $end] = [$end, $start];
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class ReconcileController extends Controller
|
||||
public function submit(ReconciliationStoreRequest $request, Account $account, Carbon $start, Carbon $end)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
Log::debug('In ReconcileController::submit()');
|
||||
@@ -217,7 +217,7 @@ class ReconcileController extends Controller
|
||||
private function createReconciliation(Account $account, Carbon $start, Carbon $end, string $difference)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$reconciliation = $this->accountRepos->getReconciliation($account);
|
||||
|
@@ -91,7 +91,7 @@ class ShowController extends Controller
|
||||
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
|
||||
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
/** @var Carbon $start */
|
||||
@@ -100,7 +100,7 @@ class ShowController extends Controller
|
||||
$end = $end ?? session('end');
|
||||
|
||||
if ($end < $start) {
|
||||
[$start, $end] = [$end, $start]; // @codeCoverageIgnore
|
||||
[$start, $end] = [$end, $start];
|
||||
}
|
||||
$location = $this->repository->getLocation($account);
|
||||
$attachments = $this->repository->getAttachments($account);
|
||||
@@ -164,7 +164,7 @@ class ShowController extends Controller
|
||||
public function showAll(Request $request, Account $account)
|
||||
{
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
$location = $this->repository->getLocation($account);
|
||||
$isLiability = $this->repository->isLiability($account);
|
||||
|
@@ -163,7 +163,7 @@ class LinkController extends Controller
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
if (true !== session('link-types.edit.fromUpdate')) {
|
||||
$this->rememberPreviousUri('link-types.edit.uri'); // @codeCoverageIgnore
|
||||
$this->rememberPreviousUri('link-types.edit.uri');
|
||||
}
|
||||
$request->session()->forget('link-types.edit.fromUpdate');
|
||||
|
||||
|
@@ -219,11 +219,11 @@ class UserController extends Controller
|
||||
app('preferences')->mark();
|
||||
$redirect = redirect($this->getPreviousUri('users.edit.uri'));
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('users.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('admin.users.edit', [$user->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
|
@@ -197,11 +197,11 @@ class AttachmentController extends Controller
|
||||
|
||||
$redirect = redirect($this->getPreviousUri('attachments.edit.uri'));
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->put('attachments.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('attachments.edit', [$attachment->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
|
@@ -72,14 +72,14 @@ class ForgotPasswordController extends Controller
|
||||
{
|
||||
Log::info('Start of sendResetLinkEmail()');
|
||||
$loginProvider = config('firefly.login_provider');
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
if ('eloquent' !== $loginProvider) {
|
||||
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);
|
||||
Log::error($message);
|
||||
|
||||
return prefixView('error', compact('message'));
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
$this->validateEmail($request);
|
||||
|
||||
@@ -102,7 +102,7 @@ class ForgotPasswordController extends Controller
|
||||
return back()->with('status', trans($response));
|
||||
}
|
||||
|
||||
return back()->withErrors(['email' => trans($response)]); // @codeCoverageIgnore
|
||||
return back()->withErrors(['email' => trans($response)]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -83,7 +83,7 @@ class LoginController extends Controller
|
||||
Log::info(sprintf('User is trying to login.'));
|
||||
if ('ldap' === config('auth.providers.users.driver')) {
|
||||
/** @var Adldap\Connections\Provider $provider */
|
||||
Adldap::getProvider('default');
|
||||
Adldap::getProvider('default'); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
$this->validateLogin($request);
|
||||
@@ -96,7 +96,7 @@ class LoginController extends Controller
|
||||
Log::channel('audit')->info(sprintf('Login for user "%s" was locked out.', $request->get('email')));
|
||||
$this->fireLockoutEvent($request);
|
||||
|
||||
return $this->sendLockoutResponse($request);
|
||||
$this->sendLockoutResponse($request);
|
||||
}
|
||||
|
||||
/** Copied directly from AuthenticatesUsers, but with logging added: */
|
||||
@@ -190,7 +190,7 @@ class LoginController extends Controller
|
||||
$loginProvider = config('firefly.login_provider');
|
||||
$title = (string)trans('firefly.login_page_title');
|
||||
if (0 === $count && 'eloquent' === $loginProvider) {
|
||||
return redirect(route('register')); // @codeCoverageIgnore
|
||||
return redirect(route('register'));
|
||||
}
|
||||
|
||||
// is allowed to?
|
||||
|
@@ -34,6 +34,7 @@ use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class CreateController
|
||||
@@ -124,7 +125,7 @@ class CreateController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
|
||||
return redirect(route('rules.create-from-bill', [$bill->id]));
|
||||
|
@@ -138,16 +138,16 @@ class EditController extends Controller
|
||||
|
||||
// flash messages
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
$redirect = redirect($this->getPreviousUri('bills.edit.uri'));
|
||||
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->put('bills.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('bills.edit', [$bill->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -168,7 +168,7 @@ class ShowController extends Controller
|
||||
$collection = $this->repository->getAttachments($bill);
|
||||
$attachments = new Collection;
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
/** @var AttachmentTransformer $transformer */
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
@@ -179,7 +179,7 @@ class ShowController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
return prefixView('bills.show', compact('attachments', 'groups', 'rules', 'yearAverage', 'overallAverage', 'year', 'object', 'bill', 'subTitle'));
|
||||
}
|
||||
|
||||
|
@@ -131,17 +131,17 @@ class CreateController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
|
||||
$redirect = redirect($this->getPreviousUri('budgets.create.uri'));
|
||||
|
||||
if (1 === (int)$request->get('create_another')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->put('budgets.create.fromStore', true);
|
||||
|
||||
$redirect = redirect(route('budgets.create'))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -144,15 +144,15 @@ class EditController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->put('budgets.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('budgets.edit', [$budget->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -219,7 +219,7 @@ class IndexController extends Controller
|
||||
/** @var TransactionCurrency $currency */
|
||||
foreach ($currencies as $currency) {
|
||||
$spentArr = $this->opsRepository->sumExpenses($start, $end, null, new Collection([$current]), $currency);
|
||||
if (isset($spentArr[$currency->id]['sum'])) {
|
||||
if (array_key_exists('sum', $spentArr[$currency->id])) {
|
||||
$array['spent'][$currency->id]['spent'] = $spentArr[$currency->id]['sum'];
|
||||
$array['spent'][$currency->id]['currency_id'] = $currency->id;
|
||||
$array['spent'][$currency->id]['currency_symbol'] = $currency->symbol;
|
||||
|
@@ -180,7 +180,7 @@ class ShowController extends Controller
|
||||
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
|
||||
{
|
||||
if ($budgetLimit->budget->id !== $budget->id) {
|
||||
throw new FireflyException('This budget limit is not part of this budget.'); // @codeCoverageIgnore
|
||||
throw new FireflyException('This budget limit is not part of this budget.');
|
||||
}
|
||||
|
||||
$page = (int)$request->get('page');
|
||||
|
@@ -105,16 +105,16 @@ class CreateController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
|
||||
$redirect = redirect(route('categories.index'));
|
||||
if (1 === (int)$request->get('create_another')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->put('categories.create.fromStore', true);
|
||||
|
||||
$redirect = redirect(route('categories.create'))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -115,16 +115,16 @@ class EditController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
$redirect = redirect($this->getPreviousUri('categories.edit.uri'));
|
||||
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->put('categories.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('categories.edit', [$category->id]));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -95,7 +95,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.account.expense-accounts');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$start->subDay();
|
||||
|
||||
@@ -203,7 +203,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.account.expense-budget');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -217,7 +217,7 @@ class AccountController extends Controller
|
||||
$budgetId = (int)$journal['budget_id'];
|
||||
$key = sprintf('%d-%d', $budgetId, $journal['currency_id']);
|
||||
$budgetIds[] = $budgetId;
|
||||
if (!isset($result[$key])) {
|
||||
if (!array_key_exists($key, $result)) {
|
||||
$result[$key] = [
|
||||
'total' => '0',
|
||||
'budget_id' => $budgetId,
|
||||
@@ -277,7 +277,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.account.expense-category');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
@@ -290,7 +290,7 @@ class AccountController extends Controller
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
|
||||
if (!isset($result[$key])) {
|
||||
if (!array_key_exists($key, $result)) {
|
||||
$result[$key] = [
|
||||
'total' => '0',
|
||||
'category_id' => (int)$journal['category_id'],
|
||||
@@ -373,7 +373,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.account.income-category');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
|
||||
// grab all journals:
|
||||
@@ -387,7 +387,7 @@ class AccountController extends Controller
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
|
||||
if (!isset($result[$key])) {
|
||||
if (!array_key_exists($key, $result)) {
|
||||
$result[$key] = [
|
||||
'total' => '0',
|
||||
'category_id' => $journal['category_id'],
|
||||
@@ -431,7 +431,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty($account->id);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$currencies = $this->accountRepository->getUsedCurrencies($account);
|
||||
|
||||
@@ -488,7 +488,7 @@ class AccountController extends Controller
|
||||
$current->addDay();
|
||||
}
|
||||
break;
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
case '1W':
|
||||
case '1M':
|
||||
case '1Y':
|
||||
@@ -499,7 +499,7 @@ class AccountController extends Controller
|
||||
$current = app('navigation')->addPeriod($current, $step, 0);
|
||||
}
|
||||
break;
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
$result['entries'] = $entries;
|
||||
|
||||
@@ -540,7 +540,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.account.revenue-accounts');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$start->subDay();
|
||||
|
||||
|
@@ -67,7 +67,7 @@ class BillController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.bill.frontpage');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
/** @var CurrencyRepositoryInterface $currencyRepository */
|
||||
$currencyRepository = app(CurrencyRepositoryInterface::class);
|
||||
@@ -109,7 +109,7 @@ class BillController extends Controller
|
||||
$cache->addProperty('chart.bill.single');
|
||||
$cache->addProperty($bill->id);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
|
||||
@@ -147,7 +147,7 @@ class BillController extends Controller
|
||||
$chartData[1]['entries'][$date] = $bill->amount_max; // maximum amount of bill
|
||||
|
||||
// append amount because there are more than one per moment:
|
||||
if (!isset($chartData[2]['entries'][$date])) {
|
||||
if (!array_key_exists($date, $chartData[2]['entries'])) {
|
||||
$chartData[2]['entries'][$date] = '0';
|
||||
}
|
||||
$amount = bcmul($journal['amount'], '-1');
|
||||
|
@@ -98,7 +98,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($budget->id);
|
||||
|
||||
if ($cache->has()) {
|
||||
//return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
//return response()->json($cache->get());
|
||||
}
|
||||
$step = $this->calculateStep($start, $end); // depending on diff, do something with range of chart.
|
||||
$collection = new Collection([$budget]);
|
||||
@@ -169,7 +169,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($budget->id);
|
||||
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
$entries = [];
|
||||
@@ -224,7 +224,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($end);
|
||||
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$collector->setRange($start, $end);
|
||||
$collector->setBudget($budget);
|
||||
@@ -291,7 +291,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($end);
|
||||
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$collector->setRange($start, $end);
|
||||
$collector->setBudget($budget)->withCategoryInformation();
|
||||
@@ -355,7 +355,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($end);
|
||||
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$collector->setRange($start, $end);
|
||||
$collector->setTypes([TransactionType::WITHDRAWAL])->setBudget($budget)->withAccountInformation();
|
||||
@@ -410,7 +410,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.budget.frontpage');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
|
||||
$chartGenerator = app(FrontpageChartGenerator::class);
|
||||
@@ -447,7 +447,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($currency->id);
|
||||
$cache->addProperty('chart.budget.period');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$titleFormat = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
|
||||
$preferredRange = app('navigation')->preferredRangeFormat($start, $end);
|
||||
@@ -521,7 +521,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($currency->id);
|
||||
$cache->addProperty('chart.budget.no-budget');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
|
||||
// the expenses:
|
||||
|
@@ -76,7 +76,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty('chart.category.all');
|
||||
$cache->addProperty($category->id);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
/** @var CategoryRepositoryInterface $repository */
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
@@ -102,8 +102,8 @@ class CategoryController extends Controller
|
||||
$carbon = null;
|
||||
try {
|
||||
$carbon = today(config('app.timezone'));
|
||||
} catch (Exception $e) {
|
||||
$e->getMessage();
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
|
||||
return $carbon;
|
||||
@@ -125,7 +125,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.category.frontpage');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
|
||||
$frontPageGenerator = new FrontpageChartGenerator($start, $end);
|
||||
@@ -156,7 +156,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
$cache->addProperty($category);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get());// @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$data = $this->reportPeriodChart($accounts, $start, $end, $category);
|
||||
|
||||
@@ -270,7 +270,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty('chart.category.period.no-cat');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$data = $this->reportPeriodChart($accounts, $start, $end, null);
|
||||
|
||||
@@ -294,7 +294,7 @@ class CategoryController extends Controller
|
||||
$start = app('navigation')->startOfPeriod($date, $range);
|
||||
$end = session()->get('end');
|
||||
if ($end < $start) {
|
||||
[$end, $start] = [$start, $end]; // @codeCoverageIgnore
|
||||
[$end, $start] = [$start, $end];
|
||||
}
|
||||
|
||||
$cache = new CacheProperties;
|
||||
@@ -303,7 +303,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty($category->id);
|
||||
$cache->addProperty('chart.category.period-chart');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
|
||||
/** @var WholePeriodChartGenerator $chartGenerator */
|
||||
|
@@ -88,7 +88,7 @@ class ExpenseReportController extends Controller
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
|
||||
$format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
|
||||
@@ -184,11 +184,11 @@ class ExpenseReportController extends Controller
|
||||
$newSet = [];
|
||||
foreach ($chartData as $key => $entry) {
|
||||
if (0 === !array_sum($entry['entries'])) {
|
||||
$newSet[$key] = $chartData[$key]; // @codeCoverageIgnore
|
||||
$newSet[$key] = $chartData[$key];
|
||||
}
|
||||
}
|
||||
if (empty($newSet)) {
|
||||
$newSet = $chartData; // @codeCoverageIgnore
|
||||
if (0===count($newSet)) {
|
||||
$newSet = $chartData;
|
||||
}
|
||||
$data = $this->generator->multiSet($newSet);
|
||||
$cache->store($data);
|
||||
|
@@ -73,7 +73,7 @@ class PiggyBankController extends Controller
|
||||
$cache->addProperty('chart.piggy-bank.history');
|
||||
$cache->addProperty($piggyBank->id);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$set = $repository->getEvents($piggyBank);
|
||||
$set = $set->reverse();
|
||||
|
@@ -78,7 +78,7 @@ class ReportController extends Controller
|
||||
$cache->addProperty(implode(',', $accounts->pluck('id')->toArray()));
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
$current = clone $start;
|
||||
@@ -113,7 +113,7 @@ class ReportController extends Controller
|
||||
foreach ($result as $netWorthItem) {
|
||||
$currencyId = $netWorthItem['currency']->id;
|
||||
$label = $current->formatLocalized((string)trans('config.month_and_day', [], $locale));
|
||||
if (!isset($chartData[$currencyId])) {
|
||||
if (!array_key_exists($currencyId, $chartData)) {
|
||||
$chartData[$currencyId] = [
|
||||
'label' => 'Net worth in ' . $netWorthItem['currency']->name,
|
||||
'type' => 'line',
|
||||
@@ -152,7 +152,7 @@ class ReportController extends Controller
|
||||
$cache->addProperty($accounts);
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
Log::debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
|
||||
$format = app('navigation')->preferredCarbonFormat($start, $end);
|
||||
|
@@ -66,7 +66,7 @@ class TransactionController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.transactions.budgets');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -111,7 +111,7 @@ class TransactionController extends Controller
|
||||
$cache->addProperty($objectType);
|
||||
$cache->addProperty('chart.transactions.categories');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -169,7 +169,7 @@ class TransactionController extends Controller
|
||||
$cache->addProperty($objectType);
|
||||
$cache->addProperty('chart.transactions.destinations');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -226,7 +226,7 @@ class TransactionController extends Controller
|
||||
$cache->addProperty($objectType);
|
||||
$cache->addProperty('chart.transactions.sources');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
|
@@ -130,12 +130,12 @@ class CurrencyController extends Controller
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
if (!$this->userRepository->hasRole($user, 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));
|
||||
Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but is not site owner.', $currency->code));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
if ($this->repository->currencyInUse($currency)) {
|
||||
@@ -168,12 +168,12 @@ class CurrencyController extends Controller
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
if (!$this->userRepository->hasRole($user, 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));
|
||||
Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
if ($this->repository->currencyInUse($currency)) {
|
||||
@@ -212,12 +212,12 @@ class CurrencyController extends Controller
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
if (!$this->userRepository->hasRole($user, 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));
|
||||
Log::channel('audit')->info(sprintf('Tried to disable currency %s but is not site owner.', $currency->code));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
if ($this->repository->currencyInUse($currency)) {
|
||||
@@ -268,12 +268,12 @@ class CurrencyController extends Controller
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
if (!$this->userRepository->hasRole($user, 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));
|
||||
Log::channel('audit')->info(sprintf('Tried to edit currency %s but is not owner.', $currency->code));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
$subTitleIcon = 'fa-pencil';
|
||||
@@ -355,12 +355,12 @@ class CurrencyController extends Controller
|
||||
$user = auth()->user();
|
||||
$data = $request->getCurrencyData();
|
||||
if (!$this->userRepository->hasRole($user, 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
Log::error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.');
|
||||
Log::channel('audit')->info('Tried to create (POST) currency without admin rights.', $data);
|
||||
|
||||
return redirect($this->getPreviousUri('currencies.create.uri'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
$data['enabled'] = true;
|
||||
@@ -378,11 +378,11 @@ class CurrencyController extends Controller
|
||||
$request->session()->flash('success', (string) trans('firefly.created_currency', ['name' => $currency->name]));
|
||||
Log::channel('audit')->info('Created (POST) currency.', $data);
|
||||
if (1 === (int) $request->get('create_another')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->put('currencies.create.fromStore', true);
|
||||
|
||||
$redirect = redirect(route('currencies.create'))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,12 +406,12 @@ class CurrencyController extends Controller
|
||||
$data['enabled'] = true;
|
||||
}
|
||||
if (!$this->userRepository->hasRole($user, 'owner')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));
|
||||
Log::channel('audit')->info('Tried to update (POST) currency without admin rights.', $data);
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
$currency = $this->repository->update($currency, $data);
|
||||
Log::channel('audit')->info('Updated (POST) currency.', $data);
|
||||
@@ -419,11 +419,11 @@ class CurrencyController extends Controller
|
||||
app('preferences')->mark();
|
||||
|
||||
if (1 === (int) $request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$request->session()->put('currencies.edit.fromUpdate', true);
|
||||
|
||||
return redirect(route('currencies.edit', [$currency->id]));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return redirect($this->getPreviousUri('currencies.edit.uri'));
|
||||
|
@@ -98,12 +98,11 @@ class DebugController extends Controller
|
||||
Log::debug('Call twig:clean...');
|
||||
try {
|
||||
Artisan::call('twig:clean');
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Exception $e) {
|
||||
// don't care
|
||||
Log::debug(sprintf('Called twig:clean: %s', $e->getMessage()));
|
||||
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
Log::debug('Call view:clear...');
|
||||
Artisan::call('view:clear');
|
||||
Log::debug('Done! Redirecting...');
|
||||
@@ -179,12 +178,11 @@ class DebugController extends Controller
|
||||
if (null !== $logFile) {
|
||||
try {
|
||||
$logContent = file_get_contents($logFile);
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Exception $e) {
|
||||
// don't care
|
||||
Log::debug(sprintf('Could not read log file. %s', $e->getMessage()));
|
||||
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
// @ignoreException
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,6 @@ use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\View\View;
|
||||
use Log;
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* Class HomeController.
|
||||
@@ -108,8 +107,8 @@ class HomeController extends Controller
|
||||
*/
|
||||
public function index(AccountRepositoryInterface $repository)
|
||||
{
|
||||
$types = config('firefly.accountTypesByIdentifier.asset');
|
||||
$count = $repository->count($types);
|
||||
$types = config('firefly.accountTypesByIdentifier.asset');
|
||||
$count = $repository->count($types);
|
||||
Log::channel('audit')->info('User visits homepage.');
|
||||
|
||||
if (0 === $count) {
|
||||
|
@@ -72,7 +72,7 @@ class BoxController extends Controller
|
||||
$cache->addProperty($today);
|
||||
$cache->addProperty('box-available');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$leftPerDayAmount = '0';
|
||||
$leftToSpendAmount = '0';
|
||||
@@ -142,7 +142,7 @@ class BoxController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('box-balance');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
// prep some arrays:
|
||||
$incomes = [];
|
||||
@@ -189,7 +189,7 @@ class BoxController extends Controller
|
||||
$incomes[$currencyId] = app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false);
|
||||
$expenses[$currencyId] = app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false);
|
||||
}
|
||||
if (empty($sums)) {
|
||||
if (0===count($sums)) {
|
||||
$currency = app('amount')->getDefaultCurrency();
|
||||
$sums[$currency->id] = app('amount')->formatAnything($currency, '0', false);
|
||||
$incomes[$currency->id] = app('amount')->formatAnything($currency, '0', false);
|
||||
|
@@ -64,15 +64,15 @@ class FrontpageController extends Controller
|
||||
}
|
||||
}
|
||||
$html = '';
|
||||
if (!empty($info)) {
|
||||
if (0!==count($info)) {
|
||||
try {
|
||||
$html = prefixView('json.piggy-banks', compact('info'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
|
||||
$html = 'Could not render view.';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return response()->json(['html' => $html]);
|
||||
|
@@ -54,7 +54,7 @@ class IntroController extends Controller
|
||||
return response()->json($steps);
|
||||
}
|
||||
if ($this->hasOutroStep($route)) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
// save last step:
|
||||
$lastStep = $steps[count($steps) - 1];
|
||||
// remove last step:
|
||||
@@ -62,7 +62,7 @@ class IntroController extends Controller
|
||||
// merge arrays and add last step again
|
||||
$steps = array_merge($steps, $specificSteps);
|
||||
$steps[] = $lastStep;
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
if (!$this->hasOutroStep($route)) {
|
||||
$steps = array_merge($steps, $specificSteps);
|
||||
|
@@ -153,12 +153,12 @@ class ReconcileController extends Controller
|
||||
'selectedIds'
|
||||
)
|
||||
)->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('View error: %s', $e->getMessage()));
|
||||
$view = sprintf('Could not render accounts.reconcile.overview: %s', $e->getMessage());
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
$return = [
|
||||
'post_uri' => $route,
|
||||
'html' => $view,
|
||||
@@ -181,7 +181,7 @@ class ReconcileController extends Controller
|
||||
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.
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
if ($account->id === $journal['source_account_id']) {
|
||||
if ($currency->id === $journal['currency_id']) {
|
||||
$toAdd = $journal['amount'];
|
||||
@@ -198,7 +198,7 @@ class ReconcileController extends Controller
|
||||
$toAdd = bcmul($journal['foreign_amount'], '-1');
|
||||
}
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
Log::debug(sprintf('Going to add %s to %s', $toAdd, $amount));
|
||||
$amount = bcadd($amount, $toAdd);
|
||||
@@ -250,13 +250,13 @@ class ReconcileController extends Controller
|
||||
'accounts.reconcile.transactions',
|
||||
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
|
||||
)->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render: %s', $e->getMessage()));
|
||||
$html = sprintf('Could not render accounts.reconcile.transactions: %s', $e->getMessage());
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
return response()->json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]);
|
||||
}
|
||||
@@ -275,7 +275,7 @@ class ReconcileController extends Controller
|
||||
/** @var array $journal */
|
||||
foreach ($array as $journal) {
|
||||
$inverse = false;
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
if (TransactionType::DEPOSIT === $journal['transaction_type_type']) {
|
||||
$inverse = true;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ class ReconcileController extends Controller
|
||||
$journal['foreign_amount'] = app('steam')->positive($journal['foreign_amount']);
|
||||
}
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
$journals[] = $journal;
|
||||
}
|
||||
|
@@ -51,13 +51,13 @@ class RuleController extends Controller
|
||||
}
|
||||
try {
|
||||
$view = prefixView('rules.partials.action', compact('actions', 'count'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
|
||||
$view = 'Could not render view.';
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
return response()->json(['html' => $view]);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class RuleController extends Controller
|
||||
|
||||
try {
|
||||
$view = prefixView('rules.partials.trigger', compact('triggers', 'count'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
|
||||
$view = 'Could not render view.';
|
||||
}
|
||||
|
@@ -92,11 +92,11 @@ class EditController extends Controller
|
||||
$redirect = redirect($this->getPreviousUri('object-groups.edit.uri'));
|
||||
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('object-groups.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('object-groups.edit', [$piggyBank->id]));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -111,16 +111,16 @@ class CreateController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
$redirect = redirect($this->getPreviousUri('piggy-banks.create.uri'));
|
||||
|
||||
if (1 === (int)$request->get('create_another')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('piggy-banks.create.fromStore', true);
|
||||
|
||||
$redirect = redirect(route('piggy-banks.create'))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -132,16 +132,16 @@ class EditController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
$redirect = redirect($this->getPreviousUri('piggy-banks.edit.uri'));
|
||||
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('piggy-banks.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('piggy-banks.edit', [$piggyBank->id]));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -112,7 +112,7 @@ class IndexController extends Controller
|
||||
$account = $accountTransformer->transform($piggy->account);
|
||||
$accountId = (int)$account['id'];
|
||||
$array['attachments'] = $this->piggyRepos->getAttachments($piggy);
|
||||
if (!isset($accounts[$accountId])) {
|
||||
if (!array_key_exists($accountId, $accounts)) {
|
||||
// create new:
|
||||
$accounts[$accountId] = $account;
|
||||
|
||||
|
@@ -32,6 +32,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
use JsonException;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class PreferencesController.
|
||||
@@ -198,18 +199,18 @@ class PreferencesController extends Controller
|
||||
// optional fields for transactions:
|
||||
$setOptions = $request->get('tj');
|
||||
$optionalTj = [
|
||||
'interest_date' => isset($setOptions['interest_date']),
|
||||
'book_date' => isset($setOptions['book_date']),
|
||||
'process_date' => isset($setOptions['process_date']),
|
||||
'due_date' => isset($setOptions['due_date']),
|
||||
'payment_date' => isset($setOptions['payment_date']),
|
||||
'invoice_date' => isset($setOptions['invoice_date']),
|
||||
'internal_reference' => isset($setOptions['internal_reference']),
|
||||
'notes' => isset($setOptions['notes']),
|
||||
'attachments' => isset($setOptions['attachments']),
|
||||
'external_uri' => isset($setOptions['external_uri']),
|
||||
'location' => isset($setOptions['location']),
|
||||
'links' => isset($setOptions['links']),
|
||||
'interest_date' => array_key_exists('interest_date', $setOptions),
|
||||
'book_date' => array_key_exists('book_date', $setOptions),
|
||||
'process_date' => array_key_exists('process_date', $setOptions),
|
||||
'due_date' => array_key_exists('due_date', $setOptions),
|
||||
'payment_date' => array_key_exists('payment_date', $setOptions),
|
||||
'invoice_date' => array_key_exists('invoice_date', $setOptions),
|
||||
'internal_reference' => array_key_exists('internal_reference', $setOptions),
|
||||
'notes' => array_key_exists('notes', $setOptions),
|
||||
'attachments' => array_key_exists('attachments', $setOptions),
|
||||
'external_uri' => array_key_exists('external_uri', $setOptions),
|
||||
'location' => array_key_exists('location', $setOptions),
|
||||
'links' => array_key_exists('links', $setOptions),
|
||||
];
|
||||
app('preferences')->set('transaction_journal_optional_fields', $optionalTj);
|
||||
|
||||
|
@@ -241,9 +241,9 @@ class ProfileController extends Controller
|
||||
public function confirmEmailChange(UserRepositoryInterface $repository, string $token)
|
||||
{
|
||||
if (!$this->internalAuth || !$this->internalIdentity) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
throw new FireflyException(trans('firefly.external_user_mgt_disabled'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
// find preference with this token value.
|
||||
/** @var Collection $set */
|
||||
|
@@ -240,7 +240,7 @@ class CreateController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
|
||||
$redirect = redirect($this->getPreviousUri('recurring.create.uri'));
|
||||
|
@@ -103,7 +103,7 @@ class EditController extends Controller
|
||||
$repetition = $recurrence->recurrenceRepetitions()->first();
|
||||
$currentRepType = $repetition->repetition_type;
|
||||
if ('' !== $repetition->repetition_moment) {
|
||||
$currentRepType .= ',' . $repetition->repetition_moment; // @codeCoverageIgnore
|
||||
$currentRepType .= ',' . $repetition->repetition_moment;
|
||||
}
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
@@ -119,10 +119,10 @@ class EditController extends Controller
|
||||
'times' => (string)trans('firefly.repeat_times'),
|
||||
];
|
||||
if (null !== $recurrence->repeat_until) {
|
||||
$repetitionEnd = 'until_date'; // @codeCoverageIgnore
|
||||
$repetitionEnd = 'until_date';
|
||||
}
|
||||
if ($recurrence->repetitions > 0) {
|
||||
$repetitionEnd = 'times'; // @codeCoverageIgnore
|
||||
$repetitionEnd = 'times';
|
||||
}
|
||||
|
||||
$weekendResponses = [
|
||||
@@ -177,7 +177,7 @@ class EditController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
|
||||
}
|
||||
app('preferences')->mark();
|
||||
$redirect = redirect($this->getPreviousUri('recurrences.edit.uri'));
|
||||
|
@@ -55,7 +55,7 @@ class AccountController extends Controller
|
||||
$cache->addProperty('account-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
/** @var AccountTaskerInterface $accountTasker */
|
||||
@@ -63,12 +63,12 @@ class AccountController extends Controller
|
||||
$accountReport = $accountTasker->getAccountReport($accounts, $start, $end);
|
||||
try {
|
||||
$result = prefixView('reports.partials.accounts', compact('accountReport'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.accounts: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
@@ -137,8 +137,8 @@ class BalanceController extends Controller
|
||||
}
|
||||
try {
|
||||
$result = prefixView('reports.partials.balance', compact('report'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.balance: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
|
@@ -49,19 +49,19 @@ class BillController extends Controller
|
||||
$cache->addProperty('bill-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
return $cache->get();
|
||||
}
|
||||
/** @var ReportHelperInterface $helper */
|
||||
$helper = app(ReportHelperInterface::class);
|
||||
$report = $helper->getBillReport($accounts, $start, $end);
|
||||
try {
|
||||
$result = prefixView('reports.partials.bills', compact('report'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budgets: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
@@ -197,8 +197,8 @@ class BudgetController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.budget.partials.avg-expenses', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -316,7 +316,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty('budget-period-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
$periods = app('navigation')->listOfPeriods($start, $end);
|
||||
@@ -352,12 +352,12 @@ class BudgetController extends Controller
|
||||
}
|
||||
try {
|
||||
$result = prefixView('reports.partials.budget-period', compact('report', 'periods'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
@@ -404,8 +404,8 @@ class BudgetController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.budget.partials.top-expenses', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
|
@@ -311,8 +311,8 @@ class CategoryController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.category.partials.avg-expenses', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -363,8 +363,8 @@ class CategoryController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.category.partials.avg-income', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -497,7 +497,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty('category-period-expenses-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
// depending on the carbon format (a reliable way to determine the general date difference)
|
||||
@@ -547,12 +547,12 @@ class CategoryController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.partials.category-period', compact('report', 'periods'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
||||
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
$cache->store($result);
|
||||
|
||||
@@ -577,7 +577,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty('category-period-income-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
// depending on the carbon format (a reliable way to determine the general date difference)
|
||||
@@ -626,12 +626,12 @@ class CategoryController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.partials.category-period', compact('report', 'periods'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
||||
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
$cache->store($result);
|
||||
|
||||
@@ -657,7 +657,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty('category-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
/** @var CategoryReportGenerator $generator */
|
||||
@@ -668,16 +668,16 @@ class CategoryController extends Controller
|
||||
$generator->operations();
|
||||
$report = $generator->getReport();
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.partials.categories', compact('report'))->render();
|
||||
$cache->store($result);
|
||||
} catch (Throwable $e) {
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
||||
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -723,8 +723,8 @@ class CategoryController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.category.partials.top-expenses', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -773,8 +773,8 @@ class CategoryController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.category.partials.top-income', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
|
@@ -111,8 +111,8 @@ class DoubleController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.double.partials.avg-expenses', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -163,8 +163,8 @@ class DoubleController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.double.partials.avg-income', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -457,8 +457,8 @@ class DoubleController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.double.partials.top-expenses', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -507,8 +507,8 @@ class DoubleController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.double.partials.top-income', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
|
@@ -76,18 +76,18 @@ class OperationsController extends Controller
|
||||
$cache->addProperty('expense-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
return $cache->get();
|
||||
}
|
||||
$report = $this->tasker->getExpenseReport($start, $end, $accounts);
|
||||
$type = 'expense-entry';
|
||||
try {
|
||||
$result = prefixView('reports.partials.income-expenses', compact('report', 'type'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.income-expense: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
@@ -111,18 +111,18 @@ class OperationsController extends Controller
|
||||
$cache->addProperty('income-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
return $cache->get();
|
||||
}
|
||||
$report = $this->tasker->getIncomeReport($start, $end, $accounts);
|
||||
$type = 'income-entry';
|
||||
try {
|
||||
$result = prefixView('reports.partials.income-expenses', compact('report', 'type'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.income-expenses: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
@@ -146,7 +146,7 @@ class OperationsController extends Controller
|
||||
$cache->addProperty('inc-exp-report');
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
$incomes = $this->tasker->getIncomeReport($start, $end, $accounts);
|
||||
@@ -172,7 +172,7 @@ class OperationsController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.partials.operations', compact('sums'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.operations: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
}
|
||||
|
@@ -305,8 +305,8 @@ class TagController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.tag.partials.avg-expenses', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -357,8 +357,8 @@ class TagController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.tag.partials.avg-income', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -515,8 +515,8 @@ class TagController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.tag.partials.top-expenses', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
@@ -565,8 +565,8 @@ class TagController extends Controller
|
||||
|
||||
try {
|
||||
$result = prefixView('reports.tag.partials.top-income', compact('result'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ class ReportController extends Controller
|
||||
public function auditReport(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
if ($end < $start) {
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date'));
|
||||
}
|
||||
$this->repository->cleanupBudgets();
|
||||
|
||||
@@ -124,7 +124,7 @@ class ReportController extends Controller
|
||||
public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
|
||||
{
|
||||
if ($end < $start) {
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date'));
|
||||
}
|
||||
$this->repository->cleanupBudgets();
|
||||
|
||||
@@ -161,7 +161,7 @@ class ReportController extends Controller
|
||||
public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
|
||||
{
|
||||
if ($end < $start) {
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date'));
|
||||
}
|
||||
$this->repository->cleanupBudgets();
|
||||
|
||||
@@ -421,7 +421,7 @@ class ReportController extends Controller
|
||||
public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
|
||||
{
|
||||
if ($end < $start) {
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date'));
|
||||
}
|
||||
$this->repository->cleanupBudgets();
|
||||
|
||||
|
@@ -267,21 +267,21 @@ class CreateController extends Controller
|
||||
|
||||
// redirect to show bill.
|
||||
if ('true' === $request->get('return_to_bill') && (int)$request->get('bill_id') > 0) {
|
||||
return redirect(route('bills.show', [(int)$request->get('bill_id')])); // @codeCoverageIgnore
|
||||
return redirect(route('bills.show', [(int)$request->get('bill_id')]));
|
||||
}
|
||||
|
||||
// redirect to new bill creation.
|
||||
if ((int)$request->get('bill_id') > 0) {
|
||||
return redirect($this->getPreviousUri('bills.create.uri')); // @codeCoverageIgnore
|
||||
return redirect($this->getPreviousUri('bills.create.uri'));
|
||||
}
|
||||
|
||||
$redirect = redirect($this->getPreviousUri('rules.create.uri'));
|
||||
|
||||
if (1 === (int)$request->get('create_another')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('rules.create.fromStore', true);
|
||||
$redirect = redirect(route('rules.create', [$data['rule_group_id']]))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -168,7 +168,7 @@ class EditController extends Controller
|
||||
'triggers' => $triggers,
|
||||
]
|
||||
)->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
|
||||
Log::error($e->getTraceAsString());
|
||||
}
|
||||
@@ -195,11 +195,11 @@ class EditController extends Controller
|
||||
app('preferences')->mark();
|
||||
$redirect = redirect($this->getPreviousUri('rules.edit.uri'));
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('rules.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('rules.edit', [$rule->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -145,7 +145,7 @@ class SelectController extends Controller
|
||||
|
||||
// warn if nothing.
|
||||
if (0 === count($textTriggers)) {
|
||||
return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
|
||||
return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]);
|
||||
}
|
||||
|
||||
foreach ($textTriggers as $textTrigger) {
|
||||
@@ -168,21 +168,21 @@ class SelectController extends Controller
|
||||
// Warn the user if only a subset of transactions is returned
|
||||
$warning = '';
|
||||
if (0 === count($collection)) {
|
||||
$warning = (string)trans('firefly.warning_no_matching_transactions'); // @codeCoverageIgnore
|
||||
$warning = (string)trans('firefly.warning_no_matching_transactions');
|
||||
}
|
||||
|
||||
// Return json response
|
||||
$view = 'ERROR, see logs.';
|
||||
try {
|
||||
$view = prefixView('list.journals-array-tiny', ['groups' => $collection])->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $exception) {
|
||||
|
||||
} catch (Throwable $exception) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Could not render view in testTriggers(): %s', $exception->getMessage()));
|
||||
Log::error($exception->getTraceAsString());
|
||||
$view = sprintf('Could not render list.journals-tiny: %s', $exception->getMessage());
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
return response()->json(['html' => $view, 'warning' => $warning]);
|
||||
}
|
||||
@@ -201,7 +201,7 @@ class SelectController extends Controller
|
||||
$triggers = $rule->ruleTriggers;
|
||||
|
||||
if (0 === count($triggers)) {
|
||||
return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
|
||||
return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]);
|
||||
}
|
||||
// create new rule engine:
|
||||
$newRuleEngine = app(RuleEngineInterface::class);
|
||||
@@ -213,20 +213,20 @@ class SelectController extends Controller
|
||||
|
||||
$warning = '';
|
||||
if (0 === count($collection)) {
|
||||
$warning = (string)trans('firefly.warning_no_matching_transactions'); // @codeCoverageIgnore
|
||||
$warning = (string)trans('firefly.warning_no_matching_transactions');
|
||||
}
|
||||
|
||||
// Return json response
|
||||
$view = 'ERROR, see logs.';
|
||||
try {
|
||||
$view = prefixView('list.journals-array-tiny', ['groups' => $collection])->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $exception) {
|
||||
|
||||
} catch (Throwable $exception) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Could not render view in testTriggersByRule(): %s', $exception->getMessage()));
|
||||
Log::error($exception->getTraceAsString());
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
return response()->json(['html' => $view, 'warning' => $warning]);
|
||||
}
|
||||
|
@@ -96,11 +96,11 @@ class CreateController extends Controller
|
||||
|
||||
$redirect = redirect($this->getPreviousUri('rule-groups.create.uri'));
|
||||
if (1 === (int)$request->get('create_another')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('rule-groups.create.fromStore', true);
|
||||
|
||||
$redirect = redirect(route('rule-groups.create'))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
|
@@ -147,11 +147,11 @@ class EditController extends Controller
|
||||
app('preferences')->mark();
|
||||
$redirect = redirect($this->getPreviousUri('rule-groups.edit.uri'));
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('rule-groups.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('rule-groups.edit', [$ruleGroup->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
|
@@ -116,13 +116,13 @@ class SearchController extends Controller
|
||||
|
||||
try {
|
||||
$html = prefixView('search.search', compact('groups', 'hasPages', 'searchTime'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Cannot render search.search: %s', $e->getMessage()));
|
||||
$html = 'Could not render view.';
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
return response()->json(['count' => $groups->count(), 'html' => $html]);
|
||||
}
|
||||
|
@@ -193,7 +193,7 @@ class InstallController extends Controller
|
||||
Artisan::call($command, $args);
|
||||
Log::debug(Artisan::output());
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
if (strpos($e->getMessage(), 'open_basedir restriction in effect')) {
|
||||
|
@@ -327,15 +327,15 @@ class TagController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachmentsHelper->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachmentsHelper->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachmentsHelper->getMessages()->get('attachments'));
|
||||
}
|
||||
$redirect = redirect($this->getPreviousUri('tags.create.uri'));
|
||||
if (1 === (int)$request->get('create_another')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('tags.create.fromStore', true);
|
||||
|
||||
$redirect = redirect(route('tags.create'))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
return $redirect;
|
||||
@@ -368,15 +368,15 @@ class TagController extends Controller
|
||||
}
|
||||
|
||||
if (count($this->attachmentsHelper->getMessages()->get('attachments')) > 0) {
|
||||
$request->session()->flash('info', $this->attachmentsHelper->getMessages()->get('attachments')); // @codeCoverageIgnore
|
||||
$request->session()->flash('info', $this->attachmentsHelper->getMessages()->get('attachments'));
|
||||
}
|
||||
$redirect = redirect($this->getPreviousUri('tags.edit.uri'));
|
||||
if (1 === (int)$request->get('return_to_edit')) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
session()->put('tags.edit.fromUpdate', true);
|
||||
|
||||
$redirect = redirect(route('tags.edit', [$tag->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
|
@@ -91,7 +91,7 @@ class ConvertController extends Controller
|
||||
public function index(TransactionType $destinationType, TransactionGroup $group)
|
||||
{
|
||||
if (!$this->isEditableGroup($group)) {
|
||||
return $this->redirectGroupToAccount($group); // @codeCoverageIgnore
|
||||
return $this->redirectGroupToAccount($group);
|
||||
}
|
||||
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
@@ -159,21 +159,21 @@ class ConvertController extends Controller
|
||||
$role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
|
||||
$name = $account->name;
|
||||
if ('' === $role) {
|
||||
$role = 'no_account_type'; // @codeCoverageIgnore
|
||||
$role = 'no_account_type';
|
||||
}
|
||||
|
||||
// maybe it's a liability thing:
|
||||
if (in_array($account->accountType->type, $liabilityTypes, true)) {
|
||||
$role = 'l_' . $account->accountType->type; // @codeCoverageIgnore
|
||||
$role = 'l_' . $account->accountType->type;
|
||||
}
|
||||
if (AccountType::CASH === $account->accountType->type) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$role = 'cash_account';
|
||||
$name = sprintf('(%s)', trans('firefly.cash'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
if (AccountType::REVENUE === $account->accountType->type) {
|
||||
$role = 'revenue_account'; // @codeCoverageIgnore
|
||||
$role = 'revenue_account';
|
||||
}
|
||||
|
||||
$key = (string)trans('firefly.opt_group_' . $role);
|
||||
@@ -200,21 +200,21 @@ class ConvertController extends Controller
|
||||
$role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
|
||||
$name = $account->name;
|
||||
if ('' === $role) {
|
||||
$role = 'no_account_type'; // @codeCoverageIgnore
|
||||
$role = 'no_account_type';
|
||||
}
|
||||
|
||||
// maybe it's a liability thing:
|
||||
if (in_array($account->accountType->type, $liabilityTypes, true)) {
|
||||
$role = 'l_' . $account->accountType->type; // @codeCoverageIgnore
|
||||
$role = 'l_' . $account->accountType->type;
|
||||
}
|
||||
if (AccountType::CASH === $account->accountType->type) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
$role = 'cash_account';
|
||||
$name = sprintf('(%s)', trans('firefly.cash'));
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
if (AccountType::EXPENSE === $account->accountType->type) {
|
||||
$role = 'expense_account'; // @codeCoverageIgnore
|
||||
$role = 'expense_account';
|
||||
}
|
||||
|
||||
$key = (string)trans('firefly.opt_group_' . $role);
|
||||
@@ -264,7 +264,7 @@ class ConvertController extends Controller
|
||||
$currency = $this->accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
|
||||
$role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
|
||||
if ('' === $role) {
|
||||
$role = 'no_account_type'; // @codeCoverageIgnore
|
||||
$role = 'no_account_type';
|
||||
}
|
||||
|
||||
$key = (string)trans('firefly.opt_group_' . $role);
|
||||
@@ -288,7 +288,7 @@ class ConvertController extends Controller
|
||||
public function postIndex(Request $request, TransactionType $destinationType, TransactionGroup $group)
|
||||
{
|
||||
if (!$this->isEditableGroup($group)) {
|
||||
return $this->redirectGroupToAccount($group); // @codeCoverageIgnore
|
||||
return $this->redirectGroupToAccount($group);
|
||||
}
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
|
@@ -72,7 +72,7 @@ class DeleteController extends Controller
|
||||
public function delete(TransactionGroup $group)
|
||||
{
|
||||
if (!$this->isEditableGroup($group)) {
|
||||
return $this->redirectGroupToAccount($group); // @codeCoverageIgnore
|
||||
return $this->redirectGroupToAccount($group);
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Start of delete view for group #%d', $group->id));
|
||||
@@ -101,7 +101,7 @@ class DeleteController extends Controller
|
||||
public function destroy(TransactionGroup $group): RedirectResponse
|
||||
{
|
||||
if (!$this->isEditableGroup($group)) {
|
||||
return $this->redirectGroupToAccount($group); // @codeCoverageIgnore
|
||||
return $this->redirectGroupToAccount($group);
|
||||
}
|
||||
|
||||
$journal = $group->transactionJournals->first();
|
||||
|
@@ -67,7 +67,7 @@ class EditController extends Controller
|
||||
app('preferences')->mark();
|
||||
|
||||
if (!$this->isEditableGroup($transactionGroup)) {
|
||||
return $this->redirectGroupToAccount($transactionGroup); // @codeCoverageIgnore
|
||||
return $this->redirectGroupToAccount($transactionGroup);
|
||||
}
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
|
@@ -168,7 +168,7 @@ class MassController extends Controller
|
||||
$journalIds = $request->get('journals');
|
||||
if (!is_array($journalIds)) {
|
||||
// TODO something error.
|
||||
throw new FireflyException('This is not an array.'); // @codeCoverageIgnore
|
||||
throw new FireflyException('This is not an array.');
|
||||
}
|
||||
$count = 0;
|
||||
/** @var string $journalId */
|
||||
@@ -177,8 +177,8 @@ class MassController extends Controller
|
||||
try {
|
||||
$this->updateJournal($integer, $request);
|
||||
$count++;
|
||||
} catch (FireflyException $e) { // @codeCoverageIgnore
|
||||
// do something with error.
|
||||
} catch (FireflyException $e) {
|
||||
// @ignoreException
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ class MassController extends Controller
|
||||
{
|
||||
$journal = $this->repository->findNull($journalId);
|
||||
if (null === $journal) {
|
||||
throw new FireflyException(sprintf('Trying to edit non-existent or deleted journal #%d', $journalId)); // @codeCoverageIgnore
|
||||
throw new FireflyException(sprintf('Trying to edit non-existent or deleted journal #%d', $journalId));
|
||||
}
|
||||
$service = app(JournalUpdateService::class);
|
||||
// for each field, call the update service.
|
||||
@@ -240,7 +240,7 @@ class MassController extends Controller
|
||||
if (!is_array($value)) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($value[$journalId])) {
|
||||
if (!array_key_exists($journalId, $value)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
@@ -268,7 +268,7 @@ class MassController extends Controller
|
||||
if (!is_array($value)) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($value[$journalId])) {
|
||||
if (!array_key_exists($journalId, $value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ class MassController extends Controller
|
||||
if (!is_array($value)) {
|
||||
return null;
|
||||
}
|
||||
if (!isset($value[$journalId])) {
|
||||
if (!array_key_exists($journalId, $value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -137,7 +137,7 @@ class ShowController extends Controller
|
||||
$amounts = [];
|
||||
foreach ($group['transactions'] as $transaction) {
|
||||
$symbol = $transaction['currency_symbol'];
|
||||
if (!isset($amounts[$symbol])) {
|
||||
if (!array_key_exists($symbol, $amounts)) {
|
||||
$amounts[$symbol] = [
|
||||
'amount' => '0',
|
||||
'symbol' => $symbol,
|
||||
@@ -148,7 +148,7 @@ class ShowController extends Controller
|
||||
if (null !== $transaction['foreign_amount']) {
|
||||
// same for foreign currency:
|
||||
$foreignSymbol = $transaction['foreign_currency_symbol'];
|
||||
if (!isset($amounts[$foreignSymbol])) {
|
||||
if (!array_key_exists($foreignSymbol, $amounts)) {
|
||||
$amounts[$foreignSymbol] = [
|
||||
'amount' => '0',
|
||||
'symbol' => $foreignSymbol,
|
||||
|
@@ -87,7 +87,7 @@ class Authenticate
|
||||
protected function authenticate($request, array $guards)
|
||||
{
|
||||
|
||||
if (empty($guards)) {
|
||||
if (0 === count($guards)) {
|
||||
try {
|
||||
// go for default guard:
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
@@ -109,21 +109,21 @@ class Authenticate
|
||||
}
|
||||
}
|
||||
} catch (QueryException $e) {
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
throw new FireflyException(
|
||||
sprintf(
|
||||
'It seems the database has not yet been initialized. Did you run the correct upgrade or installation commands? Error: %s',
|
||||
$e->getMessage()
|
||||
)
|
||||
), 0, $e
|
||||
);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
return $this->auth->authenticate();
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if ($this->auth->guard($guard)->check()) {
|
||||
/** @noinspection PhpVoidFunctionResultUsedInspection */
|
||||
@@ -132,6 +132,6 @@ class Authenticate
|
||||
}
|
||||
|
||||
throw new AuthenticationException('Unauthenticated.', $guards);
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,6 @@ class Binder
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/** @noinspection PhpUnusedParameterInspection */
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
@@ -70,7 +69,7 @@ class Binder
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
foreach ($request->route()->parameters() as $key => $value) {
|
||||
if (isset($this->binders[$key])) {
|
||||
if (array_key_exists($key, $this->binders)) {
|
||||
$boundObject = $this->performBinding($key, $value, $request->route());
|
||||
$request->route()->setParameter($key, $boundObject);
|
||||
}
|
||||
|
@@ -95,7 +95,9 @@ class Installer
|
||||
$message = $e->getMessage();
|
||||
Log::error(sprintf('Error message trying to access users-table: %s', $message));
|
||||
if ($this->isAccessDenied($message)) {
|
||||
throw new FireflyException('It seems your database configuration is not correct. Please verify the username and password in your .env file.');
|
||||
throw new FireflyException(
|
||||
'It seems your database configuration is not correct. Please verify the username and password in your .env file.', 0, $e
|
||||
);
|
||||
}
|
||||
if ($this->noTablesExist($message)) {
|
||||
// redirect to UpdateController
|
||||
@@ -103,7 +105,7 @@ class Installer
|
||||
|
||||
return true;
|
||||
}
|
||||
throw new FireflyException(sprintf('Could not access the database: %s', $message));
|
||||
throw new FireflyException(sprintf('Could not access the database: %s', $message), 0, $e);
|
||||
}
|
||||
Log::debug('Everything seems OK with the tables.');
|
||||
|
||||
|
@@ -60,7 +60,7 @@ class IsDemoUser
|
||||
return response()->redirectTo($previous);
|
||||
}
|
||||
|
||||
return response()->redirectTo(route('index')); // @codeCoverageIgnore
|
||||
return response()->redirectTo(route('index'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
@@ -109,7 +109,7 @@ class Range
|
||||
// send error to view if could not set money format
|
||||
if (false === $moneyResult) {
|
||||
Log::error('Could not set locale. The following array doesnt work: ', $localeArray);
|
||||
app('view')->share('invalidMonetaryLocale', true); // @codeCoverageIgnore
|
||||
app('view')->share('invalidMonetaryLocale', true);
|
||||
}
|
||||
|
||||
// save some formats:
|
||||
|
@@ -45,7 +45,7 @@ class ReconciliationStoreRequest extends FormRequest
|
||||
{
|
||||
$transactions = $this->get('journals');
|
||||
if (!is_array($transactions)) {
|
||||
$transactions = []; // @codeCoverageIgnore
|
||||
$transactions = [];
|
||||
}
|
||||
$data = [
|
||||
'start' => $this->date('start'),
|
||||
|
@@ -109,7 +109,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
// fill in source and destination account data
|
||||
switch ($this->string('transaction_type')) {
|
||||
default:
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type'))); // @codeCoverageIgnore
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
|
||||
case 'withdrawal':
|
||||
$return['transactions'][0]['source_id'] = $this->integer('source_id');
|
||||
$return['transactions'][0]['destination_id'] = $this->integer('withdrawal_destination_id');
|
||||
@@ -251,7 +251,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->string('transaction_type'))); // @codeCoverageIgnore
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->string('transaction_type')));
|
||||
}
|
||||
|
||||
// update some rules in case the user is editing a post:
|
||||
@@ -308,7 +308,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
|
||||
switch ($this->string('transaction_type')) {
|
||||
default:
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type'))); // @codeCoverageIgnore
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
|
||||
case 'withdrawal':
|
||||
$sourceId = (int)$data['source_id'];
|
||||
$destinationId = (int)$data['withdrawal_destination_id'];
|
||||
|
@@ -149,12 +149,12 @@ class ReportFormRequest extends FormRequest
|
||||
if (2 === count($parts)) {
|
||||
try {
|
||||
$date = new Carbon($parts[1]);
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
} catch (Exception $e) {
|
||||
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
||||
Log::error($error);
|
||||
throw new FireflyException($error);
|
||||
// @codeCoverageIgnoreEnd
|
||||
throw new FireflyException($error, 0, $e);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -177,12 +177,12 @@ class ReportFormRequest extends FormRequest
|
||||
if (2 === count($parts)) {
|
||||
try {
|
||||
$date = new Carbon($parts[0]);
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
} catch (Exception $e) {
|
||||
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
||||
Log::error($error);
|
||||
throw new FireflyException($error);
|
||||
// @codeCoverageIgnoreEnd
|
||||
throw new FireflyException($error, 0, $e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user