mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code cleanup.
This commit is contained in:
parent
0543733e3d
commit
3a3eb4e84f
@ -269,15 +269,6 @@ class UpgradeDatabase extends Command
|
||||
$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.
|
||||
*
|
||||
* @param 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_amount = is_null($transaction->foreign_currency_id)
|
||||
? null
|
||||
: strval(round(
|
||||
$transaction->transaction_foreign_amount, $transaction->foreignCurrency->decimal_places
|
||||
));
|
||||
: strval(
|
||||
round(
|
||||
$transaction->transaction_foreign_amount, $transaction->foreignCurrency->decimal_places
|
||||
)
|
||||
);
|
||||
|
||||
$entry->transaction_type = $transaction->transaction_type_type;
|
||||
$entry->asset_account_id = $transaction->account_id;
|
||||
|
@ -15,7 +15,6 @@ namespace FireflyIII\Helpers\Collector;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use DB;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Filter\FilterInterface;
|
||||
|
@ -14,16 +14,12 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Helpers\Report;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
use FireflyIII\Helpers\Collection\Balance;
|
||||
use FireflyIII\Helpers\Collection\BalanceEntry;
|
||||
use FireflyIII\Helpers\Collection\BalanceHeader;
|
||||
use FireflyIII\Helpers\Collection\BalanceLine;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
@ -74,7 +70,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
||||
$line = $this->createBalanceLine($budgetLimit, $accounts);
|
||||
$balance->addBalanceLine($line);
|
||||
}
|
||||
$noBudgetLine = $this->createNoBudgetLine($accounts, $start, $end);
|
||||
$noBudgetLine = $this->createNoBudgetLine($accounts, $start, $end);
|
||||
|
||||
$balance->addBalanceLine($noBudgetLine);
|
||||
$balance->setBalanceHeader($header);
|
||||
@ -89,7 +85,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param BudgetLimit $budgetLimit
|
||||
* @param Collection $accounts
|
||||
@ -142,7 +137,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param Balance $balance
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
|
||||
|
@ -62,7 +62,9 @@ class LinkController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LinkType $linkType
|
||||
* @param Request $request
|
||||
* @param LinkTypeRepositoryInterface $repository
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function index(LinkTypeRepositoryInterface $repository)
|
||||
@ -153,6 +157,8 @@ class LinkController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function show(LinkType $linkType)
|
||||
|
@ -17,7 +17,6 @@ namespace FireflyIII\Http\Controllers;
|
||||
use Carbon\Carbon;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Export\ExpandedProcessor;
|
||||
use FireflyIII\Export\ProcessorInterface;
|
||||
use FireflyIII\Http\Requests\ExportFormRequest;
|
||||
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
|
||||
* 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.
|
||||
*
|
||||
* @param string $bank
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function form(string $bank)
|
||||
{
|
||||
@ -77,15 +81,11 @@ class BankController extends Controller
|
||||
$remoteAccounts = array_keys($remoteAccounts);
|
||||
|
||||
$class = config(sprintf('firefly.import_pre.%s', $bank));
|
||||
|
||||
var_dump($remoteAccounts);exit;
|
||||
|
||||
// get import file
|
||||
|
||||
// get import config
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,6 +94,8 @@ class AutoCompleteController extends Controller
|
||||
/**
|
||||
* @param JournalCollectorInterface $collector
|
||||
*
|
||||
* @param TransactionJournal $except
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse|mixed
|
||||
*/
|
||||
public function journalsWithId(JournalCollectorInterface $collector, TransactionJournal $except)
|
||||
|
@ -194,8 +194,12 @@ class RuleController extends Controller
|
||||
Session::flash('gaEventCategory', 'rules');
|
||||
Session::flash('gaEventAction', 'edit-rule');
|
||||
|
||||
return view('rules.rule.edit', compact('rule', 'subTitle',
|
||||
'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount','ruleGroups'));
|
||||
return view(
|
||||
'rules.rule.edit', compact(
|
||||
'rule', 'subTitle',
|
||||
'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount', 'ruleGroups'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,7 +101,7 @@ class LinkController extends Controller
|
||||
if ($alreadyLinked) {
|
||||
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));
|
||||
|
||||
@ -123,9 +123,15 @@ class LinkController extends Controller
|
||||
$journalLink->save();
|
||||
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)
|
||||
{
|
||||
|
||||
|
@ -413,9 +413,9 @@ class SingleController extends Controller
|
||||
/**
|
||||
* @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 = [];
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
@ -433,9 +433,9 @@ class SingleController extends Controller
|
||||
/**
|
||||
* @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 = [];
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
|
@ -211,8 +211,8 @@ class SplitController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SplitJournalFormRequest $request
|
||||
* @param TransactionJournal $journal
|
||||
* @param SplitJournalFormRequest|Request $request
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -295,7 +295,7 @@ class SplitController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param SplitJournalFormRequest|Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
@ -151,8 +151,10 @@ class TransactionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param JournalTaskerInterface $tasker
|
||||
* @param TransactionJournal $journal
|
||||
* @param JournalTaskerInterface $tasker
|
||||
*
|
||||
* @param LinkTypeRepositoryInterface $linkTypeRepository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||
*/
|
||||
@ -198,7 +200,7 @@ class TransactionController extends Controller
|
||||
$cache->addProperty('transaction-list-entries');
|
||||
|
||||
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')));
|
||||
|
@ -43,14 +43,14 @@ class ExportFormRequest extends Request
|
||||
$formats = join(',', array_keys(config('firefly.export_formats')));
|
||||
|
||||
return [
|
||||
// 'export_start_range' => 'required|date|after:' . $first,
|
||||
// 'export_end_range' => 'required|date|before:' . $today,
|
||||
// 'accounts' => 'required',
|
||||
// 'job' => 'required|belongsToUser:export_jobs,key',
|
||||
// 'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
|
||||
// 'include_attachments' => 'in:0,1',
|
||||
// 'include_config' => 'in:0,1',
|
||||
// 'exportFormat' => 'in:' . $formats,
|
||||
'export_start_range' => 'required|date|after:' . $first,
|
||||
'export_end_range' => 'required|date|before:' . $today,
|
||||
'accounts' => 'required',
|
||||
'job' => 'required|belongsToUser:export_jobs,key',
|
||||
'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
|
||||
'include_attachments' => 'in:0,1',
|
||||
'include_config' => 'in:0,1',
|
||||
'exportFormat' => 'in:' . $formats,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -33,53 +33,6 @@ class Request extends FormRequest
|
||||
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
|
||||
*
|
||||
@ -140,4 +93,51 @@ class Request extends FormRequest
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* RegisteredUser.php
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
|
@ -12,7 +12,6 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* RequestedNewPassword.php
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
|
@ -84,6 +84,7 @@ class PiggyBank extends Model
|
||||
return $this->currentRep;
|
||||
}
|
||||
// repeating piggy banks are no longer supported.
|
||||
/** @var PiggyBankRepetition $rep */
|
||||
$rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']);
|
||||
if (is_null($rep)) {
|
||||
return new PiggyBankRepetition();
|
||||
|
@ -140,6 +140,14 @@ class TransactionJournal extends Model
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function destinationJournalLinks(): HasMany
|
||||
{
|
||||
return $this->hasMany(TransactionJournalLink::class, 'destination_id');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $value
|
||||
@ -379,13 +387,6 @@ class TransactionJournal extends Model
|
||||
{
|
||||
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
|
||||
|
@ -39,6 +39,13 @@ interface LinkTypeRepositoryInterface
|
||||
*/
|
||||
public function destroy(LinkType $linkType, LinkType $moveTo): bool;
|
||||
|
||||
/**
|
||||
* @param TransactionJournalLink $link
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroyLink(TransactionJournalLink $link): bool;
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*
|
||||
@ -46,20 +53,6 @@ interface LinkTypeRepositoryInterface
|
||||
*/
|
||||
public function find(int $id): LinkType;
|
||||
|
||||
/**
|
||||
* @param TransactionJournalLink $link
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroyLink(TransactionJournalLink $link):bool;
|
||||
|
||||
/**
|
||||
* @param TransactionJournalLink $link
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function switchLink(TransactionJournalLink $link): bool;
|
||||
|
||||
/**
|
||||
* Check if link exists between journals.
|
||||
*
|
||||
@ -91,6 +84,13 @@ interface LinkTypeRepositoryInterface
|
||||
*/
|
||||
public function store(array $data): LinkType;
|
||||
|
||||
/**
|
||||
* @param TransactionJournalLink $link
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function switchLink(TransactionJournalLink $link): bool;
|
||||
|
||||
/**
|
||||
* @param LinkType $linkType
|
||||
* @param array $data
|
||||
|
@ -186,6 +186,34 @@ class TagRepository implements TagRepositoryInterface
|
||||
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
|
||||
*/
|
||||
@ -262,34 +290,6 @@ class TagRepository implements TagRepositoryInterface
|
||||
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.
|
||||
*
|
||||
@ -380,13 +380,14 @@ class TagRepository implements TagRepositoryInterface
|
||||
Log::debug(sprintf('AmountDiff is %f', $amountDiff));
|
||||
|
||||
// no difference? Every tag same range:
|
||||
if($amountDiff === 0.0) {
|
||||
if ($amountDiff === 0.0) {
|
||||
Log::debug(sprintf('AmountDiff is zero, return %d', $range[0]));
|
||||
|
||||
return $range[0];
|
||||
}
|
||||
|
||||
$diff = $range[1] - $range[0];
|
||||
$step = 1;
|
||||
$diff = $range[1] - $range[0];
|
||||
$step = 1;
|
||||
if ($diff != 0) {
|
||||
$step = $amountDiff / $diff;
|
||||
}
|
||||
|
@ -103,11 +103,6 @@ interface TagRepositoryInterface
|
||||
*/
|
||||
public function lastUseDate(Tag $tag): Carbon;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
* @param Carbon|null $start
|
||||
@ -117,6 +112,11 @@ interface TagRepositoryInterface
|
||||
*/
|
||||
public function resultOfTag(Tag $tag, ?Carbon $start, ?Carbon $end): string;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
* @param Carbon $start
|
||||
|
@ -119,7 +119,7 @@ final class Processor
|
||||
$self = new self;
|
||||
foreach ($triggers as $entry) {
|
||||
$entry['value'] = is_null($entry['value']) ? '' : $entry['value'];
|
||||
$trigger = TriggerFactory::makeTriggerFromStrings($entry['type'], $entry['value'], $entry['stopProcessing']);
|
||||
$trigger = TriggerFactory::makeTriggerFromStrings($entry['type'], $entry['value'], $entry['stopProcessing']);
|
||||
$self->triggers->push($trigger);
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,6 @@ class NotificationFilter extends BunqObject
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
var_dump($data);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -127,11 +127,6 @@ class UserPerson extends BunqObject
|
||||
// document front, back attachment
|
||||
// customer, customer_limit
|
||||
// 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;
|
||||
|
||||
use FireflyIII\Services\Bunq\Token\InstallationToken;
|
||||
use FireflyIII\Services\Bunq\Token\SessionToken;
|
||||
use Log;
|
||||
|
||||
@ -36,6 +35,7 @@ class DeleteDeviceSessionRequest extends BunqRequest
|
||||
$headers = $this->getDefaultHeaders();
|
||||
$headers['X-Bunq-Client-Authentication'] = $this->sessionToken->getToken();
|
||||
$this->sendSignedBunqDelete($uri, $headers);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -34,15 +34,6 @@ class ListDeviceServerRequest extends BunqRequest
|
||||
$this->devices = new Collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getDevices(): Collection
|
||||
{
|
||||
return $this->devices;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -64,6 +55,14 @@ class ListDeviceServerRequest extends BunqRequest
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getDevices(): Collection
|
||||
{
|
||||
return $this->devices;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InstallationToken $installationToken
|
||||
*/
|
||||
|
@ -30,14 +30,6 @@ class ListMonetaryAccountRequest extends BunqRequest
|
||||
/** @var int */
|
||||
private $userId = 0;
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getMonetaryAccounts(): Collection
|
||||
{
|
||||
return $this->monetaryAccounts;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -60,6 +52,14 @@ class ListMonetaryAccountRequest extends BunqRequest
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getMonetaryAccounts(): Collection
|
||||
{
|
||||
return $this->monetaryAccounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SessionToken $sessionToken
|
||||
*/
|
||||
|
@ -13,7 +13,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Import\Information;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Services\Bunq\Object\Alias;
|
||||
use FireflyIII\Services\Bunq\Object\MonetaryAccountBank;
|
||||
use FireflyIII\Services\Bunq\Request\DeleteDeviceSessionRequest;
|
||||
|
@ -13,7 +13,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Import\Information;
|
||||
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Interface InformationInterface
|
||||
@ -23,13 +22,6 @@ use Illuminate\Support\Collection;
|
||||
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.
|
||||
*
|
||||
@ -46,4 +38,11 @@ interface InformationInterface
|
||||
* @return 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;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return MessageBag
|
||||
*/
|
||||
public function storePrerequisites(Request $request): MessageBag;
|
||||
|
||||
/**
|
||||
* Returns if this import method has any special prerequisites such as config
|
||||
* variables or other things.
|
||||
@ -53,4 +46,11 @@ interface PrerequisitesInterface
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user): void;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return MessageBag
|
||||
*/
|
||||
public function storePrerequisites(Request $request): MessageBag;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class Search implements SearchInterface
|
||||
$collector->withOpposingAccount()->withCategoryInformation()->withBudgetInformation();
|
||||
}
|
||||
$collector->removeFilter(InternalTransferFilter::class);
|
||||
$set = $collector->getPaginatedJournals()->getCollection();
|
||||
$set = $collector->getPaginatedJournals()->getCollection();
|
||||
|
||||
Log::debug(sprintf('Found %d journals to check. ', $set->count()));
|
||||
|
||||
|
@ -114,14 +114,11 @@ class AmountFormat extends Twig_Extension
|
||||
*
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
protected function formatAmountBySymbol(): Twig_SimpleFunction
|
||||
protected function formatAmountByCurrency(): 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);
|
||||
|
||||
|
||||
@ -134,10 +131,14 @@ class AmountFormat extends Twig_Extension
|
||||
*
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
protected function formatAmountByCurrency(): Twig_SimpleFunction
|
||||
protected function formatAmountBySymbol(): 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);
|
||||
|
||||
|
@ -57,6 +57,14 @@ class Translation extends Twig_Extension
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'FireflyIII\Support\Twig\Translation';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
@ -64,9 +72,9 @@ class Translation extends Twig_Extension
|
||||
{
|
||||
return new Twig_SimpleFunction(
|
||||
'journalLinkTranslation', function (int $linkTypeId, string $direction, string $original) {
|
||||
$key = sprintf('firefly.%d_%s', $linkTypeId, $direction);
|
||||
$key = sprintf('firefly.%d_%s', $linkTypeId, $direction);
|
||||
$translation = trans($key);
|
||||
if($key === $translation) {
|
||||
if ($key === $translation) {
|
||||
return $original;
|
||||
}
|
||||
|
||||
@ -76,12 +84,4 @@ class Translation extends Twig_Extension
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'FireflyIII\Support\Twig\Translation';
|
||||
}
|
||||
}
|
||||
|
@ -13,14 +13,12 @@ namespace Tests\Feature\Controllers;
|
||||
|
||||
use Amount;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
|
@ -18,7 +18,6 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Tests\TestCase;
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Steam;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user