mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Various code cleanup.
This commit is contained in:
@@ -269,15 +269,6 @@ class UpgradeDatabase extends Command
|
|||||||
$this->updateJournalCurrency($transaction);
|
$this->updateJournalCurrency($transaction);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// /** @var Collection $transactions */
|
|
||||||
// $transactions = $transfer->transactions()->where('amount', '>', 0)->get();
|
|
||||||
// $transactions->each(
|
|
||||||
// function (Transaction $transaction) {
|
|
||||||
// $this->updateTransactionCurrency($transaction);
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -292,6 +292,7 @@ class VerifyDatabase extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Report on things with no linked journals.
|
* Report on things with no linked journals.
|
||||||
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
private function reportObject(string $name)
|
private function reportObject(string $name)
|
||||||
|
@@ -138,9 +138,11 @@ final class Entry
|
|||||||
$entry->foreign_currency_code = is_null($transaction->foreign_currency_id) ? null : $transaction->foreignCurrency->code;
|
$entry->foreign_currency_code = is_null($transaction->foreign_currency_id) ? null : $transaction->foreignCurrency->code;
|
||||||
$entry->foreign_amount = is_null($transaction->foreign_currency_id)
|
$entry->foreign_amount = is_null($transaction->foreign_currency_id)
|
||||||
? null
|
? null
|
||||||
: strval(round(
|
: strval(
|
||||||
|
round(
|
||||||
$transaction->transaction_foreign_amount, $transaction->foreignCurrency->decimal_places
|
$transaction->transaction_foreign_amount, $transaction->foreignCurrency->decimal_places
|
||||||
));
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$entry->transaction_type = $transaction->transaction_type_type;
|
$entry->transaction_type = $transaction->transaction_type_type;
|
||||||
$entry->asset_account_id = $transaction->account_id;
|
$entry->asset_account_id = $transaction->account_id;
|
||||||
|
@@ -15,7 +15,6 @@ namespace FireflyIII\Helpers\Collector;
|
|||||||
|
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Crypt;
|
|
||||||
use DB;
|
use DB;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Helpers\Filter\FilterInterface;
|
use FireflyIII\Helpers\Filter\FilterInterface;
|
||||||
|
@@ -14,16 +14,12 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Helpers\Report;
|
namespace FireflyIII\Helpers\Report;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use DB;
|
|
||||||
use FireflyIII\Helpers\Collection\Balance;
|
use FireflyIII\Helpers\Collection\Balance;
|
||||||
use FireflyIII\Helpers\Collection\BalanceEntry;
|
use FireflyIII\Helpers\Collection\BalanceEntry;
|
||||||
use FireflyIII\Helpers\Collection\BalanceHeader;
|
use FireflyIII\Helpers\Collection\BalanceHeader;
|
||||||
use FireflyIII\Helpers\Collection\BalanceLine;
|
use FireflyIII\Helpers\Collection\BalanceLine;
|
||||||
use FireflyIII\Models\BudgetLimit;
|
use FireflyIII\Models\BudgetLimit;
|
||||||
use FireflyIII\Models\Tag;
|
|
||||||
use FireflyIII\Models\TransactionType;
|
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use Illuminate\Database\Query\JoinClause;
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
@@ -89,7 +85,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param BudgetLimit $budgetLimit
|
* @param BudgetLimit $budgetLimit
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
@@ -142,7 +137,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Balance $balance
|
* @param Balance $balance
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
|
||||||
|
@@ -62,6 +62,8 @@ class LinkController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
* @param LinkTypeRepositoryInterface $repository
|
||||||
* @param LinkType $linkType
|
* @param LinkType $linkType
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
@@ -136,6 +138,8 @@ class LinkController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param LinkTypeRepositoryInterface $repository
|
||||||
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function index(LinkTypeRepositoryInterface $repository)
|
public function index(LinkTypeRepositoryInterface $repository)
|
||||||
@@ -153,6 +157,8 @@ class LinkController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param LinkType $linkType
|
||||||
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function show(LinkType $linkType)
|
public function show(LinkType $linkType)
|
||||||
|
@@ -17,7 +17,6 @@ namespace FireflyIII\Http\Controllers;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use ExpandedForm;
|
use ExpandedForm;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Export\ExpandedProcessor;
|
|
||||||
use FireflyIII\Export\ProcessorInterface;
|
use FireflyIII\Export\ProcessorInterface;
|
||||||
use FireflyIII\Http\Requests\ExportFormRequest;
|
use FireflyIII\Http\Requests\ExportFormRequest;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
|
@@ -26,6 +26,10 @@ class BankController extends Controller
|
|||||||
* This method must ask the user all parameters necessary to start importing data. This may not be enough
|
* This method must ask the user all parameters necessary to start importing data. This may not be enough
|
||||||
* to finish the import itself (ie. mapping) but it should be enough to begin: accounts to import from,
|
* to finish the import itself (ie. mapping) but it should be enough to begin: accounts to import from,
|
||||||
* accounts to import into, data ranges, etc.
|
* accounts to import into, data ranges, etc.
|
||||||
|
*
|
||||||
|
* @param string $bank
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function form(string $bank)
|
public function form(string $bank)
|
||||||
{
|
{
|
||||||
@@ -77,15 +81,11 @@ class BankController extends Controller
|
|||||||
$remoteAccounts = array_keys($remoteAccounts);
|
$remoteAccounts = array_keys($remoteAccounts);
|
||||||
|
|
||||||
$class = config(sprintf('firefly.import_pre.%s', $bank));
|
$class = config(sprintf('firefly.import_pre.%s', $bank));
|
||||||
|
|
||||||
var_dump($remoteAccounts);exit;
|
|
||||||
|
|
||||||
// get import file
|
// get import file
|
||||||
|
|
||||||
// get import config
|
// get import config
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -94,6 +94,8 @@ class AutoCompleteController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @param JournalCollectorInterface $collector
|
* @param JournalCollectorInterface $collector
|
||||||
*
|
*
|
||||||
|
* @param TransactionJournal $except
|
||||||
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse|mixed
|
* @return \Illuminate\Http\JsonResponse|mixed
|
||||||
*/
|
*/
|
||||||
public function journalsWithId(JournalCollectorInterface $collector, TransactionJournal $except)
|
public function journalsWithId(JournalCollectorInterface $collector, TransactionJournal $except)
|
||||||
|
@@ -194,8 +194,12 @@ class RuleController extends Controller
|
|||||||
Session::flash('gaEventCategory', 'rules');
|
Session::flash('gaEventCategory', 'rules');
|
||||||
Session::flash('gaEventAction', 'edit-rule');
|
Session::flash('gaEventAction', 'edit-rule');
|
||||||
|
|
||||||
return view('rules.rule.edit', compact('rule', 'subTitle',
|
return view(
|
||||||
'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount','ruleGroups'));
|
'rules.rule.edit', compact(
|
||||||
|
'rule', 'subTitle',
|
||||||
|
'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount', 'ruleGroups'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -101,7 +101,7 @@ class LinkController extends Controller
|
|||||||
if ($alreadyLinked) {
|
if ($alreadyLinked) {
|
||||||
Session::flash('error', trans('firefly.journals_error_linked'));
|
Session::flash('error', trans('firefly.journals_error_linked'));
|
||||||
|
|
||||||
return redirect(route('transactions.show', $journal->id));
|
return redirect(route('transactions.show', [$journal->id]));
|
||||||
}
|
}
|
||||||
Log::debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));
|
Log::debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));
|
||||||
|
|
||||||
@@ -123,9 +123,15 @@ class LinkController extends Controller
|
|||||||
$journalLink->save();
|
$journalLink->save();
|
||||||
Session::flash('success', trans('firefly.journals_linked'));
|
Session::flash('success', trans('firefly.journals_linked'));
|
||||||
|
|
||||||
return redirect(route('transactions.show', $journal->id));
|
return redirect(route('transactions.show', [$journal->id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param LinkTypeRepositoryInterface $repository
|
||||||
|
* @param TransactionJournalLink $link
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||||
|
*/
|
||||||
public function switch(LinkTypeRepositoryInterface $repository, TransactionJournalLink $link)
|
public function switch(LinkTypeRepositoryInterface $repository, TransactionJournalLink $link)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -413,9 +413,9 @@ class SingleController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function groupedActiveAccountList(): array
|
private function groupedAccountList(): array
|
||||||
{
|
{
|
||||||
$accounts = $this->accounts->getActiveAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
$accounts = $this->accounts->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
$return = [];
|
$return = [];
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
@@ -433,9 +433,9 @@ class SingleController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function groupedAccountList(): array
|
private function groupedActiveAccountList(): array
|
||||||
{
|
{
|
||||||
$accounts = $this->accounts->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
$accounts = $this->accounts->getActiveAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||||
$return = [];
|
$return = [];
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
|
@@ -211,7 +211,7 @@ class SplitController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SplitJournalFormRequest $request
|
* @param SplitJournalFormRequest|Request $request
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
@@ -295,7 +295,7 @@ class SplitController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param SplitJournalFormRequest|Request $request
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@@ -154,6 +154,8 @@ class TransactionController extends Controller
|
|||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
* @param JournalTaskerInterface $tasker
|
* @param JournalTaskerInterface $tasker
|
||||||
*
|
*
|
||||||
|
* @param LinkTypeRepositoryInterface $linkTypeRepository
|
||||||
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
*/
|
*/
|
||||||
public function show(TransactionJournal $journal, JournalTaskerInterface $tasker, LinkTypeRepositoryInterface $linkTypeRepository)
|
public function show(TransactionJournal $journal, JournalTaskerInterface $tasker, LinkTypeRepositoryInterface $linkTypeRepository)
|
||||||
@@ -198,7 +200,7 @@ class TransactionController extends Controller
|
|||||||
$cache->addProperty('transaction-list-entries');
|
$cache->addProperty('transaction-list-entries');
|
||||||
|
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
// return $cache->get(); // @codeCoverageIgnore
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::debug(sprintf('Going to get period expenses and incomes between %s and %s.', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
Log::debug(sprintf('Going to get period expenses and incomes between %s and %s.', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||||
|
@@ -43,14 +43,14 @@ class ExportFormRequest extends Request
|
|||||||
$formats = join(',', array_keys(config('firefly.export_formats')));
|
$formats = join(',', array_keys(config('firefly.export_formats')));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// 'export_start_range' => 'required|date|after:' . $first,
|
'export_start_range' => 'required|date|after:' . $first,
|
||||||
// 'export_end_range' => 'required|date|before:' . $today,
|
'export_end_range' => 'required|date|before:' . $today,
|
||||||
// 'accounts' => 'required',
|
'accounts' => 'required',
|
||||||
// 'job' => 'required|belongsToUser:export_jobs,key',
|
'job' => 'required|belongsToUser:export_jobs,key',
|
||||||
// 'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
|
'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
|
||||||
// 'include_attachments' => 'in:0,1',
|
'include_attachments' => 'in:0,1',
|
||||||
// 'include_config' => 'in:0,1',
|
'include_config' => 'in:0,1',
|
||||||
// 'exportFormat' => 'in:' . $formats,
|
'exportFormat' => 'in:' . $formats,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,53 +33,6 @@ class Request extends FormRequest
|
|||||||
return intval($this->input($field)) === 1;
|
return intval($this->input($field)) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $field
|
|
||||||
*
|
|
||||||
* @return Carbon|null
|
|
||||||
*/
|
|
||||||
protected function date(string $field)
|
|
||||||
{
|
|
||||||
return $this->get($field) ? new Carbon($this->get($field)) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $field
|
|
||||||
*
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
protected function float(string $field): float
|
|
||||||
{
|
|
||||||
return round($this->input($field), 12);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $field
|
|
||||||
* @param string $type
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function getArray(string $field, string $type): array
|
|
||||||
{
|
|
||||||
$original = $this->get($field);
|
|
||||||
$return = [];
|
|
||||||
foreach ($original as $index => $value) {
|
|
||||||
$return[$index] = $this->$type($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $field
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
protected function integer(string $field): int
|
|
||||||
{
|
|
||||||
return intval($this->get($field));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $field
|
* @param string $field
|
||||||
*
|
*
|
||||||
@@ -140,4 +93,51 @@ class Request extends FormRequest
|
|||||||
|
|
||||||
return trim($string);
|
return trim($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $field
|
||||||
|
*
|
||||||
|
* @return Carbon|null
|
||||||
|
*/
|
||||||
|
protected function date(string $field)
|
||||||
|
{
|
||||||
|
return $this->get($field) ? new Carbon($this->get($field)) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $field
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
protected function float(string $field): float
|
||||||
|
{
|
||||||
|
return round($this->input($field), 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $field
|
||||||
|
* @param string $type
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getArray(string $field, string $type): array
|
||||||
|
{
|
||||||
|
$original = $this->get($field);
|
||||||
|
$return = [];
|
||||||
|
foreach ($original as $index => $value) {
|
||||||
|
$return[$index] = $this->$type($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $field
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function integer(string $field): int
|
||||||
|
{
|
||||||
|
return intval($this->get($field));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RegisteredUser.php
|
* RegisteredUser.php
|
||||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RequestedNewPassword.php
|
* RequestedNewPassword.php
|
||||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||||
|
@@ -84,6 +84,7 @@ class PiggyBank extends Model
|
|||||||
return $this->currentRep;
|
return $this->currentRep;
|
||||||
}
|
}
|
||||||
// repeating piggy banks are no longer supported.
|
// repeating piggy banks are no longer supported.
|
||||||
|
/** @var PiggyBankRepetition $rep */
|
||||||
$rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']);
|
$rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']);
|
||||||
if (is_null($rep)) {
|
if (is_null($rep)) {
|
||||||
return new PiggyBankRepetition();
|
return new PiggyBankRepetition();
|
||||||
|
@@ -140,6 +140,14 @@ class TransactionJournal extends Model
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return HasMany
|
||||||
|
*/
|
||||||
|
public function destinationJournalLinks(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(TransactionJournalLink::class, 'destination_id');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param $value
|
* @param $value
|
||||||
@@ -379,13 +387,6 @@ class TransactionJournal extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(TransactionJournalLink::class, 'source_id');
|
return $this->hasMany(TransactionJournalLink::class, 'source_id');
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @return HasMany
|
|
||||||
*/
|
|
||||||
public function destinationJournalLinks(): HasMany
|
|
||||||
{
|
|
||||||
return $this->hasMany(TransactionJournalLink::class, 'destination_id');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||||
|
@@ -39,13 +39,6 @@ interface LinkTypeRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function destroy(LinkType $linkType, LinkType $moveTo): bool;
|
public function destroy(LinkType $linkType, LinkType $moveTo): bool;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $id
|
|
||||||
*
|
|
||||||
* @return LinkType
|
|
||||||
*/
|
|
||||||
public function find(int $id): LinkType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TransactionJournalLink $link
|
* @param TransactionJournalLink $link
|
||||||
*
|
*
|
||||||
@@ -54,11 +47,11 @@ interface LinkTypeRepositoryInterface
|
|||||||
public function destroyLink(TransactionJournalLink $link): bool;
|
public function destroyLink(TransactionJournalLink $link): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TransactionJournalLink $link
|
* @param int $id
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return LinkType
|
||||||
*/
|
*/
|
||||||
public function switchLink(TransactionJournalLink $link): bool;
|
public function find(int $id): LinkType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if link exists between journals.
|
* Check if link exists between journals.
|
||||||
@@ -91,6 +84,13 @@ interface LinkTypeRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function store(array $data): LinkType;
|
public function store(array $data): LinkType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param TransactionJournalLink $link
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function switchLink(TransactionJournalLink $link): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param LinkType $linkType
|
* @param LinkType $linkType
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
@@ -186,6 +186,34 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
return new Carbon;
|
return new Carbon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Same as sum of tag but substracts income instead of adding it as well.
|
||||||
|
*
|
||||||
|
* @param Tag $tag
|
||||||
|
* @param Carbon|null $start
|
||||||
|
* @param Carbon|null $end
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function resultOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): string
|
||||||
|
{
|
||||||
|
/** @var JournalCollectorInterface $collector */
|
||||||
|
$collector = app(JournalCollectorInterface::class);
|
||||||
|
|
||||||
|
if (!is_null($start) && !is_null($end)) {
|
||||||
|
$collector->setRange($start, $end);
|
||||||
|
}
|
||||||
|
|
||||||
|
$collector->setAllAssetAccounts()->setTag($tag);
|
||||||
|
$journals = $collector->getJournals();
|
||||||
|
$sum = '0';
|
||||||
|
foreach ($journals as $journal) {
|
||||||
|
$sum = bcadd($sum, strval($journal->transaction_amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
return strval($sum);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
@@ -262,34 +290,6 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
return strval($sum);
|
return strval($sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Same as sum of tag but substracts income instead of adding it as well.
|
|
||||||
*
|
|
||||||
* @param Tag $tag
|
|
||||||
* @param Carbon|null $start
|
|
||||||
* @param Carbon|null $end
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function resultOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): string
|
|
||||||
{
|
|
||||||
/** @var JournalCollectorInterface $collector */
|
|
||||||
$collector = app(JournalCollectorInterface::class);
|
|
||||||
|
|
||||||
if (!is_null($start) && !is_null($end)) {
|
|
||||||
$collector->setRange($start, $end);
|
|
||||||
}
|
|
||||||
|
|
||||||
$collector->setAllAssetAccounts()->setTag($tag);
|
|
||||||
$journals = $collector->getJournals();
|
|
||||||
$sum = '0';
|
|
||||||
foreach ($journals as $journal) {
|
|
||||||
$sum = bcadd($sum, strval($journal->transaction_amount));
|
|
||||||
}
|
|
||||||
|
|
||||||
return strval($sum);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a tag cloud.
|
* Generates a tag cloud.
|
||||||
*
|
*
|
||||||
@@ -382,6 +382,7 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
// no difference? Every tag same range:
|
// no difference? Every tag same range:
|
||||||
if ($amountDiff === 0.0) {
|
if ($amountDiff === 0.0) {
|
||||||
Log::debug(sprintf('AmountDiff is zero, return %d', $range[0]));
|
Log::debug(sprintf('AmountDiff is zero, return %d', $range[0]));
|
||||||
|
|
||||||
return $range[0];
|
return $range[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -103,11 +103,6 @@ interface TagRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function lastUseDate(Tag $tag): Carbon;
|
public function lastUseDate(Tag $tag): Carbon;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public function setUser(User $user);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
* @param Carbon|null $start
|
* @param Carbon|null $start
|
||||||
@@ -117,6 +112,11 @@ interface TagRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function resultOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): string;
|
public function resultOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
*/
|
||||||
|
public function setUser(User $user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
|
@@ -26,8 +26,6 @@ class NotificationFilter extends BunqObject
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $data)
|
public function __construct(array $data)
|
||||||
{
|
{
|
||||||
var_dump($data);
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -127,11 +127,6 @@ class UserPerson extends BunqObject
|
|||||||
// document front, back attachment
|
// document front, back attachment
|
||||||
// customer, customer_limit
|
// customer, customer_limit
|
||||||
// billing contracts
|
// billing contracts
|
||||||
|
|
||||||
// echo '<pre>';
|
|
||||||
// print_r($data);
|
|
||||||
// var_dump($this);
|
|
||||||
// echo '</pre>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Services\Bunq\Request;
|
namespace FireflyIII\Services\Bunq\Request;
|
||||||
|
|
||||||
use FireflyIII\Services\Bunq\Token\InstallationToken;
|
|
||||||
use FireflyIII\Services\Bunq\Token\SessionToken;
|
use FireflyIII\Services\Bunq\Token\SessionToken;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
@@ -36,6 +35,7 @@ class DeleteDeviceSessionRequest extends BunqRequest
|
|||||||
$headers = $this->getDefaultHeaders();
|
$headers = $this->getDefaultHeaders();
|
||||||
$headers['X-Bunq-Client-Authentication'] = $this->sessionToken->getToken();
|
$headers['X-Bunq-Client-Authentication'] = $this->sessionToken->getToken();
|
||||||
$this->sendSignedBunqDelete($uri, $headers);
|
$this->sendSignedBunqDelete($uri, $headers);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,15 +34,6 @@ class ListDeviceServerRequest extends BunqRequest
|
|||||||
$this->devices = new Collection;
|
$this->devices = new Collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getDevices(): Collection
|
|
||||||
{
|
|
||||||
return $this->devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -64,6 +55,14 @@ class ListDeviceServerRequest extends BunqRequest
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getDevices(): Collection
|
||||||
|
{
|
||||||
|
return $this->devices;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param InstallationToken $installationToken
|
* @param InstallationToken $installationToken
|
||||||
*/
|
*/
|
||||||
|
@@ -30,14 +30,6 @@ class ListMonetaryAccountRequest extends BunqRequest
|
|||||||
/** @var int */
|
/** @var int */
|
||||||
private $userId = 0;
|
private $userId = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getMonetaryAccounts(): Collection
|
|
||||||
{
|
|
||||||
return $this->monetaryAccounts;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -60,6 +52,14 @@ class ListMonetaryAccountRequest extends BunqRequest
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getMonetaryAccounts(): Collection
|
||||||
|
{
|
||||||
|
return $this->monetaryAccounts;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SessionToken $sessionToken
|
* @param SessionToken $sessionToken
|
||||||
*/
|
*/
|
||||||
|
@@ -13,7 +13,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Support\Import\Information;
|
namespace FireflyIII\Support\Import\Information;
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
|
||||||
use FireflyIII\Services\Bunq\Object\Alias;
|
use FireflyIII\Services\Bunq\Object\Alias;
|
||||||
use FireflyIII\Services\Bunq\Object\MonetaryAccountBank;
|
use FireflyIII\Services\Bunq\Object\MonetaryAccountBank;
|
||||||
use FireflyIII\Services\Bunq\Request\DeleteDeviceSessionRequest;
|
use FireflyIII\Services\Bunq\Request\DeleteDeviceSessionRequest;
|
||||||
|
@@ -13,7 +13,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Support\Import\Information;
|
namespace FireflyIII\Support\Import\Information;
|
||||||
|
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface InformationInterface
|
* Interface InformationInterface
|
||||||
@@ -23,13 +22,6 @@ use Illuminate\Support\Collection;
|
|||||||
interface InformationInterface
|
interface InformationInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
|
|
||||||
*
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public function setUser(User $user): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a collection of accounts. Preferrably, these follow a uniform Firefly III format so they can be managed over banks.
|
* Returns a collection of accounts. Preferrably, these follow a uniform Firefly III format so they can be managed over banks.
|
||||||
*
|
*
|
||||||
@@ -46,4 +38,11 @@ interface InformationInterface
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAccounts(): array;
|
public function getAccounts(): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
*/
|
||||||
|
public function setUser(User $user): void;
|
||||||
}
|
}
|
||||||
|
@@ -32,13 +32,6 @@ interface PrerequisitesInterface
|
|||||||
*/
|
*/
|
||||||
public function getViewParameters(): array;
|
public function getViewParameters(): array;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Request $request
|
|
||||||
*
|
|
||||||
* @return MessageBag
|
|
||||||
*/
|
|
||||||
public function storePrerequisites(Request $request): MessageBag;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if this import method has any special prerequisites such as config
|
* Returns if this import method has any special prerequisites such as config
|
||||||
* variables or other things.
|
* variables or other things.
|
||||||
@@ -53,4 +46,11 @@ interface PrerequisitesInterface
|
|||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
public function setUser(User $user): void;
|
public function setUser(User $user): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return MessageBag
|
||||||
|
*/
|
||||||
|
public function storePrerequisites(Request $request): MessageBag;
|
||||||
}
|
}
|
||||||
|
@@ -114,14 +114,11 @@ class AmountFormat extends Twig_Extension
|
|||||||
*
|
*
|
||||||
* @return Twig_SimpleFunction
|
* @return Twig_SimpleFunction
|
||||||
*/
|
*/
|
||||||
protected function formatAmountBySymbol(): Twig_SimpleFunction
|
protected function formatAmountByCurrency(): Twig_SimpleFunction
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'formatAmountBySymbol', function (string $amount, string $symbol, int $decimalPlaces = 2, bool $coloured = true): string {
|
'formatAmountByCurrency', function (TransactionCurrency $currency, string $amount, bool $coloured = true): string {
|
||||||
|
|
||||||
$currency = new TransactionCurrency;
|
|
||||||
$currency->symbol = $symbol;
|
|
||||||
$currency->decimal_places = $decimalPlaces;
|
|
||||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||||
|
|
||||||
|
|
||||||
@@ -134,10 +131,14 @@ class AmountFormat extends Twig_Extension
|
|||||||
*
|
*
|
||||||
* @return Twig_SimpleFunction
|
* @return Twig_SimpleFunction
|
||||||
*/
|
*/
|
||||||
protected function formatAmountByCurrency(): Twig_SimpleFunction
|
protected function formatAmountBySymbol(): Twig_SimpleFunction
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'formatAmountByCurrency', function (TransactionCurrency $currency, string $amount, bool $coloured = true): string {
|
'formatAmountBySymbol', function (string $amount, string $symbol, int $decimalPlaces = 2, bool $coloured = true): string {
|
||||||
|
|
||||||
|
$currency = new TransactionCurrency;
|
||||||
|
$currency->symbol = $symbol;
|
||||||
|
$currency->decimal_places = $decimalPlaces;
|
||||||
|
|
||||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||||
|
|
||||||
|
@@ -57,6 +57,14 @@ class Translation extends Twig_Extension
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getName(): string
|
||||||
|
{
|
||||||
|
return 'FireflyIII\Support\Twig\Translation';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Twig_SimpleFunction
|
* @return Twig_SimpleFunction
|
||||||
*/
|
*/
|
||||||
@@ -76,12 +84,4 @@ class Translation extends Twig_Extension
|
|||||||
}, ['is_safe' => ['html']]
|
}, ['is_safe' => ['html']]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function getName(): string
|
|
||||||
{
|
|
||||||
return 'FireflyIII\Support\Twig\Translation';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -13,14 +13,12 @@ namespace Tests\Feature\Controllers;
|
|||||||
|
|
||||||
use Amount;
|
use Amount;
|
||||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||||
use FireflyIII\Models\AccountType;
|
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
use FireflyIII\Models\Category;
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Models\Tag;
|
use FireflyIII\Models\Tag;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
|
||||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||||
|
@@ -18,7 +18,6 @@ use FireflyIII\Models\TransactionJournal;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,7 +19,6 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Steam;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user