Small bugfixes for issues in beta 2

This commit is contained in:
James Cole
2021-03-15 07:45:46 +01:00
parent b9bf5c9856
commit 8d84dfb3aa
16 changed files with 99 additions and 192 deletions

View File

@@ -44,11 +44,8 @@ class CreateController extends Controller
{
use ModelInformation;
/** @var AttachmentHelperInterface Helper for attachments. */
private $attachments;
/** @var AccountRepositoryInterface The account repository */
private $repository;
private AttachmentHelperInterface $attachments;
private AccountRepositoryInterface $repository;
/**
* CreateController constructor.

View File

@@ -58,7 +58,7 @@ class AvailableBudgetController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('title', (string) trans('firefly.budgets'));
app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-pie-chart');
$this->abRepository = app(AvailableBudgetRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -95,7 +95,7 @@ class AvailableBudgetController extends Controller
return redirect(route('available-budgets.edit', [$first->id]));
}
$page = (int) ($request->get('page') ?? 1);
$page = (int)($request->get('page') ?? 1);
return prefixView('budgets.available-budgets.create', compact('start', 'end', 'page', 'currency'));
}
@@ -129,7 +129,7 @@ class AvailableBudgetController extends Controller
);
$page = (int) ($request->get('page') ?? 1);
$page = (int)($request->get('page') ?? 1);
return prefixView('budgets.available-budgets.create-alternative', compact('start', 'end', 'page', 'currencies'));
}
@@ -157,7 +157,8 @@ class AvailableBudgetController extends Controller
*/
public function edit(AvailableBudget $availableBudget, Carbon $start, Carbon $end)
{
$availableBudget->amount = number_format((float) $availableBudget->amount, $availableBudget->transactionCurrency->decimal_places, '.', '');
$availableBudget->amount = number_format((float)$availableBudget->amount, $availableBudget->transactionCurrency->decimal_places, '.', '');
return prefixView('budgets.available-budgets.edit', compact('availableBudget', 'start', 'end'));
}
@@ -179,7 +180,7 @@ class AvailableBudgetController extends Controller
}
// validate amount
$amount = (string) $request->get('amount');
$amount = (string)$request->get('amount');
if ('' === $amount) {
session()->flash('error', trans('firefly.invalid_amount'));
@@ -192,7 +193,7 @@ class AvailableBudgetController extends Controller
}
// find currency
$currency = $this->currencyRepos->find((int) $request->get('currency_id'));
$currency = $this->currencyRepos->find((int)$request->get('currency_id'));
if (null === $currency) {
session()->flash('error', trans('firefly.invalid_currency'));
@@ -205,10 +206,10 @@ class AvailableBudgetController extends Controller
if (null === $existing) {
$this->abRepository->store(
[
'amount' => $amount,
'currency' => $currency,
'start' => $start,
'end' => $end,
'amount' => $amount,
'currency_id' => $currency->id,
'start' => $start,
'end' => $end,
]
);
}
@@ -233,7 +234,7 @@ class AvailableBudgetController extends Controller
public function update(Request $request, AvailableBudget $availableBudget, Carbon $start, Carbon $end)
{
// validate amount
$amount = (string) $request->get('amount');
$amount = (string)$request->get('amount');
if ('' === $amount) {
session()->flash('error', trans('firefly.invalid_amount'));