mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 19:01:58 +00:00
Various code cleanup [skip ci]
This commit is contained in:
@@ -24,15 +24,6 @@ use Illuminate\Support\Collection;
|
|||||||
*/
|
*/
|
||||||
interface AccountChartGeneratorInterface
|
interface AccountChartGeneratorInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param Collection $accounts
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function revenueAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
@@ -51,6 +42,15 @@ interface AccountChartGeneratorInterface
|
|||||||
*/
|
*/
|
||||||
public function frontpage(Collection $accounts, Carbon $start, Carbon $end): array;
|
public function frontpage(Collection $accounts, Carbon $start, Carbon $end): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
* @param Carbon $start
|
||||||
|
* @param Carbon $end
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function revenueAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param array $labels
|
* @param array $labels
|
||||||
|
@@ -114,12 +114,11 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ARI $repository
|
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function edit(ARI $repository, Account $account)
|
public function edit(Account $account)
|
||||||
{
|
{
|
||||||
|
|
||||||
$what = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
$what = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
||||||
|
@@ -86,10 +86,10 @@ class UserController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show(UserRepositoryInterface $repository, User $user)
|
public function show(UserRepositoryInterface $repository, User $user)
|
||||||
{
|
{
|
||||||
$title = strval(trans('firefly.administration'));
|
$title = strval(trans('firefly.administration'));
|
||||||
$mainTitleIcon = 'fa-hand-spock-o';
|
$mainTitleIcon = 'fa-hand-spock-o';
|
||||||
$subTitle = strval(trans('firefly.single_user_administration', ['email' => $user->email]));
|
$subTitle = strval(trans('firefly.single_user_administration', ['email' => $user->email]));
|
||||||
$subTitleIcon = 'fa-user';
|
$subTitleIcon = 'fa-user';
|
||||||
|
|
||||||
// get IP info:
|
// get IP info:
|
||||||
$defaultIp = '0.0.0.0';
|
$defaultIp = '0.0.0.0';
|
||||||
|
@@ -13,8 +13,8 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Auth;
|
namespace FireflyIII\Http\Controllers\Auth;
|
||||||
|
|
||||||
use FireflyIII\Events\ResentConfirmation;
|
|
||||||
use FireflyIII\Events\ConfirmedUser;
|
use FireflyIII\Events\ConfirmedUser;
|
||||||
|
use FireflyIII\Events\ResentConfirmation;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
@@ -41,6 +41,8 @@ class ResetPasswordController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$this->middleware('guest');
|
$this->middleware('guest');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -284,10 +284,11 @@ class SingleController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param JournalFormRequest $request
|
* @param JournalFormRequest $request
|
||||||
* @param TransactionJournal $journal
|
* @param JournalRepositoryInterface $repository
|
||||||
|
* @param TransactionJournal $journal
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
*/
|
*/
|
||||||
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
|
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
|
@@ -126,7 +126,7 @@ class SplitController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(Request $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
|
public function update(Request $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
$data = $this->arrayFromInput($request, $journal);
|
$data = $this->arrayFromInput($request);
|
||||||
$journal = $repository->updateSplitJournal($journal, $data);
|
$journal = $repository->updateSplitJournal($journal, $data);
|
||||||
|
|
||||||
// save attachments:
|
// save attachments:
|
||||||
@@ -158,18 +158,17 @@ class SplitController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param TransactionJournal $journal
|
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function arrayFromInput(Request $request, TransactionJournal $journal): array
|
private function arrayFromInput(Request $request): array
|
||||||
{
|
{
|
||||||
$array = [
|
$array = [
|
||||||
'journal_description' => $request->get('journal_description'),
|
'journal_description' => $request->get('journal_description'),
|
||||||
'journal_source_account_id' => $request->get('journal_source_account_id'),
|
'journal_source_account_id' => $request->get('journal_source_account_id'),
|
||||||
'journal_source_account_name' => $request->get('journal_source_account_name'),
|
'journal_source_account_name' => $request->get('journal_source_account_name'),
|
||||||
'journal_destination_account_id' => $request->get('journal_destination_account_id'),
|
'journal_destination_account_id' => $request->get('journal_destination_account_id'),
|
||||||
'currency_id' => $request->get('currency_id'),
|
'currency_id' => $request->get('currency_id'),
|
||||||
'what' => $request->get('what'),
|
'what' => $request->get('what'),
|
||||||
'date' => $request->get('date'),
|
'date' => $request->get('date'),
|
||||||
// all custom fields:
|
// all custom fields:
|
||||||
|
@@ -164,63 +164,4 @@ class JournalFormRequest extends Request
|
|||||||
{
|
{
|
||||||
return $this->get($field) ?? '';
|
return $this->get($field) ?? '';
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * @param int $index
|
|
||||||
// * @param string $field
|
|
||||||
// *
|
|
||||||
// * @return int
|
|
||||||
// */
|
|
||||||
// private function getIntFromArray(int $index, string $field): int
|
|
||||||
// {
|
|
||||||
// $array = $this->get($field);
|
|
||||||
// if (isset($array[$index])) {
|
|
||||||
// return intval($array[$index]);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * @param int $index
|
|
||||||
// * @param string $field
|
|
||||||
// *
|
|
||||||
// * @return string
|
|
||||||
// */
|
|
||||||
// private function getStringFromArray(int $index, string $field): string
|
|
||||||
// {
|
|
||||||
// $array = $this->get($field);
|
|
||||||
// if (isset($array[$index])) {
|
|
||||||
// return trim($array[$index]);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return '';
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * @return array
|
|
||||||
// */
|
|
||||||
// private function getTransactionData(): array
|
|
||||||
// {
|
|
||||||
// $transactions = [];
|
|
||||||
// $array = $this->get('amount');
|
|
||||||
// if (is_array($array) && count($array) > 0) {
|
|
||||||
// foreach ($array as $index => $amount) {
|
|
||||||
// $transaction = [
|
|
||||||
// 'description' => $this->getStringFromArray($index, 'description'),
|
|
||||||
// 'amount' => round($amount, 2),
|
|
||||||
// 'budget_id' => $this->getIntFromArray($index, 'budget_id'),
|
|
||||||
// 'category' => $this->getStringFromArray($index, 'category'),
|
|
||||||
// 'source_account_id' => $this->getIntFromArray($index, 'source_account_id'),
|
|
||||||
// 'source_account_name' => $this->getStringFromArray($index, 'source_account_name'),
|
|
||||||
// 'destination_account_id' => $this->getIntFromArray($index, 'destination_account_id'),
|
|
||||||
// 'destination_account_name' => $this->getStringFromArray($index, 'destination_account_name'),
|
|
||||||
// 'piggy_bank_id' => $this->getIntFromArray($index, 'piggy_bank_id'),
|
|
||||||
// ];
|
|
||||||
// $transactions[] = $transaction;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return $transactions;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@@ -159,7 +159,8 @@ class JournalTasker implements JournalTaskerInterface
|
|||||||
*
|
*
|
||||||
* from transactions as source
|
* from transactions as source
|
||||||
*
|
*
|
||||||
* left join transactions as destination ON source.transaction_journal_id = destination.transaction_journal_id AND source.amount = destination.amount * -1 AND source.identifier = destination.identifier
|
* left join transactions as destination ON source.transaction_journal_id =
|
||||||
|
* destination.transaction_journal_id AND source.amount = destination.amount * -1 AND source.identifier = destination.identifier
|
||||||
* -- left join source account name:
|
* -- left join source account name:
|
||||||
* left join accounts as source_accounts ON source.account_id = source_accounts.id
|
* left join accounts as source_accounts ON source.account_id = source_accounts.id
|
||||||
* left join accounts as destination_accounts ON destination.account_id = destination_accounts.id
|
* left join accounts as destination_accounts ON destination.account_id = destination_accounts.id
|
||||||
|
Reference in New Issue
Block a user