mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 20:25:28 +00:00
Various code cleanup.
This commit is contained in:
@@ -164,7 +164,7 @@ class BillController extends Controller
|
||||
'entries' => [],
|
||||
],
|
||||
];
|
||||
$currencyId = (int)$bill->transaction_currency_id;
|
||||
$currencyId = $bill->transaction_currency_id;
|
||||
foreach ($journals as $journal) {
|
||||
$date = $journal['date']->isoFormat((string)trans('config.month_and_day_js', [], $locale));
|
||||
$chartData[0]['entries'][$date] = $bill->amount_min; // minimum amount of bill
|
||||
|
||||
@@ -181,7 +181,7 @@ class BudgetController extends Controller
|
||||
while ($start <= $end) {
|
||||
$current = clone $start;
|
||||
$expenses = $this->opsRepository->sumExpenses($current, $current, null, $budgetCollection, $currency);
|
||||
$spent = $expenses[(int)$currency->id]['sum'] ?? '0';
|
||||
$spent = $expenses[$currency->id]['sum'] ?? '0';
|
||||
$amount = bcadd($amount, $spent);
|
||||
$format = $start->isoFormat((string)trans('config.month_and_day_js', [], $locale));
|
||||
$entries[$format] = $amount;
|
||||
|
||||
@@ -193,7 +193,7 @@ class CategoryController extends Controller
|
||||
if (null !== $category) {
|
||||
/** @var OperationsRepositoryInterface $opsRepository */
|
||||
$opsRepository = app(OperationsRepositoryInterface::class);
|
||||
$categoryId = (int)$category->id;
|
||||
$categoryId = $category->id;
|
||||
// this gives us all currencies
|
||||
$collection = new Collection([$category]);
|
||||
$expenses = $opsRepository->listExpenses($start, $end, null, $collection);
|
||||
|
||||
@@ -31,6 +31,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Http\Middleware\Installer;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
|
||||
@@ -102,7 +102,7 @@ class BoxController extends Controller
|
||||
// spent in this period, in budgets, for default currency.
|
||||
// also calculate spent per day.
|
||||
$spent = $opsRepository->sumExpenses($start, $end, null, null, $currency);
|
||||
$spentAmount = $spent[(int)$currency->id]['sum'] ?? '0';
|
||||
$spentAmount = $spent[$currency->id]['sum'] ?? '0';
|
||||
app('log')->debug(sprintf('Spent for default currency for all budgets in this period: %s', $spentAmount));
|
||||
|
||||
$days = $today->between($start, $end) ? $today->diffInDays($start) + 1 : $end->diffInDays($start) + 1;
|
||||
|
||||
@@ -108,7 +108,7 @@ class MassController extends Controller
|
||||
app('log')->debug(sprintf('Searching for ID #%d', $journalId));
|
||||
/** @var TransactionJournal|null $journal */
|
||||
$journal = $this->repository->find((int)$journalId);
|
||||
if (null !== $journal && (int)$journalId === (int)$journal->id) {
|
||||
if (null !== $journal && (int)$journalId === $journal->id) {
|
||||
$this->repository->destroyJournal($journal);
|
||||
++$count;
|
||||
app('log')->debug(sprintf('Deleted transaction journal #%d', $journalId));
|
||||
|
||||
Reference in New Issue
Block a user