mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various code cleanup.
This commit is contained in:
@@ -150,7 +150,7 @@ class BudgetLimitController extends Controller
|
||||
$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
|
||||
|
||||
if (!$start instanceof Carbon || !$end instanceof Carbon) {
|
||||
return response()->json([]);
|
||||
return response()->json();
|
||||
}
|
||||
|
||||
$amount = (string) $request->get('amount');
|
||||
@@ -158,7 +158,7 @@ class BudgetLimitController extends Controller
|
||||
$end->startOfDay();
|
||||
|
||||
if ('' === $amount) {
|
||||
return response()->json([]);
|
||||
return response()->json();
|
||||
}
|
||||
|
||||
app('log')->debug(sprintf('Start: %s, end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
@@ -172,7 +172,7 @@ class BudgetLimitController extends Controller
|
||||
}
|
||||
|
||||
// return empty=ish array:
|
||||
return response()->json([]);
|
||||
return response()->json();
|
||||
}
|
||||
if ((int) $amount > 268435456) { // intentional cast to integer
|
||||
$amount = '268435456';
|
||||
|
@@ -174,7 +174,7 @@ class IndexController extends Controller
|
||||
$array['end_date'] = $entry->end_date;
|
||||
|
||||
// spent in period:
|
||||
$spentArr = $this->opsRepository->sumExpenses($entry->start_date, $entry->end_date, null, null, $entry->transactionCurrency, false);
|
||||
$spentArr = $this->opsRepository->sumExpenses($entry->start_date, $entry->end_date, null, null, $entry->transactionCurrency);
|
||||
$array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0';
|
||||
$array['pc_spent'] = $this->convertToPrimary && $entry->transaction_currency_id !== $this->primaryCurrency->id ? $converter->convert($entry->transactionCurrency, $this->primaryCurrency, $entry->start_date, $array['spent']) : null;
|
||||
// budgeted in period:
|
||||
@@ -235,7 +235,7 @@ class IndexController extends Controller
|
||||
|
||||
/** @var TransactionCurrency $currency */
|
||||
foreach ($currencies as $currency) {
|
||||
$spentArr = $this->opsRepository->sumExpenses($start, $end, null, new Collection()->push($current), $currency, false);
|
||||
$spentArr = $this->opsRepository->sumExpenses($start, $end, null, new Collection()->push($current), $currency);
|
||||
if (array_key_exists($currency->id, $spentArr) && array_key_exists('sum', $spentArr[$currency->id])) {
|
||||
$array['spent'][$currency->id]['spent'] = $spentArr[$currency->id]['sum'];
|
||||
$array['spent'][$currency->id]['currency_id'] = $currency->id;
|
||||
|
@@ -39,6 +39,8 @@ use FireflyIII\Support\Http\Controllers\PeriodOverview;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* Class ShowController
|
||||
@@ -73,9 +75,15 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show transactions without a budget.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Carbon|null $start
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @return Factory|View
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws FireflyException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function noBudget(Request $request, ?Carbon $start = null, ?Carbon $end = null)
|
||||
{
|
||||
@@ -110,7 +118,11 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Shows ALL transactions without a budget.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function noBudgetAll(Request $request)
|
||||
{
|
||||
@@ -135,7 +147,12 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show a single budget.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return Factory|View
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function show(Request $request, Budget $budget)
|
||||
{
|
||||
@@ -166,9 +183,15 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show a single budget by a budget limit.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*
|
||||
* @return Factory|View
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
|
||||
{
|
||||
|
Reference in New Issue
Block a user