Fix sonarcloud issues

This commit is contained in:
James Cole
2020-06-27 17:33:18 +02:00
parent 1e35f0e7e3
commit 415fb7294c
38 changed files with 25 additions and 522 deletions

View File

@@ -50,8 +50,9 @@ use League\Fractal\Resource\Item;
class AccountController extends Controller
{
use AccountFilter, TransactionFilter;
/** @var AccountRepositoryInterface The account repository */
private $repository;
private AccountRepositoryInterface $repository;
public const RESOURCE_KEY = 'accounts';
/**
* AccountController constructor.
@@ -150,7 +151,7 @@ class AccountController extends Controller
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($accounts, $transformer, 'accounts');
$resource = new FractalCollection($accounts, $transformer, self::RESOURCE_KEY);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
@@ -208,7 +209,7 @@ class AccountController extends Controller
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($account, $transformer, 'accounts');
$resource = new Item($account, $transformer, self::RESOURCE_KEY);
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
@@ -230,7 +231,7 @@ class AccountController extends Controller
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($account, $transformer, 'accounts');
$resource = new Item($account, $transformer, self::RESOURCE_KEY);
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
@@ -304,7 +305,7 @@ class AccountController extends Controller
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($account, $transformer, 'accounts');
$resource = new Item($account, $transformer, self::RESOURCE_KEY);
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}

View File

@@ -141,49 +141,6 @@ class CategoryController extends Controller
}
}
// foreach ([] as $set) {
// foreach ($set as $currency) {
// $inKey = sprintf('%d-i', $currency['currency_id']);
// $outKey = sprintf('%d-e', $currency['currency_id']);
// $categories[] = (string)trans('firefly.no_category');
// // make data arrays if not yet present.
// $tempData[$inKey] = $tempData[$inKey] ?? [
// 'currency_id' => $currency['currency_id'],
// 'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
// 'currency_code' => $currency['currency_code'],
// 'currency_symbol' => $currency['currency_symbol'],
// 'currency_decimal_places' => $currency['currency_decimal_places'],
// 'type' => 'bar', // line, area or bar
// 'yAxisID' => 0, // 0, 1, 2
// 'entries' => [
// // per category:
// // "category" => 5,
// ],
// ];
// $tempData[$outKey] = $tempData[$outKey] ?? [
// 'currency_id' => $currency['currency_id'],
// 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
// 'currency_code' => $currency['currency_code'],
// 'currency_symbol' => $currency['currency_symbol'],
// 'currency_decimal_places' => $currency['currency_decimal_places'],
// 'type' => 'bar', // line, area or bar
// 'yAxisID' => 0, // 0, 1, 2
// 'entries' => [
// // per category:
// // "category" => 5,
// ],
// ];
// foreach ($currency['transaction_journals'] as $journal) {
// // is it expense or income?
// $letter = -1 === bccomp($journal['amount'], '0') ? 'e' : 'i';
// $currentKey = sprintf('%d-%s', $currency['currency_id'], $letter);
// $name = (string)trans('firefly.no_category');
// $tempData[$currentKey]['entries'][$name] = $tempData[$currentKey]['entries'][$name] ?? '0';
// $tempData[$currentKey]['entries'][$name] = bcadd($tempData[$currentKey]['entries'][$name], $journal['amount']);
// }
// }
// }
// re-sort every spent array and add 0 for missing entries.
foreach ($tempData as $index => $set) {
$oldSet = $set['entries'];

View File

@@ -263,17 +263,13 @@ class TransactionUpdateRequest extends Request
// TODO if the transaction_journal_id is empty, some fields are mandatory, like the amount!
// all journals must have a description
//$this->validateDescriptions($validator);
// // validate foreign currency info
// $this->validateForeignCurrencyInformation($validator);
//
//
// // make sure all splits have valid source + dest info
// $this->validateSplitAccounts($validator);
// the group must have a description if > 1 journal.
// $this->validateGroupDescription($validator);
}
);
}

View File

@@ -159,7 +159,6 @@ class DecryptDatabase extends Command
if ('The MAC is invalid.' === $e->getMessage()) {
throw new FireflyException($e->getMessage()); // @codeCoverageIgnore
}
//Log::debug(sprintf('Could not decrypt. %s', $e->getMessage()));
}
return $value;

View File

@@ -211,7 +211,6 @@ class MigrateToRules extends Command
$lang = app('preferences')->getForUser($user, 'language', 'en_US');
$groupTitle = (string) trans('firefly.rulegroup_for_bills_title', [], $lang->data);
$ruleGroup = $this->ruleGroupRepository->findByTitle($groupTitle);
//$currency = $this->getCurrency($user);
if (null === $ruleGroup) {
$ruleGroup = $this->ruleGroupRepository->store(

View File

@@ -341,19 +341,17 @@ class TransferCurrenciesCorrections extends Command
if (isset($this->accountCurrencies[$accountId]) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) {
return $this->accountCurrencies[$accountId]; // @codeCoverageIgnore
}
// TODO we can use getAccountCurrency() instead
$currencyId = (int) $this->accountRepos->getMetaValue($account, 'currency_id');
$result = $this->currencyRepos->findNull($currencyId);
if (null === $result) {
$currency = $this->accountRepos->getAccountCurrency($account);
if (null === $currency) {
// @codeCoverageIgnoreStart
$this->accountCurrencies[$accountId] = 0;
return null;
// @codeCoverageIgnoreEnd
}
$this->accountCurrencies[$accountId] = $result;
$this->accountCurrencies[$accountId] = $currency;
return $result;
return $currency;
}
/**

View File

@@ -367,19 +367,6 @@ class TransactionJournalFactory
// verify that journal has two transactions. Otherwise, delete and cancel.
// TODO this can't be faked so it can't be tested.
// $count = $journal->transactions()->count();
// if (2 !== $count) {
// // @codeCoverageIgnoreStart
// Log::error(sprintf('The journal unexpectedly has %d transaction(s). This is not OK. Cancel operation.', $count));
// try {
// $journal->delete();
// } catch (Exception $e) {
// Log::debug(sprintf('Dont care: %s.', $e->getMessage()));
// }
//
// return null;
// // @codeCoverageIgnoreEnd
// }
$journal->completed = true;
$journal->save();

View File

@@ -168,13 +168,8 @@ class GroupCollector implements GroupCollectorInterface
*/
public function getGroups(): Collection
{
//$start = microtime(true);
/** @var Collection $result */
$result = $this->query->get($this->fields);
//$end = round(microtime(true) - $start, 5);
// log info about query time.
//Log::info(sprintf('Query took Firefly III %s seconds', $end));
//Log::info($this->query->toSql(), $this->query->getBindings());
// now to parse this into an array.
$collection = $this->parseArray($result);

View File

@@ -79,7 +79,6 @@ class ShowController extends Controller
*/
public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null)
{
//Log::debug('Now in show()');
/** @var Carbon $start */
$start = $start ?? session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */
@@ -106,8 +105,6 @@ class ShowController extends Controller
$groups = $collector->getPaginatedGroups();
$groups->setPath($path);
//Log::debug('End of show()');
return view('categories.show', compact('category','attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
}

View File

@@ -111,7 +111,6 @@ class BudgetController extends Controller
$loopStart = app('navigation')->startOfPeriod($loopStart, $step);
$currencies = [];
$defaultEntries = [];
// echo '<hr>';
while ($end >= $loopStart) {
/** @var Carbon $currentEnd */
$loopEnd = app('navigation')->endOfPeriod($loopStart, $step);

View File

@@ -85,8 +85,6 @@ class CategoryController extends Controller
$start = app('navigation')->startOfPeriod($start, $range);
$end = $this->getDate();
//Log::debug(sprintf('Full range is %s to %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
/** @var WholePeriodChartGenerator $generator */
$generator = app(WholePeriodChartGenerator::class);
$chartData = $generator->generate($category, $start, $end);

View File

@@ -64,61 +64,6 @@ class CategoryReportController extends Controller
);
}
//
// /**
// * Chart for expenses grouped by expense account.
// *
// * TODO this chart is not multi-currency aware.
// *
// * @param Collection $accounts
// * @param Collection $categories
// * @param Carbon $start
// * @param Carbon $end
// * @param string $others
// *
// * @return JsonResponse
// */
// public function accountExpense(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others): JsonResponse
// {
// /** @var MetaPieChartInterface $helper */
// $helper = app(MetaPieChartInterface::class);
// $helper->setAccounts($accounts)->setCategories($categories)->setStart($start)->setEnd($end)->setCollectOtherObjects(1 === (int)$others);
//
// $chartData = $helper->generate('expense', 'account');
// $data = $this->generator->pieChart($chartData);
//
// return response()->json($data);
// }
//
// /**
// * Chart for income grouped by revenue account.
// *
// * TODO this chart is not multi-currency aware.
// *
// * @param Collection $accounts
// * @param Collection $categories
// * @param Carbon $start
// * @param Carbon $end
// * @param string $others
// *
// * @return JsonResponse
// */
// public function accountIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others): JsonResponse
// {
// /** @var MetaPieChartInterface $helper */
// $helper = app(MetaPieChartInterface::class);
// $helper->setAccounts($accounts);
// $helper->setCategories($categories);
// $helper->setStart($start);
// $helper->setEnd($end);
// $helper->setCollectOtherObjects(1 === (int)$others);
// $chartData = $helper->generate('income', 'account');
// $data = $this->generator->pieChart($chartData);
//
// return response()->json($data);
// }
/**
* @param Collection $accounts
* @param Collection $categories

View File

@@ -237,20 +237,16 @@ class ProfileController extends Controller
/** @var Collection $set */
$set = app('preferences')->findByName('email_change_confirm_token');
$user = null;
//Log::debug(sprintf('Found %d preferences', $set->count()));
/** @var Preference $preference */
foreach ($set as $preference) {
if ($preference->data === $token) {
//Log::debug('Found user');
$user = $preference->user;
}
}
// update user to clear blocked and blocked_code.
if (null === $user) {
//Log::debug('Found no user');
throw new FireflyException('Invalid token.');
}
//Log::debug('Will unblock user.');
$repository->unblockUser($user);
// return to login.
@@ -372,7 +368,7 @@ class ProfileController extends Controller
/**
* @return Factory|View
*/
public function newBackupCodes()
public function newBackupCodes(Request $request)
{
if ($this->externalIdentity) {
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));

View File

@@ -121,10 +121,6 @@ class IndexController extends Controller
}
}
//if (0 !== $recurrence->recurrenceRepetitions->count()) {
//$array['ocurrences'] = array_slice($this->recurring->getOccurrencesInRange($recurrence->recurrenceRepetitions->first(), $today, $year), 0, 1);
//}
$recurring[] = $array;
}
$paginator = new LengthAwarePaginator($recurring, $total, $pageSize, $page);

