Clean up code.

This commit is contained in:
James Cole
2020-10-24 07:40:56 +02:00
parent 048e5eeb31
commit ab4bcd3703
20 changed files with 126 additions and 245 deletions

View File

@@ -284,7 +284,6 @@ class CategoryController extends Controller
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $categories);
$result = [];
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id'];
@@ -337,7 +336,6 @@ class CategoryController extends Controller
$spent = $this->opsRepository->listIncome($start, $end, $accounts, $categories);
$result = [];
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$sourceId = $journal['source_account_id'];
@@ -536,7 +534,7 @@ class CategoryController extends Controller
'entries' => [],
];
foreach ($categoryRow['transaction_journals'] as $journalId => $journal) {
foreach ($categoryRow['transaction_journals'] as $journal) {
$date = $journal['date']->format($format);
$data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0';
$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']);
@@ -616,7 +614,7 @@ class CategoryController extends Controller
'entries' => [],
];
foreach ($categoryRow['transaction_journals'] as $journalId => $journal) {
foreach ($categoryRow['transaction_journals'] as $journal) {
$date = $journal['date']->format($format);
$data[$key]['entries'][$date] = $data[$key]['entries'][$date] ?? '0';
$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date], $journal['amount']);
@@ -662,7 +660,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(); // @codeCoverageIgnore
}
/** @var CategoryReportGenerator $generator */
@@ -700,7 +698,6 @@ class CategoryController extends Controller
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $categories);
$result = [];
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$result[] = [
@@ -750,7 +747,6 @@ class CategoryController extends Controller
$spent = $this->opsRepository->listIncome($start, $end, $accounts, $categories);
$result = [];
foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$result[] = [
@@ -787,17 +783,4 @@ class CategoryController extends Controller
return $result;
}
/**
* @param array $array
*
* @return bool
*/
private function noAmountInArray(array $array): bool
{
if (0 === count($array)) {
return true;
}
return false;
}
}

View File

@@ -168,23 +168,6 @@ class CreateRecurringTransactions implements ShouldQueue
return $recurrence->active;
}
/**
* Helper function for debug information.
*
* @param array $occurrences
*
* @return array
*/
private function debugArray(array $occurrences): array
{
$return = [];
foreach ($occurrences as $entry) {
$return[] = $entry->format('Y-m-d');
}
return $return;
}
/**
* @param Collection $recurrences
*
@@ -427,23 +410,6 @@ class CreateRecurringTransactions implements ShouldQueue
return $startDate->gt($this->date);
}
/***
* @param Recurrence $recurrence
* @param TransactionGroup $group
*/
private function linkGroupToPiggies(Recurrence $recurrence, TransactionGroup $group): void
{
/** @var TransactionJournal $journal */
foreach ($group->transactionJournals as $journal) {
// get piggy bank ID from meta data:
$piggyBank = $this->repository->getPiggyBank($recurrence);
if (null !== $piggyBank) {
/** @var PiggyBankEventFactory $factory */
$factory = app(PiggyBankEventFactory::class);
$factory->create($journal, $piggyBank);
}
}
}
/**
* Return true if the $repeat_until date is in the past.

View File

@@ -582,46 +582,4 @@ class TagRepository implements TagRepositoryInterface
}
);
}
/**
* @param string $oldName
* @param string $newName
*/
private function updateRuleActions(string $oldName, string $newName): void
{
$types = ['add_tag', 'remove_tag'];
$actions = RuleAction::leftJoin('rules', 'rules.id', '=', 'rule_actions.rule_id')
->where('rules.user_id', $this->user->id)
->whereIn('rule_actions.action_type', $types)
->where('rule_actions.action_value', $oldName)
->get(['rule_actions.*']);
Log::debug(sprintf('Found %d actions to update.', $actions->count()));
/** @var RuleAction $action */
foreach ($actions as $action) {
$action->action_value = $newName;
$action->save();
Log::debug(sprintf('Updated action %d: %s', $action->id, $action->action_value));
}
}
/**
* @param string $oldName
* @param string $newName
*/
private function updateRuleTriggers(string $oldName, string $newName): void
{
$types = ['tag_is',];
$triggers = RuleTrigger::leftJoin('rules', 'rules.id', '=', 'rule_triggers.rule_id')
->where('rules.user_id', $this->user->id)
->whereIn('rule_triggers.trigger_type', $types)
->where('rule_triggers.trigger_value', $oldName)
->get(['rule_triggers.*']);
Log::debug(sprintf('Found %d triggers to update.', $triggers->count()));
/** @var RuleTrigger $trigger */
foreach ($triggers as $trigger) {
$trigger->trigger_value = $newName;
$trigger->save();
Log::debug(sprintf('Updated trigger %d: %s', $trigger->id, $trigger->trigger_value));
}
}
}

