mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Some code cleanup.
This commit is contained in:
parent
bdbd22f98b
commit
ec12238ea1
@ -15,6 +15,7 @@ use Config;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Journal\JournalCollector;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Storage;
|
||||
@ -89,6 +90,7 @@ class Processor
|
||||
public function collectJournals(): bool
|
||||
{
|
||||
$args = [$this->accounts, Auth::user(), $this->settings['startDate'], $this->settings['endDate']];
|
||||
/** @var JournalCollector $journalCollector */
|
||||
$journalCollector = app('FireflyIII\Repositories\Journal\JournalCollector', $args);
|
||||
$this->journals = $journalCollector->collect();
|
||||
Log::debug(
|
||||
|
@ -327,9 +327,6 @@ class BillRepository implements BillRepositoryInterface
|
||||
|
||||
/**
|
||||
* Get all journals that were recorded on this bill between these dates.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @param Bill $bill
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
|
@ -47,6 +47,7 @@ class JournalCollector
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return Collection
|
||||
*/
|
||||
public function collect(): Collection
|
||||
|
@ -86,12 +86,6 @@ interface JournalRepositoryInterface
|
||||
*/
|
||||
public function getWithDate(int $journalId, Carbon $date): TransactionJournal;
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param array $array
|
||||
*
|
||||
* @return void
|
||||
|
||||
/**
|
||||
*
|
||||
* @param TransactionJournal $journal
|
||||
|
@ -110,45 +110,6 @@ class TagRepository implements TagRepositoryInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* This method scans the transaction journals from or to the given asset account
|
||||
* and checks if these are part of a balancing act. If so, it will sum up the amounts
|
||||
* transferred into the balancing act (if any) and return this amount.
|
||||
*
|
||||
* This method effectively tells you the amount of money that has been balanced out
|
||||
* correctly in the given period for the given account.
|
||||
*
|
||||
* @param Account $account
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end): string
|
||||
{
|
||||
// the quickest way to do this is by scanning all balancingAct tags
|
||||
// because there will be less of them any way.
|
||||
$tags = $this->user->tags()->where('tagMode', 'balancingAct')->get();
|
||||
$amount = '0';
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($tags as $tag) {
|
||||
$journals = $tag->transactionjournals()->after($start)->before($end)->transactionTypes([TransactionType::TRANSFER])->get(
|
||||
['transaction_journals.*']
|
||||
);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
if (TransactionJournal::destinationAccount($journal)->id == $account->id) {
|
||||
$amount = bcadd($amount, TransactionJournal::amount($journal));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
*
|
||||
|
@ -34,23 +34,6 @@ interface TagRepositoryInterface
|
||||
*/
|
||||
public function connect(TransactionJournal $journal, Tag $tag): bool;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* This method scans the transaction journals from or to the given asset account
|
||||
* and checks if these are part of a balancing act. If so, it will sum up the amounts
|
||||
* transferred into the balancing act (if any) and return this amount.
|
||||
*
|
||||
* This method effectively tells you the amount of money that has been balanced out
|
||||
* correctly in the given period for the given account.
|
||||
*
|
||||
* @param Account $account
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end): string;
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user