View File

@@ -489,287 +489,6 @@ class DoubleController extends Controller
return $result;
}
//
//
// /**
// * Generates the overview per budget.
// *
// * @param Collection $accounts
// * @param Collection $expense
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return string
// */
// public function budget(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): string
// {
// // Properties for cache:
// $cache = new CacheProperties;
// $cache->addProperty($start);
// $cache->addProperty($end);
// $cache->addProperty('expense-budget');
// $cache->addProperty($accounts->pluck('id')->toArray());
// $cache->addProperty($expense->pluck('id')->toArray());
// if ($cache->has()) {
// return $cache->get(); // @codeCoverageIgnore
// }
// $combined = $this->combineAccounts($expense);
// $all = new Collection;
// foreach ($combined as $combi) {
// $all = $all->merge($combi);
// }
// // now find spent / earned:
// $spent = $this->spentByBudget($accounts, $all, $start, $end);
// // join arrays somehow:
// $together = [];
// foreach ($spent as $categoryId => $spentInfo) {
// if (!isset($together[$categoryId])) {
// $together[$categoryId]['spent'] = $spentInfo;
// $together[$categoryId]['budget'] = $spentInfo['name'];
// $together[$categoryId]['grand_total'] = '0';
// }
// $together[$categoryId]['grand_total'] = bcadd($spentInfo['grand_total'], $together[$categoryId]['grand_total']);
// }
// try {
// $result = view('reports.partials.exp-budgets', compact('together'))->render();
// // @codeCoverageIgnoreStart
// } catch (Throwable $e) {
// Log::error(sprintf('Could not render category::budget: %s', $e->getMessage()));
// $result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
// }
// // @codeCoverageIgnoreEnd
// $cache->store($result);
//
// return $result;
// }
//
//
//
// /**
// * Generates the overview per category (spent and earned).
// *
// * @param Collection $accounts
// * @param Collection $expense
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return string
// */
// public function category(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): string
// {
// // Properties for cache:
// $cache = new CacheProperties;
// $cache->addProperty($start);
// $cache->addProperty($end);
// $cache->addProperty('expense-category');
// $cache->addProperty($accounts->pluck('id')->toArray());
// $cache->addProperty($expense->pluck('id')->toArray());
// if ($cache->has()) {
// return $cache->get(); // @codeCoverageIgnore
// }
// $combined = $this->combineAccounts($expense);
// $all = new Collection;
// foreach ($combined as $combi) {
// $all = $all->merge($combi);
// }
// // now find spent / earned:
// $spent = $this->spentByCategory($accounts, $all, $start, $end);
// $earned = $this->earnedByCategory($accounts, $all, $start, $end);
// // join arrays somehow:
// $together = [];
// foreach ($spent as $categoryId => $spentInfo) {
// if (!isset($together[$categoryId])) {
// $together[$categoryId]['spent'] = $spentInfo;
// $together[$categoryId]['category'] = $spentInfo['name'];
// $together[$categoryId]['grand_total'] = '0';
// }
// $together[$categoryId]['grand_total'] = bcadd($spentInfo['grand_total'], $together[$categoryId]['grand_total']);
// }
// foreach ($earned as $categoryId => $earnedInfo) {
// if (!isset($together[$categoryId])) {
// $together[$categoryId]['earned'] = $earnedInfo;
// $together[$categoryId]['category'] = $earnedInfo['name'];
// $together[$categoryId]['grand_total'] = '0';
// }
// $together[$categoryId]['grand_total'] = bcadd($earnedInfo['grand_total'], $together[$categoryId]['grand_total']);
// }
// try {
// $result = view('reports.partials.exp-categories', compact('together'))->render();
// // @codeCoverageIgnoreStart
// } catch (Throwable $e) {
// 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);
//
// return $result;
// }
//
//
// /**
// * Overview of spending.
// *
// * @param Collection $accounts
// * @param Collection $expense
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return array|mixed|string
// */
// public function spent(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
// {
// // chart properties for cache:
// $cache = new CacheProperties;
// $cache->addProperty($start);
// $cache->addProperty($end);
// $cache->addProperty('expense-spent');
// $cache->addProperty($accounts->pluck('id')->toArray());
// $cache->addProperty($expense->pluck('id')->toArray());
// if ($cache->has()) {
// return $cache->get(); // @codeCoverageIgnore
// }
//
// $combined = $this->combineAccounts($expense);
// $result = [];
//
// foreach ($combined as $name => $combi) {
// /**
// * @var string
// * @var Collection $combi
// */
// $spent = $this->spentInPeriod($accounts, $combi, $start, $end);
// $earned = $this->earnedInPeriod($accounts, $combi, $start, $end);
// $result[$name] = [
// 'spent' => $spent,
// 'earned' => $earned,
// ];
// }
// try {
// $result = view('reports.partials.exp-not-grouped', compact('result'))->render();
// // @codeCoverageIgnoreStart
// } catch (Throwable $e) {
// 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);
//
// return $result;
// // for period, get spent and earned for each account (by name)
// }
//
//
// /**
// * List of top expenses.
// *
// * @param Collection $accounts
// * @param Collection $expense
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return string
// */
// public function topExpense(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): string
// {
// // Properties for cache:
// $cache = new CacheProperties;
// $cache->addProperty($start);
// $cache->addProperty($end);
// $cache->addProperty('top-expense');
// $cache->addProperty($accounts->pluck('id')->toArray());
// $cache->addProperty($expense->pluck('id')->toArray());
// if ($cache->has()) {
// return $cache->get(); // @codeCoverageIgnore
// }
// $combined = $this->combineAccounts($expense);
// $all = new Collection;
// foreach ($combined as $combi) {
// $all = $all->merge($combi);
// }
// // get all expenses in period:
// /** @var GroupCollectorInterface $collector */
// $collector = app(GroupCollectorInterface::class);
//
// $collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setAccounts($accounts);
// $collector->setAccounts($all)->withAccountInformation();
// $sorted = $collector->getExtractedJournals();
//
// usort($sorted, function ($a, $b) {
// return $a['amount'] <=> $b['amount']; // @codeCoverageIgnore
// });
//
// try {
// $result = view('reports.partials.top-transactions', compact('sorted'))->render();
// // @codeCoverageIgnoreStart
// } catch (Throwable $e) {
// Log::error(sprintf('Could not render category::topExpense: %s', $e->getMessage()));
// $result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
// }
// // @codeCoverageIgnoreEnd
// $cache->store($result);
//
// return $result;
// }
//
// /**
// * List of top income.
// *
// * @param Collection $accounts
// * @param Collection $expense
// * @param Carbon $start
// * @param Carbon $end
// *
// * @return mixed|string
// */
// public function topIncome(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
// {
// // Properties for cache:
// $cache = new CacheProperties;
// $cache->addProperty($start);
// $cache->addProperty($end);
// $cache->addProperty('top-income');
// $cache->addProperty($accounts->pluck('id')->toArray());
// $cache->addProperty($expense->pluck('id')->toArray());
// if ($cache->has()) {
// return $cache->get(); // @codeCoverageIgnore
// }
// $combined = $this->combineAccounts($expense);
// $all = new Collection;
// foreach ($combined as $combi) {
// $all = $all->merge($combi);
// }
// // get all expenses in period:
//
// /** @var GroupCollectorInterface $collector */
// $collector = app(GroupCollectorInterface::class);
//
// $total = $accounts->merge($all);
// $collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAccounts($total)->withAccountInformation();
// $sorted = $collector->getExtractedJournals();
//
// foreach (array_keys($sorted) as $key) {
// $sorted[$key]['amount'] = bcmul($sorted[$key]['amount'], '-1');
// }
//
// usort($sorted, function ($a, $b) {
// return $a['amount'] <=> $b['amount']; // @codeCoverageIgnore
// });
//
// try {
// $result = view('reports.partials.top-transactions', compact('sorted'))->render();
// // @codeCoverageIgnoreStart
// } catch (Throwable $e) {
// Log::error(sprintf('Could not render category::topIncome: %s', $e->getMessage()));
// $result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
// }
// // @codeCoverageIgnoreEnd
// $cache->store($result);
//
// return $result;
// }
/**
* TODO this method is double.
*

View File

@@ -182,8 +182,6 @@ class MassController extends Controller
$count++;
} catch (FireflyException $e) { // @codeCoverageIgnore
// do something with error.
//echo $e->getMessage();
//exit;
}
}

View File

@@ -46,7 +46,6 @@ class InterestingMessage
*/
public function handle(Request $request, Closure $next)
{
//Log::debug(sprintf('Interesting Message middleware for URI %s', $request->url()));
if ($this->testing()) {
return $next($request);
}

View File

@@ -315,9 +315,6 @@ class CreateRecurringTransactions implements ShouldQueue
$this->created++;
Log::info(sprintf('Created new transaction group #%d', $group->id));
// link to piggy:
//$this->linkGroupToPiggies($recurrence, $group);
// trigger event:
event(new StoredTransactionGroup($group, $recurrence->apply_rules));

View File

@@ -54,14 +54,12 @@ class AuthServiceProvider extends ServiceProvider
{
Auth::provider(
'remote_user_provider', function ($app, array $config) {
//Log::debug('Creating remote_user_provider in Closure');
return new RemoteUserProvider($app, $config);
}
);
Auth::extend(
'remote_user_guard', static function ($app, string $name, array $config) {
//Log::debug('Creating remote_user_guard in Closure');
return new RemoteUserGuard(Auth::createUserProvider($config['provider']), $app);
}
);

View File

@@ -121,8 +121,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
try {
$unencryptedContent = Crypt::decrypt($encryptedContent); // verified
} catch (DecryptException $e) {
//Log::debug(sprintf('Could not decrypt: %e', $e->getMessage()));
$unencryptedContent = $encryptedContent;
$unencryptedContent = $encryptedContent;
}
}

View File

@@ -594,12 +594,9 @@ class BillRepository implements BillRepositoryInterface
}
// find the most recent date for this bill NOT in the future. Cache this date:
$start = clone $bill->date;
//Log::debug('nextDateMatch: Start is ' . $start->format('Y-m-d'));
while ($start < $date) {
//Log::debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d'), $date->format('Y-m-d')));
$start = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
//Log::debug('Start is now ' . $start->format('Y-m-d'));
}
$end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);

