mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Code clean up.
This commit is contained in:
@@ -176,7 +176,7 @@ class AmountFormat extends Twig_Extension
|
||||
'formatDestinationAfter',
|
||||
function (array $transaction): string {
|
||||
|
||||
// build fake currency for main amount.
|
||||
// build fake currency for main amount.
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['transaction_currency_dp'];
|
||||
$format->symbol = $transaction['transaction_currency_symbol'];
|
||||
@@ -207,7 +207,7 @@ class AmountFormat extends Twig_Extension
|
||||
'formatDestinationBefore',
|
||||
function (array $transaction): string {
|
||||
|
||||
// build fake currency for main amount.
|
||||
// build fake currency for main amount.
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['transaction_currency_dp'];
|
||||
$format->symbol = $transaction['transaction_currency_symbol'];
|
||||
@@ -227,7 +227,7 @@ class AmountFormat extends Twig_Extension
|
||||
'formatSourceAfter',
|
||||
function (array $transaction): string {
|
||||
|
||||
// build fake currency for main amount.
|
||||
// build fake currency for main amount.
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['transaction_currency_dp'];
|
||||
$format->symbol = $transaction['transaction_currency_symbol'];
|
||||
@@ -258,7 +258,7 @@ class AmountFormat extends Twig_Extension
|
||||
'formatSourceBefore',
|
||||
function (array $transaction): string {
|
||||
|
||||
// build fake currency for main amount.
|
||||
// build fake currency for main amount.
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['transaction_currency_dp'];
|
||||
$format->symbol = $transaction['transaction_currency_symbol'];
|
||||
|
@@ -310,7 +310,7 @@ class Transaction extends Twig_Extension
|
||||
$other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)
|
||||
->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where(
|
||||
'identifier',
|
||||
$transaction->identifier
|
||||
$transaction->identifier
|
||||
)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
@@ -489,7 +489,7 @@ class Transaction extends Twig_Extension
|
||||
$other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)
|
||||
->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where(
|
||||
'identifier',
|
||||
$transaction->identifier
|
||||
$transaction->identifier
|
||||
)
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
|
@@ -118,8 +118,8 @@ class General extends Twig_Extension
|
||||
function ($context): string {
|
||||
$args = func_get_args();
|
||||
$route = $args[1]; // name of the route.
|
||||
$what = $args[2]; // name of the route.
|
||||
$activeWhat = $context['what'] ?? false;
|
||||
$what = $args[2]; // name of the route.
|
||||
$activeWhat = $context['what'] ?? false;
|
||||
|
||||
if ($what === $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) {
|
||||
return 'active';
|
||||
@@ -194,7 +194,7 @@ class General extends Twig_Extension
|
||||
'filesize',
|
||||
function (int $size): string {
|
||||
|
||||
// less than one GB, more than one MB
|
||||
// less than one GB, more than one MB
|
||||
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
||||
return round($size / (1024 * 1024), 2) . ' MB';
|
||||
}
|
||||
@@ -245,14 +245,14 @@ class General extends Twig_Extension
|
||||
'mimeIcon',
|
||||
function (string $string): string {
|
||||
switch ($string) {
|
||||
default:
|
||||
return 'fa-file-o';
|
||||
case 'application/pdf':
|
||||
return 'fa-file-pdf-o';
|
||||
case 'image/png':
|
||||
case 'image/jpeg':
|
||||
return 'fa-file-image-o';
|
||||
}
|
||||
default:
|
||||
return 'fa-file-o';
|
||||
case 'application/pdf':
|
||||
return 'fa-file-pdf-o';
|
||||
case 'image/png':
|
||||
case 'image/jpeg':
|
||||
return 'fa-file-image-o';
|
||||
}
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
);
|
||||
|
@@ -207,11 +207,11 @@ class Journal extends Twig_Extension
|
||||
}
|
||||
if (count($categories) === 0) {
|
||||
$set = Category::distinct()->leftJoin('category_transaction', 'categories.id', '=', 'category_transaction.category_id')
|
||||
->leftJoin('transactions', 'category_transaction.transaction_id', '=', 'transactions.id')
|
||||
->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('categories.user_id', $journal->user_id)
|
||||
->where('transaction_journals.id', $journal->id)
|
||||
->get(['categories.*']);
|
||||
->leftJoin('transactions', 'category_transaction.transaction_id', '=', 'transactions.id')
|
||||
->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('categories.user_id', $journal->user_id)
|
||||
->where('transaction_journals.id', $journal->id)
|
||||
->get(['categories.*']);
|
||||
/** @var Category $category */
|
||||
foreach ($set as $category) {
|
||||
$categories[] = sprintf('<a title="%1$s" href="%2$s">%1$s</a>', e($category->name), route('categories.show', $category->id));
|
||||
|
@@ -66,9 +66,9 @@ class Rule extends Twig_Extension
|
||||
'allJournalTriggers',
|
||||
function () {
|
||||
return [
|
||||
'store-journal' => trans('firefly.rule_trigger_store_journal'),
|
||||
'update-journal' => trans('firefly.rule_trigger_update_journal'),
|
||||
];
|
||||
'store-journal' => trans('firefly.rule_trigger_store_journal'),
|
||||
'update-journal' => trans('firefly.rule_trigger_update_journal'),
|
||||
];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user