View File

@@ -81,6 +81,7 @@ class OperatorQuerySearch implements SearchInterface
/**
* OperatorQuerySearch constructor.
*
* @codeCoverageIgnore
*/
public function __construct()
@@ -194,6 +195,7 @@ class OperatorQuerySearch implements SearchInterface
if (0 === count($this->getWords()) && 0 === count($this->getOperators())) {
return new LengthAwarePaginator;
}
return $this->collector->getPaginatedGroups();
}
@@ -212,12 +214,13 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->setUser($this->user);
$this->collector->withAccountInformation()->withCategoryInformation()->withBudgetInformation();
$this->setLimit((int) app('preferences')->getForUser($user, 'listPageSize', 50)->data);
$this->setLimit((int)app('preferences')->getForUser($user, 'listPageSize', 50)->data);
}
/**
* @param Node $searchNode
*
* @throws FireflyException
*/
private function handleSearchNode(Node $searchNode): void
@@ -237,7 +240,7 @@ class OperatorQuerySearch implements SearchInterface
case Emoji::class:
case Mention::class:
Log::debug(sprintf('Now handle %s', $class));
$this->words[] = (string) $searchNode->getValue();
$this->words[] = (string)$searchNode->getValue();
break;
case Field::class:
Log::debug(sprintf('Now handle %s', $class));
@@ -246,16 +249,14 @@ class OperatorQuerySearch implements SearchInterface
$operator = strtolower($searchNode->getValue());
$value = $searchNode->getNode()->getValue();
// must be valid operator:
if (in_array($operator, $this->validOperators, true)) {
if ($this->updateCollector($operator, (string) $value)) {
if (in_array($operator, $this->validOperators, true) && $this->updateCollector($operator, (string)$value)) {
$this->operators->push(
[
'type' => self::getRootOperator($operator),
'value' => (string) $value,
'value' => (string)$value,
]
);
}
}
break;
}
@@ -264,6 +265,7 @@ class OperatorQuerySearch implements SearchInterface
/**
* @param string $operator
* @param string $value
*
* @return bool
* @throws FireflyException
*/
@@ -283,6 +285,7 @@ class OperatorQuerySearch implements SearchInterface
// some search operators are ignored, basically:
case 'user_action':
Log::info(sprintf('Ignore search operator "%s"', $operator));
return false;
//
// all account related searches:
@@ -312,7 +315,7 @@ class OperatorQuerySearch implements SearchInterface
$this->searchAccount($value, 1, 3);
break;
case 'source_account_id':
$account = $this->accountRepository->findNull((int) $value);
$account = $this->accountRepository->findNull((int)$value);
if (null !== $account) {
$this->collector->setSourceAccounts(new Collection([$account]));
}
@@ -346,7 +349,7 @@ class OperatorQuerySearch implements SearchInterface
$this->searchAccount($value, 2, 3);
break;
case 'destination_account_id':
$account = $this->accountRepository->findNull((int) $value);
$account = $this->accountRepository->findNull((int)$value);
if (null !== $account) {
$this->collector->setDestinationAccounts(new Collection([$account]));
}
@@ -355,7 +358,7 @@ class OperatorQuerySearch implements SearchInterface
$parts = explode(',', $value);
$collection = new Collection;
foreach ($parts as $accountId) {
$account = $this->accountRepository->findNull((int) $accountId);
$account = $this->accountRepository->findNull((int)$accountId);
if (null !== $account) {
$collection->push($account);
}
@@ -390,6 +393,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'description_contains':
$this->words[] = $value;
return false;
case 'description_is':
$this->collector->descriptionIs($value);
@@ -494,17 +498,17 @@ class OperatorQuerySearch implements SearchInterface
// amount
//
case 'amount_exactly':
$amount = app('steam')->positive((string) $value);
$amount = app('steam')->positive((string)$value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIs($amount);
break;
case 'amount_less':
$amount = app('steam')->positive((string) $value);
$amount = app('steam')->positive((string)$value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountLess($amount);
break;
case 'amount_more':
$amount = app('steam')->positive((string) $value);
$amount = app('steam')->positive((string)$value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountMore($amount);
break;
@@ -520,7 +524,12 @@ class OperatorQuerySearch implements SearchInterface
//
case 'date_is':
$range = $this->parseDateRange($value);
Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d')));
Log::debug(
sprintf(
'Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'),
$range['end']->format('Y-m-d')
)
);
$this->collector->setRange($range['start'], $range['end']);
// add to operators manually:
@@ -531,7 +540,12 @@ class OperatorQuerySearch implements SearchInterface
case 'date_before':
Log::debug(sprintf('Value for date_before is "%s"', $value));
$range = $this->parseDateRange($value);
Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d')));
Log::debug(
sprintf(
'Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'),
$range['end']->format('Y-m-d')
)
);
// add to operators manually:
$this->operators->push(['type' => 'date_before', 'value' => $range['start']->format('Y-m-d'),]);
@@ -541,7 +555,12 @@ class OperatorQuerySearch implements SearchInterface
case 'date_after':
Log::debug(sprintf('Value for date_after is "%s"', $value));
$range = $this->parseDateRange($value);
Log::debug(sprintf('Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'), $range['end']->format('Y-m-d')));
Log::debug(
sprintf(
'Set "%s" using collector with value "%s" (%s - %s)', $operator, $value, $range['start']->format('Y-m-d'),
$range['end']->format('Y-m-d')
)
);
// add to operators manually:
$this->operators->push(['type' => 'date_after', 'value' => $range['end']->format('Y-m-d'),]);
@@ -568,12 +587,14 @@ class OperatorQuerySearch implements SearchInterface
$this->collector->setInternalReference($value);
break;
}
return true;
}
/**
* searchDirection: 1 = source (default), 2 = destination
* stringPosition: 1 = start (default), 2 = end, 3 = contains, 4 = is
*
* @param string $value
* @param int $searchDirection
* @param int $stringPosition
@@ -617,15 +638,18 @@ class OperatorQuerySearch implements SearchInterface
return;
}
Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
$filtered = $accounts->filter(function (Account $account) use ($value, $stringMethod) {
$filtered = $accounts->filter(
function (Account $account) use ($value, $stringMethod) {
return $stringMethod(strtolower($account->name), strtolower($value));
});
}
);
if (0 === $filtered->count()) {
Log::debug('Left with zero accounts, search for invalid account.');
$account = new Account;
$account->id = 0;
$this->collector->$collectorMethod(new Collection([$account]));
return;
}
Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
@@ -636,6 +660,7 @@ class OperatorQuerySearch implements SearchInterface
/**
* searchDirection: 1 = source (default), 2 = destination
* stringPosition: 1 = start (default), 2 = end, 3 = contains, 4 = is
*
* @param string $value
* @param int $searchDirection
* @param int $stringPosition
@@ -675,14 +700,16 @@ class OperatorQuerySearch implements SearchInterface
$account = new Account;
$account->id = 0;
$this->collector->$collectorMethod(new Collection([$account]));
return;
}
// if found, do filter
Log::debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
$filtered = $accounts->filter(function (Account $account) use ($value, $stringMethod) {
$filtered = $accounts->filter(
function (Account $account) use ($value, $stringMethod) {
// either IBAN or account number!
$ibanMatch = $stringMethod(strtolower((string) $account->iban), strtolower((string) $value));
$ibanMatch = $stringMethod(strtolower((string)$account->iban), strtolower((string)$value));
$accountNrMatch = false;
/** @var AccountMeta $meta */
foreach ($account->accountMeta as $meta) {
@@ -690,14 +717,17 @@ class OperatorQuerySearch implements SearchInterface
$accountNrMatch = true;
}
}
return $ibanMatch || $accountNrMatch;
});
}
);
if (0 === $filtered->count()) {
Log::debug('Left with zero, search for invalid account');
$account = new Account;
$account->id = 0;
$this->collector->$collectorMethod(new Collection([$account]));
return;
}
Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
@@ -706,6 +736,7 @@ class OperatorQuerySearch implements SearchInterface
/**
* @param string $value
*
* @return TransactionCurrency|null
*/
private function findCurrency(string $value): ?TransactionCurrency
@@ -721,11 +752,13 @@ class OperatorQuerySearch implements SearchInterface
if (null === $result) {
$result = $this->currencyRepository->findByNameNull($value);
}
return $result;
}
/**
* @param string $operator
*
* @return string
* @throws FireflyException
*/
@@ -737,6 +770,7 @@ class OperatorQuerySearch implements SearchInterface
}
if (true === $config['alias']) {
Log::debug(sprintf('"%s" is an alias for "%s", so return that instead.', $operator, $config['alias_for']));
return $config['alias_for'];
}
Log::debug(sprintf('"%s" is not an alias.', $operator));
@@ -746,6 +780,7 @@ class OperatorQuerySearch implements SearchInterface
/**
* @param string $value
*
* @return array
* @throws FireflyException
*/
@@ -756,6 +791,7 @@ class OperatorQuerySearch implements SearchInterface
return $parser->parseRange($value, today(config('app.timezone')));
}
$date = $parser->parseDate($value);
return [
'start' => $date,
'end' => $date,

View File

@@ -49,9 +49,6 @@ class Steam
*/
public function balance(Account $account, Carbon $date, ?TransactionCurrency $currency = null): string
{
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
}
// abuse chart properties:
$cache = new CacheProperties;
$cache->addProperty($account->id);
@@ -105,9 +102,6 @@ class Steam
*/
public function balanceIgnoreVirtual(Account $account, Carbon $date): string
{
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
}
// abuse chart properties:
$cache = new CacheProperties;
$cache->addProperty($account->id);
@@ -177,9 +171,6 @@ class Steam
*/
public function balanceInRange(Account $account, Carbon $start, Carbon $end, ?TransactionCurrency $currency = null): array
{
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
}
// abuse chart properties:
$cache = new CacheProperties;
$cache->addProperty($account->id);
@@ -264,9 +255,6 @@ class Steam
*/
public function balancePerCurrency(Account $account, Carbon $date): array
{
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
}
// abuse chart properties:
$cache = new CacheProperties;
$cache->addProperty($account->id);
@@ -300,9 +288,6 @@ class Steam
*/
public function balancesByAccounts(Collection $accounts, Carbon $date): array
{
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
}
$ids = $accounts->pluck('id')->toArray();
// cache this property.
$cache = new CacheProperties;
@@ -335,9 +320,6 @@ class Steam
*/
public function balancesPerCurrencyByAccounts(Collection $accounts, Carbon $date): array
{
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
}
$ids = $accounts->pluck('id')->toArray();
// cache this property.
$cache = new CacheProperties;
@@ -497,9 +479,6 @@ class Steam
*/
public function getLastActivities(array $accounts): array
{
if ('testing' === config('app.env')) {
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
}
$list = [];
$set = auth()->user()->transactions()

View File

@@ -77,7 +77,7 @@ class Rule extends AbstractExtension
return new TwigFunction(
'allRuleTriggers',
static function () {
$ruleTriggers = array_keys(config('firefly.search.operators'));;
$ruleTriggers = array_keys(config('firefly.search.operators'));
$possibleTriggers = [];
foreach ($ruleTriggers as $key) {
if ('user_action' !== $key) {

View File

@@ -362,7 +362,7 @@ class FireflyValidator extends Validator
}
// and finally a "will match everything check":
$classes = array_keys(config('firefly.search.operators'));;
$classes = array_keys(config('firefly.search.operators'));
/** @var TriggerInterface $class */
$class = $classes[$triggerType] ?? false;
if (false === $class) {

View File

@@ -226,56 +226,56 @@ return [
],
'subIconsByIdentifier' => [
'asset' => 'fa-money',
'Asset account' => 'fa-money',
'Default account' => 'fa-money',
'Cash account' => 'fa-money',
AccountType::ASSET => 'fa-money',
AccountType::DEFAULT => 'fa-money',
AccountType::CASH => 'fa-money',
'expense' => 'fa-shopping-cart',
'Expense account' => 'fa-shopping-cart',
'Beneficiary account' => 'fa-shopping-cart',
AccountType::EXPENSE => 'fa-shopping-cart',
AccountType::BENEFICIARY => 'fa-shopping-cart',
'revenue' => 'fa-download',
'Revenue account' => 'fa-download',
AccountType::REVENUE => 'fa-download',
'import' => 'fa-download',
'Import account' => 'fa-download',
AccountType::IMPORT => 'fa-download',
'liabilities' => 'fa-ticket',
],
'accountTypesByIdentifier' => [
'asset' => ['Default account', 'Asset account'],
'expense' => ['Expense account', 'Beneficiary account'],
'revenue' => ['Revenue account'],
'import' => ['Import account'],
'liabilities' => ['Loan', 'Debt', 'Credit card', 'Mortgage'],
'asset' => [AccountType::DEFAULT, AccountType::ASSET],
'expense' => [AccountType::EXPENSE, AccountType::BENEFICIARY],
'revenue' => [AccountType::REVENUE],
'import' => [AccountType::IMPORT],
'liabilities' => [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE],
],
'accountTypeByIdentifier' => [
'asset' => ['Asset account'],
'expense' => ['Expense account'],
'revenue' => ['Revenue account'],
'opening' => ['Initial balance account'],
'initial' => ['Initial balance account'],
'import' => ['Import account'],
'reconcile' => ['Reconciliation account'],
'liabilities' => ['Loan', 'Debt', 'Mortgage', 'Credit card'],
'liability' => ['Loan', 'Debt', 'Mortgage', 'Credit card'],
'asset' => [AccountType::ASSET],
'expense' => [AccountType::EXPENSE],
'revenue' => [AccountType::REVENUE],
'opening' => [AccountType::INITIAL_BALANCE],
'initial' => [AccountType::INITIAL_BALANCE],
'import' => [AccountType::IMPORT],
'reconcile' => [AccountType::RECONCILIATION],
'liabilities' => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::CREDITCARD],
'liability' => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::CREDITCARD],
],
'shortNamesByFullName' => [
'Default account' => 'asset',
'Asset account' => 'asset',
'Import account' => 'import',
'Expense account' => 'expense',
'Beneficiary account' => 'expense',
'Revenue account' => 'revenue',
'Cash account' => 'cash',
'Initial balance account' => 'initial-balance',
'Reconciliation account' => 'reconciliation',
'Credit card' => 'liabilities',
'Loan' => 'liabilities',
'Debt' => 'liabilities',
'Mortgage' => 'liabilities',
AccountType::DEFAULT => 'asset',
AccountType::ASSET => 'asset',
AccountType::IMPORT => 'import',
AccountType::EXPENSE => 'expense',
AccountType::BENEFICIARY => 'expense',
AccountType::REVENUE => 'revenue',
AccountType::CASH => 'cash',
AccountType::INITIAL_BALANCE => 'initial-balance',
AccountType::RECONCILIATION => 'reconciliation',
AccountType::CREDITCARD => 'liabilities',
AccountType::LOAN => 'liabilities',
AccountType::DEBT => 'liabilities',
AccountType::MORTGAGE => 'liabilities',
],
'shortLiabilityNameByFullName' => [
'Credit card' => 'creditcard',
'Loan' => 'loan',
'Debt' => 'debt',
'Mortgage' => 'mortgage',
AccountType::CREDITCARD => 'creditcard',
AccountType::LOAN => AccountType::LOAN,
AccountType::DEBT => AccountType::DEBT,
AccountType::MORTGAGE => AccountType::MORTGAGE,
],
/**
* Languages configuration.
@@ -576,7 +576,7 @@ return [
'to_account_nr_ends' => ['alias' => true, 'alias_for' => 'destination_account_nr_ends', 'needs_context' => true,],
// any account id is
'account_id' => ['alias' => false, 'needs_context' => true,], // TODO
'account_id' => ['alias' => false, 'needs_context' => true,],
// category
'category_is' => ['alias' => false, 'needs_context' => true,],
@@ -587,7 +587,7 @@ return [
'budget' => ['alias' => true, 'alias_for' => 'budget_is', 'needs_context' => true,],
// bill
'bill_is' => ['alias' => false, 'needs_context' => true,], // TODO
'bill_is' => ['alias' => false, 'needs_context' => true,],
'bill' => ['alias' => true, 'alias_for' => 'bill_is', 'needs_context' => true,],
// type
@@ -692,8 +692,8 @@ return [
TransactionTypeModel::OPENING_BALANCE,],
AccountType::MORTGAGE => [TransactionTypeModel::WITHDRAWAL, TransactionTypeModel::DEPOSIT, TransactionTypeModel::TRANSFER,
TransactionTypeModel::OPENING_BALANCE,],
AccountType::INITIAL_BALANCE => [], // todo fill me in.
AccountType::RECONCILIATION => [], // todo fill me in.
AccountType::INITIAL_BALANCE => [TransactionTypeModel::OPENING_BALANCE],
AccountType::RECONCILIATION => [TransactionTypeModel::RECONCILIATION],
],
'destination' => [
AccountType::ASSET => [TransactionTypeModel::DEPOSIT, TransactionTypeModel::TRANSFER, TransactionTypeModel::OPENING_BALANCE,
@@ -706,8 +706,8 @@ return [
TransactionTypeModel::OPENING_BALANCE,],
AccountType::MORTGAGE => [TransactionTypeModel::WITHDRAWAL, TransactionTypeModel::DEPOSIT, TransactionTypeModel::TRANSFER,
TransactionTypeModel::OPENING_BALANCE,],
AccountType::INITIAL_BALANCE => [], // todo fill me in.
AccountType::RECONCILIATION => [], // todo fill me in.
AccountType::INITIAL_BALANCE => [TransactionTypeModel::OPENING_BALANCE],
AccountType::RECONCILIATION => [TransactionTypeModel::RECONCILIATION],
],
],

View File

@@ -35,18 +35,6 @@
</div>
</div>
</div>
<!-- TODO -->
<!--
<div class="card-tools">
<ul class="pagination pagination-sm float-right">
<li class="page-item"><a class="page-link" href="#">«</a></li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item"><a class="page-link" href="#">»</a></li>
</ul>
</div>
-->
</div>
<div class="card-body p-0">
<table class="table table-sm table-striped">

View File

@@ -31,7 +31,6 @@ import MainPiggyList from "../components/dashboard/MainPiggyList";
import TransactionListLarge from "../components/transactions/TransactionListLarge";
import TransactionListMedium from "../components/transactions/TransactionListMedium";
import TransactionListSmall from "../components/transactions/TransactionListSmall";
import {Chart} from 'vue-chartjs'
/**
* First we will load Axios via bootstrap.js

View File

@@ -18,9 +18,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import Dashboard from "../components/dashboard/Dashboard";
import TopBoxes from "../components/dashboard/TopBoxes";
/**
* First we will load Axios via bootstrap.js
* jquery and bootstrap-sass preloaded in app.js

View File

@@ -179,10 +179,6 @@ span.info-box-text a:hover, span.info-box-number a:hover {
overflow-x: hidden;
}
.bootstrap-tagsinput {
width: 100%;
}
.accordion {
margin-bottom:-3px;
}

View File

@@ -63,7 +63,6 @@ function stopSorting() {
"use strict";
$.each($('#sortable-table>tbody>tr.sortable-object'), function (i, v) {
var holder = $(v);
var parentBody = holder.parent();
var position = parseInt(holder.data('position'));
var originalOrder = parseInt(holder.data('order'));
var id = holder.data('id');

View File

@@ -45,12 +45,9 @@ var colourSet = [
];
var fillColors = [];
var strokePointHighColors = [];
for (var i = 0; i < colourSet.length; i++) {
fillColors.push("rgba(" + colourSet[i][0] + ", " + colourSet[i][1] + ", " + colourSet[i][2] + ", 0.5)");
strokePointHighColors.push("rgba(" + colourSet[i][0] + ", " + colourSet[i][1] + ", " + colourSet[i][2] + ", 0.9)");
}
Chart.defaults.global.legend.display = false;

View File

@@ -108,7 +108,6 @@ function getBillsBox() {
var unpaid = [];
var paid = [];
for (key in data) {
var row = data[key];
//console.log(key);
if (key.substr(0, 16) === 'bills-unpaid-in-') {
// only when less than 3.

View File

@@ -51,7 +51,7 @@ $(function () {
);
// set report type from cookie, if any:
if (!(readCookie('report-type') === null)) {
if (null !== readCookie('report-type')) {
$('select[name="report_type"]').val(readCookie('report-type'));
}

View File

@@ -252,9 +252,6 @@ function updateActionInput(selectList) {
createAutoComplete(inputResult, 'api/v1/autocomplete/transactions');
break;
case 'set_source_account':
console.log('Select list value is ' + selectList.val() + ', so input needs auto complete.');
createAutoComplete(inputResult, 'api/v1/autocomplete/accounts');
break;
case 'set_destination_account':
console.log('Select list value is ' + selectList.val() + ', so input needs auto complete.');
createAutoComplete(inputResult, 'api/v1/autocomplete/accounts');

View File

@@ -121,7 +121,7 @@
</div>
<!-- Create Client Form -->
<form role="form">
<form role="form" aria-label="form">
<!-- Name -->
<div class="form-group row">
<label class="col-md-3 col-form-label">{{ $t('firefly.name') }}</label>
@@ -208,7 +208,7 @@
</div>
<!-- Edit Client Form -->
<form role="form">
<form role="form" aria-label="form">
<!-- Name -->
<div class="form-group row">
<label class="col-md-3 col-form-label">{{ $t('firefly.name') }}</label>

View File

@@ -842,19 +842,7 @@ export default {
deleteTransaction: function (index, event) {
event.preventDefault();
for (const key in this.transactions) {
if (
this.transactions.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
}
}
this.transactions.splice(index, 1);
for (const key in this.transactions) {
if (
this.transactions.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
}
}
},
limitSourceType: function (type) {
let i;

View File

@@ -585,7 +585,6 @@ export default {
tagList = [];
foreignAmount = '0';
foreignCurrency = null;
// loop tags
for (let tagKey in row.tags) {
if (row.tags.hasOwnProperty(tagKey) && /^0$|^[1-9]\d*$/.test(tagKey) && tagKey <= 4294967294) {