View File

@@ -191,7 +191,6 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function getActiveBudgets(): Collection
{
//throw new \RuntimeException;
/** @var Collection $set */
$set = $this->user->budgets()->where('active', 1)
->orderBy('order', 'ASC')

View File

@@ -170,14 +170,6 @@ class CurrencyRepository implements CurrencyRepositoryInterface
return 'current_default';
}
// // is the default currency for the system
// $defaultSystemCode = config('firefly.default_currency', 'EUR');
// $result = $currency->code === $defaultSystemCode;
// if (true === $result) {
// Log::info('Is the default currency of the SYSTEM, return true.');
//
// return 'system_fallback';
// }
Log::debug('Currency is not used, return false.');
return null;

View File

@@ -282,7 +282,6 @@ class RecurringRepository implements RecurringRepositoryInterface
/** @var RecurrenceMeta $meta */
foreach ($transaction->recurrenceTransactionMeta as $meta) {
if ('tags' === $meta->name && '' !== $meta->value) {
//$tags = explode(',', $meta->value);
$tags = json_decode($meta->value, true, 512, JSON_THROW_ON_ERROR);
}
}

View File

@@ -243,24 +243,6 @@ trait RecurringTransactionTrait
return $result ?? $repository->getCashAccount();
}
// /**
// * Update meta data for recurring transaction.
// *
// * @param Recurrence $recurrence
// * @param array $data
// */
// protected function updateMetaData(Recurrence $recurrence, array $data): void
// {
// // only two special meta fields right now. Let's just hard code them.
// $piggyId = (int)($data['meta']['piggy_bank_id'] ?? 0.0);
// $piggyName = $data['meta']['piggy_bank_name'] ?? '';
// $this->updatePiggyBank($recurrence, $piggyId, $piggyName);
//
// $tags = $data['meta']['tags'] ?? [];
// $this->updateTags($recurrence, $tags);
//
// }
/**
* @param RecurrenceTransaction $transaction
* @param int $piggyId

View File

@@ -81,7 +81,6 @@ class RemoteUserGuard implements Guard
*/
public function guest(): bool
{
//Log::debug(sprintf('Now at %s', __METHOD__));
return !$this->check();
}
@@ -90,7 +89,6 @@ class RemoteUserGuard implements Guard
*/
public function id(): ?User
{
//Log::debug(sprintf('Now at %s', __METHOD__));
return $this->user;
}
@@ -99,7 +97,6 @@ class RemoteUserGuard implements Guard
*/
public function setUser(Authenticatable $user)
{
//Log::debug(sprintf('Now at %s', __METHOD__));
$this->user = $user;
}
@@ -108,7 +105,6 @@ class RemoteUserGuard implements Guard
*/
public function user(): ?User
{
//Log::debug(sprintf('Now in user(). Will return NULL: %s', var_export(null === $this->user, true)));
return $this->user;
}

View File

@@ -17,16 +17,6 @@ use Str;
*/
class RemoteUserProvider implements UserProvider
{
/**
* RemoteUserProvider constructor.
*
* @param Application $app
* @param array $config
*/
public function __construct(Application $app, array $config)
{
//Log::debug('In RemoteUserProvider constructor.');
}
/**
* @inheritDoc

View File

@@ -44,9 +44,7 @@ class AccountList implements BinderInterface
*/
public static function routeBinder(string $value, Route $route): Collection
{
//Log::debug(sprintf('Now in AccountList::routeBinder("%s")', $value));
if (auth()->check()) {
//Log::debug('User is logged in.');
$collection = new Collection;
if ('allAssetAccounts' === $value) {
/** @var Collection $collection */
@@ -65,7 +63,6 @@ class AccountList implements BinderInterface
->whereIn('accounts.id', $list)
->orderBy('accounts.name', 'ASC')
->get(['accounts.*']);
//Log::debug(sprintf('Collection length is %d', $collection->count()));
}
if ($collection->count() > 0) {

View File

@@ -66,7 +66,6 @@ class BudgetList implements BinderInterface
->where('active', 1)
->whereIn('id', $list)
->get();
//Log::debug(sprintf('Found %d active budgets', $collection->count()), $list);
// add empty budget if applicable.
if (in_array(0, $list, true)) {
@@ -75,11 +74,9 @@ class BudgetList implements BinderInterface
}
if ($collection->count() > 0) {
//Log::debug(sprintf('List length is > 0 (%d), so return it.', $collection->count()));
return $collection;
}
//Log::debug('List length is zero, fall back to 404.');
}
Log::warning('BudgetList fallback to 404.');
throw new NotFoundHttpException;

View File

@@ -106,12 +106,9 @@ trait GetConfigurationData
// first range is the current range:
$title => [$start, $end],
];
//Log::debug(sprintf('viewRange is %s', $viewRange));
//Log::debug(sprintf('isCustom is %s', var_export($isCustom, true)));
// when current range is a custom range, add the current period as the next range.
if ($isCustom) {
//Log::debug('Custom is true.');
$index = app('navigation')->periodShow($start, $viewRange);
$customPeriodStart = app('navigation')->startOfPeriod($start, $viewRange);
$customPeriodEnd = app('navigation')->endOfPeriod($customPeriodStart, $viewRange);

View File

@@ -166,7 +166,6 @@ trait RequestInformation
// both must be array and either must be > 0
if (count($intro) > 0 || count($specialIntro) > 0) {
$shownDemo = app('preferences')->get($key, false)->data;
//Log::debug(sprintf('Check if user has already seen intro with key "%s". Result is %s', $key, var_export($shownDemo, true)));
}
if (!is_bool($shownDemo)) {
$shownDemo = true; // @codeCoverageIgnore

View File

@@ -40,10 +40,6 @@ use Log;
trait UserNavigation
{
//if (!$this->isEditableAccount($account)) {
// return $this->redirectAccountToAccount($account); // @codeCoverageIgnore
// }
/**
* Will return false if you cant edit this account type.
*

View File

@@ -539,7 +539,6 @@ class Navigation
$subtract = $subtract ?? 1;
$date = clone $theDate;
// 1D 1W 1M 3M 6M 1Y
//Log::debug(sprintf('subtractPeriod: date is %s, repeat frequency is %s and subtract is %d', $date->format('Y-m-d'), $repeatFreq, $subtract));
$functionMap = [
'1D' => 'subDays',
'daily' => 'subDays',
@@ -563,16 +562,12 @@ class Navigation
if (isset($functionMap[$repeatFreq])) {
$function = $functionMap[$repeatFreq];
$date->$function($subtract);
//Log::debug(sprintf('%s is in function map, execute %s with argument %d', $repeatFreq, $function, $subtract));
//Log::debug(sprintf('subtractPeriod: resulting date is %s', $date->format('Y-m-d')));
return $date;
}
if (isset($modifierMap[$repeatFreq])) {
$subtract *= $modifierMap[$repeatFreq];
$date->subMonths($subtract);
//Log::debug(sprintf('%s is in modifier map with value %d, execute subMonths with argument %d', $repeatFreq, $modifierMap[$repeatFreq], $subtract));
//Log::debug(sprintf('subtractPeriod: resulting date is %s', $date->format('Y-m-d')));
return $date;
}
@@ -585,11 +580,8 @@ class Navigation
/** @var Carbon $tEnd */
$tEnd = session('end', Carbon::now()->endOfMonth());
$diffInDays = $tStart->diffInDays($tEnd);
//Log::debug(sprintf('repeatFreq is %s, start is %s and end is %s (session data).', $repeatFreq, $tStart->format('Y-m-d'), $tEnd->format('Y-m-d')));
//Log::debug(sprintf('Diff in days is %d', $diffInDays));
$date->subDays($diffInDays * $subtract);
//Log::debug(sprintf('subtractPeriod: resulting date is %s', $date->format('Y-m-d')));
return $date;
}

View File

@@ -48,7 +48,6 @@ trait RecurrenceValidation
*/
public function valUpdateAccountInfo(Validator $validator): void
{
//Log::debug('Now in validateAccountInformation()');
$data = $validator->getData();
$transactionType = $data['type'] ?? 'invalid';

View File

@@ -1,5 +1,13 @@
<template>
<table class="table table-striped">
<caption>A table containing transactions.</caption>
<thead>
<tr>
<th>TODO</th>
<th>TODO</th>
</tr>
</thead>
<tbody>
<tr v-for="transaction in transactions">
<td>
<a href="#">
@@ -18,6 +26,7 @@
</span>
</td>
</tr>
</tbody>
</table>
</template>

View File

@@ -91,12 +91,10 @@ p {
abbr[title],
abbr[data-original-title] {
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
text-decoration-style: dotted;
text-decoration-line: underline;
cursor: help;
border-bottom: 0;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
@@ -31218,4 +31216,4 @@ a.text-muted:hover {
[class*="accent-"] a.btn-dark {
color: #ffffff;
}
/*# sourceMappingURL=adminlte.css.map */
/*# sourceMappingURL=adminlte.css.map */

View File

@@ -87,8 +87,6 @@ Route::group(
static function () {
Route::post('submit', ['uses' => 'TwoFactorController@submitMFA', 'as' => 'submit']);
Route::get('lost', ['uses' => 'TwoFactorController@lostTwoFactor', 'as' => 'lost']);
// Route::post('', ['uses' => 'TwoFactorController@postIndex', 'as' => 'post']);
//
}
);
@@ -160,12 +158,6 @@ Route::group(
'reconcile/{account}/transactions/{start_date?}/{end_date?}',
['uses' => 'Json\ReconcileController@transactions', 'as' => 'reconcile.transactions']
);
// show reconciliation
// TODO improve me
//Route::get('reconcile/show/{transactionGroup}', ['uses' => 'Account\ReconcileController@show', 'as' => 'reconcile.show']);
//Route::get('reconcile/edit/{transactionGroup}', ['uses' => 'Account\ReconcileController@edit', 'as' => 'reconcile.edit']);
//Route::post('reconcile/update/{transactionGroup}', ['uses' => 'Account\ReconcileController@update', 'as' => 'reconcile.update']);
}
);

View File

@@ -116,7 +116,6 @@ class BudgetLimitControllerTest extends TestCase
];
// mock stuff:
$repository = $this->mock(BudgetRepositoryInterface::class);
//$repository->shouldReceive('findNull')->andReturn(null)->once();
$transformer = $this->mock(BudgetLimitTransformer::class);
$blRepository = $this->mock(BudgetLimitRepositoryInterface::class);