Cast all translations to strings.

This commit is contained in:
James Cole
2018-07-15 09:38:49 +02:00
parent 369839e012
commit 7b41c5b301
99 changed files with 335 additions and 336 deletions

View File

@@ -115,7 +115,7 @@ class BillRequest extends Request
$min = (float)($data['amount_min'] ?? 0); $min = (float)($data['amount_min'] ?? 0);
$max = (float)($data['amount_max'] ?? 0); $max = (float)($data['amount_max'] ?? 0);
if ($min > $max) { if ($min > $max) {
$validator->errors()->add('amount_min', trans('validation.amount_min_over_max')); $validator->errors()->add('amount_min', (string)trans('validation.amount_min_over_max'));
} }
} }
); );

View File

@@ -141,7 +141,7 @@ class RuleRequest extends Request
$repetitions = $data['rule-actions'] ?? []; $repetitions = $data['rule-actions'] ?? [];
// need at least one transaction // need at least one transaction
if (0 === \count($repetitions)) { if (0 === \count($repetitions)) {
$validator->errors()->add('title', trans('validation.at_least_one_action')); $validator->errors()->add('title', (string)trans('validation.at_least_one_action'));
} }
} }
@@ -156,7 +156,7 @@ class RuleRequest extends Request
$repetitions = $data['rule-triggers'] ?? []; $repetitions = $data['rule-triggers'] ?? [];
// need at least one transaction // need at least one transaction
if (0 === \count($repetitions)) { if (0 === \count($repetitions)) {
$validator->errors()->add('title', trans('validation.at_least_one_trigger')); $validator->errors()->add('title', (string)trans('validation.at_least_one_trigger'));
} }
} }
} }

View File

@@ -50,7 +50,7 @@ class CreateController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card'); app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts')); app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
@@ -70,7 +70,7 @@ class CreateController extends Controller
$what = $what ?? 'asset'; $what = $what ?? 'asset';
$defaultCurrency = app('amount')->getDefaultCurrency(); $defaultCurrency = app('amount')->getDefaultCurrency();
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what); $subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
$subTitle = trans('firefly.make_new_' . $what . '_account'); $subTitle = (string)trans('firefly.make_new_' . $what . '_account');
$roles = []; $roles = [];
foreach (config('firefly.accountRoles') as $role) { foreach (config('firefly.accountRoles') as $role) {
$roles[$role] = (string)trans('firefly.account_role_' . $role); $roles[$role] = (string)trans('firefly.account_role_' . $role);

View File

@@ -50,7 +50,7 @@ class DeleteController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card'); app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts')); app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
@@ -67,7 +67,7 @@ class DeleteController extends Controller
public function delete(Account $account) public function delete(Account $account)
{ {
$typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type); $typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type);
$subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]); $subTitle = (string)trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);
$accountList = ExpandedForm::makeSelectListWithEmpty($this->repository->getAccountsByType([$account->accountType->type])); $accountList = ExpandedForm::makeSelectListWithEmpty($this->repository->getAccountsByType([$account->accountType->type]));
unset($accountList[$account->id]); unset($accountList[$account->id]);

View File

@@ -53,7 +53,7 @@ class EditController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card'); app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts')); app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class); $this->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -76,7 +76,7 @@ class EditController extends Controller
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository) public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
{ {
$what = config('firefly.shortNamesByFullName')[$account->accountType->type]; $what = config('firefly.shortNamesByFullName')[$account->accountType->type];
$subTitle = trans('firefly.edit_' . $what . '_account', ['name' => $account->name]); $subTitle = (string)trans('firefly.edit_' . $what . '_account', ['name' => $account->name]);
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what); $subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
$roles = []; $roles = [];
foreach (config('firefly.accountRoles') as $role) { foreach (config('firefly.accountRoles') as $role) {

View File

@@ -50,7 +50,7 @@ class IndexController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card'); app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts')); app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
@@ -68,7 +68,7 @@ class IndexController extends Controller
public function index(Request $request, string $what) public function index(Request $request, string $what)
{ {
$what = $what ?? 'asset'; $what = $what ?? 'asset';
$subTitle = trans('firefly.' . $what . '_accounts'); $subTitle = (string)trans('firefly.' . $what . '_accounts');
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what); $subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
$types = config('firefly.accountTypesByIdentifier.' . $what); $types = config('firefly.accountTypesByIdentifier.' . $what);
$collection = $this->repository->getAccountsByType($types); $collection = $this->repository->getAccountsByType($types);

View File

@@ -64,7 +64,7 @@ class ReconcileController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card'); app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts')); app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(JournalRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class);
$this->accountRepos = app(AccountRepositoryInterface::class); $this->accountRepos = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class); $this->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -85,7 +85,7 @@ class ReconcileController extends Controller
return redirect(route('transactions.edit', [$journal->id])); return redirect(route('transactions.edit', [$journal->id]));
} }
// view related code // view related code
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); $subTitle = (string)trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
// journal related code // journal related code
$pTransaction = $this->repository->getFirstPosTransaction($journal); $pTransaction = $this->repository->getFirstPosTransaction($journal);
@@ -126,7 +126,7 @@ class ReconcileController extends Controller
return $this->redirectToOriginalAccount($account); return $this->redirectToOriginalAccount($account);
} }
if (AccountType::ASSET !== $account->accountType->type) { if (AccountType::ASSET !== $account->accountType->type) {
session()->flash('error', trans('firefly.must_be_asset_account')); session()->flash('error', (string)trans('firefly.must_be_asset_account'));
return redirect(route('accounts.index', [config('firefly.shortNamesByFullName.' . $account->accountType->type)])); return redirect(route('accounts.index', [config('firefly.shortNamesByFullName.' . $account->accountType->type)]));
} }
@@ -153,7 +153,7 @@ class ReconcileController extends Controller
$startBalance = round(app('steam')->balance($account, $startDate), $currency->decimal_places); $startBalance = round(app('steam')->balance($account, $startDate), $currency->decimal_places);
$endBalance = round(app('steam')->balance($account, $end), $currency->decimal_places); $endBalance = round(app('steam')->balance($account, $end), $currency->decimal_places);
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type); $subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
$subTitle = trans('firefly.reconcile_account', ['account' => $account->name]); $subTitle = (string)trans('firefly.reconcile_account', ['account' => $account->name]);
// various links // various links
$transactionsUri = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']); $transactionsUri = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']);
@@ -180,7 +180,7 @@ class ReconcileController extends Controller
if (TransactionType::RECONCILIATION !== $journal->transactionType->type) { if (TransactionType::RECONCILIATION !== $journal->transactionType->type) {
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }
$subTitle = trans('firefly.reconciliation') . ' "' . $journal->description . '"'; $subTitle = (string)trans('firefly.reconciliation') . ' "' . $journal->description . '"';
// get main transaction: // get main transaction:
$transaction = $this->repository->getAssetTransaction($journal); $transaction = $this->repository->getAssetTransaction($journal);
@@ -272,7 +272,7 @@ class ReconcileController extends Controller
} }
Log::debug('End of routine.'); Log::debug('End of routine.');
app('preferences')->mark(); app('preferences')->mark();
session()->flash('success', trans('firefly.reconciliation_stored')); session()->flash('success', (string)trans('firefly.reconciliation_stored'));
return redirect(route('accounts.show', [$account->id])); return redirect(route('accounts.show', [$account->id]));
} }
@@ -293,7 +293,7 @@ class ReconcileController extends Controller
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }
if (0 === bccomp('0', $request->get('amount'))) { if (0 === bccomp('0', $request->get('amount'))) {
session()->flash('error', trans('firefly.amount_cannot_be_zero')); session()->flash('error', (string)trans('firefly.amount_cannot_be_zero'));
return redirect(route('accounts.reconcile.edit', [$journal->id]))->withInput(); return redirect(route('accounts.reconcile.edit', [$journal->id]))->withInput();
} }

View File

@@ -61,7 +61,7 @@ class ShowController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card'); app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts')); app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class); $this->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -107,7 +107,7 @@ class ShowController extends Controller
} }
$fStart = $start->formatLocalized($this->monthAndDayFormat); $fStart = $start->formatLocalized($this->monthAndDayFormat);
$fEnd = $end->formatLocalized($this->monthAndDayFormat); $fEnd = $end->formatLocalized($this->monthAndDayFormat);
$subTitle = trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]); $subTitle = (string)trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); $chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
$periods = $this->getPeriodOverview($account, $end); $periods = $this->getPeriodOverview($account, $end);
/** @var JournalCollectorInterface $collector */ /** @var JournalCollectorInterface $collector */
@@ -151,7 +151,7 @@ class ShowController extends Controller
if (0 === $currencyId) { if (0 === $currencyId) {
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore $currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
} }
$subTitle = trans('firefly.all_journals_for_account', ['name' => $account->name]); $subTitle = (string)trans('firefly.all_journals_for_account', ['name' => $account->name]);
$periods = new Collection; $periods = new Collection;
/** @var JournalCollectorInterface $collector */ /** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class); $collector = app(JournalCollectorInterface::class);

View File

@@ -58,7 +58,7 @@ class LinkController extends Controller
*/ */
public function create() public function create()
{ {
$subTitle = trans('firefly.create_new_link_type'); $subTitle = (string)trans('firefly.create_new_link_type');
$subTitleIcon = 'fa-link'; $subTitleIcon = 'fa-link';
// put previous url in session if not redirect from store (not "create another"). // put previous url in session if not redirect from store (not "create another").
@@ -84,11 +84,11 @@ class LinkController extends Controller
return redirect(route('admin.links.index')); return redirect(route('admin.links.index'));
} }
$subTitle = trans('firefly.delete_link_type', ['name' => $linkType->name]); $subTitle = (string)trans('firefly.delete_link_type', ['name' => $linkType->name]);
$otherTypes = $repository->get(); $otherTypes = $repository->get();
$count = $repository->countJournals($linkType); $count = $repository->countJournals($linkType);
$moveTo = []; $moveTo = [];
$moveTo[0] = trans('firefly.do_not_save_connection'); $moveTo[0] = (string)trans('firefly.do_not_save_connection');
/** @var LinkType $otherType */ /** @var LinkType $otherType */
foreach ($otherTypes as $otherType) { foreach ($otherTypes as $otherType) {
if ($otherType->id !== $linkType->id) { if ($otherType->id !== $linkType->id) {
@@ -133,7 +133,7 @@ class LinkController extends Controller
return redirect(route('admin.links.index')); return redirect(route('admin.links.index'));
} }
$subTitle = trans('firefly.edit_link_type', ['name' => $linkType->name]); $subTitle = (string)trans('firefly.edit_link_type', ['name' => $linkType->name]);
$subTitleIcon = 'fa-link'; $subTitleIcon = 'fa-link';
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
@@ -152,7 +152,7 @@ class LinkController extends Controller
*/ */
public function index(LinkTypeRepositoryInterface $repository) public function index(LinkTypeRepositoryInterface $repository)
{ {
$subTitle = trans('firefly.journal_link_configuration'); $subTitle = (string)trans('firefly.journal_link_configuration');
$subTitleIcon = 'fa-link'; $subTitleIcon = 'fa-link';
$linkTypes = $repository->get(); $linkTypes = $repository->get();
$linkTypes->each( $linkTypes->each(
@@ -171,7 +171,7 @@ class LinkController extends Controller
*/ */
public function show(LinkType $linkType) public function show(LinkType $linkType)
{ {
$subTitle = trans('firefly.overview_for_link', ['name' => $linkType->name]); $subTitle = (string)trans('firefly.overview_for_link', ['name' => $linkType->name]);
$subTitleIcon = 'fa-link'; $subTitleIcon = 'fa-link';
$links = $linkType->transactionJournalLinks()->get(); $links = $linkType->transactionJournalLinks()->get();

View File

@@ -62,14 +62,14 @@ class UpdateController extends Controller
*/ */
public function index() public function index()
{ {
$subTitle = trans('firefly.update_check_title'); $subTitle = (string)trans('firefly.update_check_title');
$subTitleIcon = 'fa-star'; $subTitleIcon = 'fa-star';
$permission = app('fireflyconfig')->get('permission_update_check', -1); $permission = app('fireflyconfig')->get('permission_update_check', -1);
$selected = $permission->data; $selected = $permission->data;
$options = [ $options = [
-1 => trans('firefly.updates_ask_me_later'), -1 => (string)trans('firefly.updates_ask_me_later'),
0 => trans('firefly.updates_do_not_check'), 0 => (string)trans('firefly.updates_do_not_check'),
1 => trans('firefly.updates_enable_check'), 1 => (string)trans('firefly.updates_enable_check'),
]; ];
return view('admin.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options')); return view('admin.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options'));

View File

@@ -61,7 +61,7 @@ class UserController extends Controller
*/ */
public function delete(User $user) public function delete(User $user)
{ {
$subTitle = trans('firefly.delete_user', ['email' => $user->email]); $subTitle = (string)trans('firefly.delete_user', ['email' => $user->email]);
return view('admin.users.delete', compact('user', 'subTitle')); return view('admin.users.delete', compact('user', 'subTitle'));
} }

View File

@@ -50,7 +50,7 @@ class AttachmentController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-paperclip'); app('view')->share('mainTitleIcon', 'fa-paperclip');
app('view')->share('title', trans('firefly.attachments')); app('view')->share('title', (string)trans('firefly.attachments'));
$this->repository = app(AttachmentRepositoryInterface::class); $this->repository = app(AttachmentRepositoryInterface::class);
return $next($request); return $next($request);
@@ -65,7 +65,7 @@ class AttachmentController extends Controller
*/ */
public function delete(Attachment $attachment) public function delete(Attachment $attachment)
{ {
$subTitle = trans('firefly.delete_attachment', ['name' => $attachment->filename]); $subTitle = (string)trans('firefly.delete_attachment', ['name' => $attachment->filename]);
// put previous url in session // put previous url in session
$this->rememberPreviousUri('attachments.delete.uri'); $this->rememberPreviousUri('attachments.delete.uri');
@@ -131,7 +131,7 @@ class AttachmentController extends Controller
public function edit(Request $request, Attachment $attachment) public function edit(Request $request, Attachment $attachment)
{ {
$subTitleIcon = 'fa-pencil'; $subTitleIcon = 'fa-pencil';
$subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]); $subTitle = (string)trans('firefly.edit_attachment', ['name' => $attachment->filename]);
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('attachments.edit.fromUpdate')) { if (true !== session('attachments.edit.fromUpdate')) {

View File

@@ -75,7 +75,7 @@ class ForgotPasswordController extends Controller
$user = User::where('email', $request->get('email'))->first(); $user = User::where('email', $request->get('email'))->first();
if (null !== $user && $repository->hasRole($user, 'demo')) { if (null !== $user && $repository->hasRole($user, 'demo')) {
return back()->withErrors(['email' => trans('firefly.cannot_reset_demo_user')]); return back()->withErrors(['email' => (string)trans('firefly.cannot_reset_demo_user')]);
} }
// We will send the password reset link to this user. Once we have attempted // We will send the password reset link to this user. Once we have attempted

View File

@@ -67,7 +67,7 @@ class BillController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.bills')); app('view')->share('title', (string)trans('firefly.bills'));
app('view')->share('mainTitleIcon', 'fa-calendar-o'); app('view')->share('mainTitleIcon', 'fa-calendar-o');
$this->attachments = app(AttachmentHelperInterface::class); $this->attachments = app(AttachmentHelperInterface::class);
$this->billRepository = app(BillRepositoryInterface::class); $this->billRepository = app(BillRepositoryInterface::class);
@@ -91,7 +91,7 @@ class BillController extends Controller
foreach ($billPeriods as $current) { foreach ($billPeriods as $current) {
$periods[$current] = strtolower((string)trans('firefly.repeat_freq_' . $current)); $periods[$current] = strtolower((string)trans('firefly.repeat_freq_' . $current));
} }
$subTitle = trans('firefly.create_new_bill'); $subTitle = (string)trans('firefly.create_new_bill');
$defaultCurrency = app('amount')->getDefaultCurrency(); $defaultCurrency = app('amount')->getDefaultCurrency();
// put previous url in session if not redirect from store (not "create another"). // put previous url in session if not redirect from store (not "create another").
@@ -112,7 +112,7 @@ class BillController extends Controller
{ {
// put previous url in session // put previous url in session
$this->rememberPreviousUri('bills.delete.uri'); $this->rememberPreviousUri('bills.delete.uri');
$subTitle = trans('firefly.delete_bill', ['name' => $bill->name]); $subTitle = (string)trans('firefly.delete_bill', ['name' => $bill->name]);
return view('bills.delete', compact('bill', 'subTitle')); return view('bills.delete', compact('bill', 'subTitle'));
} }
@@ -147,10 +147,10 @@ class BillController extends Controller
$billPeriods = config('firefly.bill_periods'); $billPeriods = config('firefly.bill_periods');
foreach ($billPeriods as $current) { foreach ($billPeriods as $current) {
$periods[$current] = trans('firefly.' . $current); $periods[$current] = (string)trans('firefly.' . $current);
} }
$subTitle = trans('firefly.edit_bill', ['name' => $bill->name]); $subTitle = (string)trans('firefly.edit_bill', ['name' => $bill->name]);
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('bills.edit.fromUpdate')) { if (true !== session('bills.edit.fromUpdate')) {

View File

@@ -58,7 +58,7 @@ class AmountController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.budgets')); app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-tasks'); app('view')->share('mainTitleIcon', 'fa-tasks');
$this->repository = app(BudgetRepositoryInterface::class); $this->repository = app(BudgetRepositoryInterface::class);

View File

@@ -49,7 +49,7 @@ class CreateController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.budgets')); app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-tasks'); app('view')->share('mainTitleIcon', 'fa-tasks');
$this->repository = app(BudgetRepositoryInterface::class); $this->repository = app(BudgetRepositoryInterface::class);

View File

@@ -49,7 +49,7 @@ class DeleteController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.budgets')); app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-tasks'); app('view')->share('mainTitleIcon', 'fa-tasks');
$this->repository = app(BudgetRepositoryInterface::class); $this->repository = app(BudgetRepositoryInterface::class);
@@ -66,7 +66,7 @@ class DeleteController extends Controller
*/ */
public function delete(Budget $budget) public function delete(Budget $budget)
{ {
$subTitle = trans('firefly.delete_budget', ['name' => $budget->name]); $subTitle = (string)trans('firefly.delete_budget', ['name' => $budget->name]);
// put previous url in session // put previous url in session
$this->rememberPreviousUri('budgets.delete.uri'); $this->rememberPreviousUri('budgets.delete.uri');

View File

@@ -51,7 +51,7 @@ class EditController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.budgets')); app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-tasks'); app('view')->share('mainTitleIcon', 'fa-tasks');
$this->repository = app(BudgetRepositoryInterface::class); $this->repository = app(BudgetRepositoryInterface::class);
@@ -68,7 +68,7 @@ class EditController extends Controller
*/ */
public function edit(Request $request, Budget $budget) public function edit(Request $request, Budget $budget)
{ {
$subTitle = trans('firefly.edit_budget', ['name' => $budget->name]); $subTitle = (string)trans('firefly.edit_budget', ['name' => $budget->name]);
// code to handle active-checkboxes // code to handle active-checkboxes
$hasOldInput = null !== $request->old('_token'); $hasOldInput = null !== $request->old('_token');

View File

@@ -55,7 +55,7 @@ class IndexController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.budgets')); app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-tasks'); app('view')->share('mainTitleIcon', 'fa-tasks');
$this->repository = app(BudgetRepositoryInterface::class); $this->repository = app(BudgetRepositoryInterface::class);

View File

@@ -58,7 +58,7 @@ class ShowController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.budgets')); app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-tasks'); app('view')->share('mainTitleIcon', 'fa-tasks');
$this->repository = app(BudgetRepositoryInterface::class); $this->repository = app(BudgetRepositoryInterface::class);
@@ -106,7 +106,7 @@ class ShowController extends Controller
*/ */
public function noBudgetAll(Request $request, JournalRepositoryInterface $repository) public function noBudgetAll(Request $request, JournalRepositoryInterface $repository)
{ {
$subTitle = trans('firefly.all_journals_without_budget'); $subTitle = (string)trans('firefly.all_journals_without_budget');
$first = $repository->firstNull(); $first = $repository->firstNull();
$start = null === $first ? new Carbon : $first->date; $start = null === $first ? new Carbon : $first->date;
$end = new Carbon; $end = new Carbon;
@@ -148,7 +148,7 @@ class ShowController extends Controller
$transactions = $collector->getPaginatedJournals(); $transactions = $collector->getPaginatedJournals();
$transactions->setPath(route('budgets.show', [$budget->id])); $transactions->setPath(route('budgets.show', [$budget->id]));
$subTitle = trans('firefly.all_journals_for_budget', ['name' => $budget->name]); $subTitle = (string)trans('firefly.all_journals_for_budget', ['name' => $budget->name]);
return view('budgets.show', compact('limits', 'budget', 'repetition', 'transactions', 'subTitle')); return view('budgets.show', compact('limits', 'budget', 'repetition', 'transactions', 'subTitle'));
} }

View File

@@ -57,7 +57,7 @@ class NoCategoryController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.categories')); app('view')->share('title', (string)trans('firefly.categories'));
app('view')->share('mainTitleIcon', 'fa-bar-chart'); app('view')->share('mainTitleIcon', 'fa-bar-chart');
$this->journalRepos = app(JournalRepositoryInterface::class); $this->journalRepos = app(JournalRepositoryInterface::class);
$this->repository = app(CategoryRepositoryInterface::class); $this->repository = app(CategoryRepositoryInterface::class);
@@ -120,7 +120,7 @@ class NoCategoryController extends Controller
$page = (int)$request->get('page'); $page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data; $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
Log::debug('Start of noCategory()'); Log::debug('Start of noCategory()');
$subTitle = trans('firefly.all_journals_without_category'); $subTitle = (string)trans('firefly.all_journals_without_category');
$first = $this->journalRepos->firstNull(); $first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon : $first->date; $start = null === $first ? new Carbon : $first->date;
$end = new Carbon; $end = new Carbon;

View File

@@ -63,7 +63,7 @@ class ShowController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.categories')); app('view')->share('title', (string)trans('firefly.categories'));
app('view')->share('mainTitleIcon', 'fa-bar-chart'); app('view')->share('mainTitleIcon', 'fa-bar-chart');
$this->journalRepos = app(JournalRepositoryInterface::class); $this->journalRepos = app(JournalRepositoryInterface::class);
$this->repository = app(CategoryRepositoryInterface::class); $this->repository = app(CategoryRepositoryInterface::class);
@@ -130,7 +130,7 @@ class ShowController extends Controller
$periods = new Collection; $periods = new Collection;
$moment = 'all'; $moment = 'all';
$subTitle = trans('firefly.all_journals_for_category', ['name' => $category->name]); $subTitle = (string)trans('firefly.all_journals_for_category', ['name' => $category->name]);
$first = $this->repository->firstUseDate($category); $first = $this->repository->firstUseDate($category);
/** @var Carbon $start */ /** @var Carbon $start */
$start = $first ?? new Carbon; $start = $first ?? new Carbon;

View File

@@ -46,7 +46,7 @@ class CategoryController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.categories')); app('view')->share('title', (string)trans('firefly.categories'));
app('view')->share('mainTitleIcon', 'fa-bar-chart'); app('view')->share('mainTitleIcon', 'fa-bar-chart');
$this->repository = app(CategoryRepositoryInterface::class); $this->repository = app(CategoryRepositoryInterface::class);
@@ -66,7 +66,7 @@ class CategoryController extends Controller
$this->rememberPreviousUri('categories.create.uri'); $this->rememberPreviousUri('categories.create.uri');
} }
$request->session()->forget('categories.create.fromStore'); $request->session()->forget('categories.create.fromStore');
$subTitle = trans('firefly.create_new_category'); $subTitle =(string)trans('firefly.create_new_category');
return view('categories.create', compact('subTitle')); return view('categories.create', compact('subTitle'));
} }
@@ -78,7 +78,7 @@ class CategoryController extends Controller
*/ */
public function delete(Category $category) public function delete(Category $category)
{ {
$subTitle = trans('firefly.delete_category', ['name' => $category->name]); $subTitle = (string)trans('firefly.delete_category', ['name' => $category->name]);
// put previous url in session // put previous url in session
$this->rememberPreviousUri('categories.delete.uri'); $this->rememberPreviousUri('categories.delete.uri');
@@ -111,7 +111,7 @@ class CategoryController extends Controller
*/ */
public function edit(Request $request, Category $category) public function edit(Request $request, Category $category)
{ {
$subTitle = trans('firefly.edit_category', ['name' => $category->name]); $subTitle = (string)trans('firefly.edit_category', ['name' => $category->name]);
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('categories.edit.fromUpdate')) { if (true !== session('categories.edit.fromUpdate')) {

View File

@@ -500,7 +500,7 @@ class AccountController extends Controller
$return[$budgetId] = $grouped[$budgetId][0]['name']; $return[$budgetId] = $grouped[$budgetId][0]['name'];
} }
} }
$return[0] = trans('firefly.no_budget'); $return[0] = (string)trans('firefly.no_budget');
return $return; return $return;
} }
@@ -524,7 +524,7 @@ class AccountController extends Controller
$return[$categoryId] = $grouped[$categoryId][0]['name']; $return[$categoryId] = $grouped[$categoryId][0]['name'];
} }
} }
$return[0] = trans('firefly.noCategory'); $return[0] = (string)trans('firefly.noCategory');
return $return; return $return;
} }

View File

@@ -106,9 +106,9 @@ class BillController extends Controller
} }
); );
$chartData = [ $chartData = [
['type' => 'bar', 'label' => trans('firefly.min-amount'), 'entries' => []], ['type' => 'bar', 'label' => (string)trans('firefly.min-amount'), 'entries' => []],
['type' => 'bar', 'label' => trans('firefly.max-amount'), 'entries' => []], ['type' => 'bar', 'label' => (string)trans('firefly.max-amount'), 'entries' => []],
['type' => 'line', 'label' => trans('firefly.journal-amount'), 'entries' => []], ['type' => 'line', 'label' => (string)trans('firefly.journal-amount'), 'entries' => []],
]; ];
/** @var Transaction $entry */ /** @var Transaction $entry */

View File

@@ -510,7 +510,7 @@ class BudgetController extends Controller
$return[$categoryId] = $grouped[$categoryId][0]['name']; $return[$categoryId] = $grouped[$categoryId][0]['name'];
} }
} }
$return[0] = trans('firefly.noCategory'); $return[0] = (string)trans('firefly.noCategory');
return $return; return $return;
} }

View File

@@ -111,13 +111,13 @@ class ReportController extends Controller
$source = $this->getChartData($accounts, $start, $end); $source = $this->getChartData($accounts, $start, $end);
$chartData = [ $chartData = [
[ [
'label' => trans('firefly.income'), 'label' => (string)trans('firefly.income'),
'type' => 'bar', 'type' => 'bar',
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green 'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
'entries' => [], 'entries' => [],
], ],
[ [
'label' => trans('firefly.expenses'), 'label' => (string)trans('firefly.expenses'),
'type' => 'bar', 'type' => 'bar',
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red 'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
'entries' => [], 'entries' => [],
@@ -199,7 +199,7 @@ class ReportController extends Controller
], ],
], ],
[ [
'label' => trans('firefly.expenses'), 'label' => (string)trans('firefly.expenses'),
'type' => 'bar', 'type' => 'bar',
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red 'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
'entries' => [ 'entries' => [

View File

@@ -53,7 +53,7 @@ class CurrencyController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.currencies')); app('view')->share('title', (string)trans('firefly.currencies'));
app('view')->share('mainTitleIcon', 'fa-usd'); app('view')->share('mainTitleIcon', 'fa-usd');
$this->repository = app(CurrencyRepositoryInterface::class); $this->repository = app(CurrencyRepositoryInterface::class);
$this->userRepository = app(UserRepositoryInterface::class); $this->userRepository = app(UserRepositoryInterface::class);
@@ -74,13 +74,13 @@ class CurrencyController extends Controller
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
} }
$subTitleIcon = 'fa-plus'; $subTitleIcon = 'fa-plus';
$subTitle = trans('firefly.create_currency'); $subTitle = (string)trans('firefly.create_currency');
// put previous url in session if not redirect from store (not "create another"). // put previous url in session if not redirect from store (not "create another").
if (true !== session('currencies.create.fromStore')) { if (true !== session('currencies.create.fromStore')) {
@@ -102,7 +102,7 @@ class CurrencyController extends Controller
app('preferences')->set('currencyPreference', $currency->code); app('preferences')->set('currencyPreference', $currency->code);
app('preferences')->mark(); app('preferences')->mark();
$request->session()->flash('success', trans('firefly.new_default_currency', ['name' => $currency->name])); $request->session()->flash('success', (string)trans('firefly.new_default_currency', ['name' => $currency->name]));
Cache::forget('FFCURRENCYSYMBOL'); Cache::forget('FFCURRENCYSYMBOL');
Cache::forget('FFCURRENCYCODE'); Cache::forget('FFCURRENCYCODE');
@@ -122,21 +122,21 @@ class CurrencyController extends Controller
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }
if (!$this->repository->canDeleteCurrency($currency)) { if (!$this->repository->canDeleteCurrency($currency)) {
$request->session()->flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name])); $request->session()->flash('error', (string)trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
} }
// put previous url in session // put previous url in session
$this->rememberPreviousUri('currencies.delete.uri'); $this->rememberPreviousUri('currencies.delete.uri');
$subTitle = trans('form.delete_currency', ['name' => $currency->name]); $subTitle = (string)trans('form.delete_currency', ['name' => $currency->name]);
return view('currencies.delete', compact('currency', 'subTitle')); return view('currencies.delete', compact('currency', 'subTitle'));
} }
@@ -154,20 +154,20 @@ class CurrencyController extends Controller
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }
if (!$this->repository->canDeleteCurrency($currency)) { if (!$this->repository->canDeleteCurrency($currency)) {
$request->session()->flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name])); $request->session()->flash('error', (string)trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
} }
$this->repository->destroy($currency); $this->repository->destroy($currency);
$request->session()->flash('success', trans('firefly.deleted_currency', ['name' => $currency->name])); $request->session()->flash('success', (string)trans('firefly.deleted_currency', ['name' => $currency->name]));
return redirect($this->getPreviousUri('currencies.delete.uri')); return redirect($this->getPreviousUri('currencies.delete.uri'));
} }
@@ -185,14 +185,14 @@ class CurrencyController extends Controller
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }
$subTitleIcon = 'fa-pencil'; $subTitleIcon = 'fa-pencil';
$subTitle = trans('breadcrumbs.edit_currency', ['name' => $currency->name]); $subTitle = (string)trans('breadcrumbs.edit_currency', ['name' => $currency->name]);
$currency->symbol = htmlentities($currency->symbol); $currency->symbol = htmlentities($currency->symbol);
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
@@ -229,7 +229,7 @@ class CurrencyController extends Controller
$defaultCurrency = $this->repository->getCurrencyByPreference(app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR'))); $defaultCurrency = $this->repository->getCurrencyByPreference(app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR')));
$isOwner = true; $isOwner = true;
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
$request->session()->flash('info', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('info', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
$isOwner = false; $isOwner = false;
} }
@@ -258,7 +258,7 @@ class CurrencyController extends Controller
$currency = $this->repository->store($data); $currency = $this->repository->store($data);
$redirect = redirect($this->getPreviousUri('currencies.create.uri')); $redirect = redirect($this->getPreviousUri('currencies.create.uri'));
if (null !== $currency) { if (null !== $currency) {
$request->session()->flash('success', trans('firefly.created_currency', ['name' => $currency->name])); $request->session()->flash('success', (string)trans('firefly.created_currency', ['name' => $currency->name]));
if (1 === (int)$request->get('create_another')) { if (1 === (int)$request->get('create_another')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
@@ -269,7 +269,7 @@ class CurrencyController extends Controller
} }
} }
if (null === $currency) { if (null === $currency) {
$request->session()->flash('error', trans('firefly.could_not_store_currency')); $request->session()->flash('error', (string)trans('firefly.could_not_store_currency'));
} }
@@ -289,7 +289,7 @@ class CurrencyController extends Controller
$user = auth()->user(); $user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) { if (!$this->userRepository->hasRole($user, 'owner')) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$request->session()->flash('error', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')])); $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
return redirect(route('currencies.index')); return redirect(route('currencies.index'));
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
@@ -297,7 +297,7 @@ class CurrencyController extends Controller
$data = $request->getCurrencyData(); $data = $request->getCurrencyData();
$currency = $this->repository->update($currency, $data); $currency = $this->repository->update($currency, $data);
$request->session()->flash('success', trans('firefly.updated_currency', ['name' => $currency->name])); $request->session()->flash('success', (string)trans('firefly.updated_currency', ['name' => $currency->name]));
app('preferences')->mark(); app('preferences')->mark();
if (1 === (int)$request->get('return_to_edit')) { if (1 === (int)$request->get('return_to_edit')) {

View File

@@ -130,7 +130,7 @@ class DebugController extends Controller
// set languages, see what happens: // set languages, see what happens:
$original = setlocale(LC_ALL, 0); $original = setlocale(LC_ALL, 0);
$localeAttempts = []; $localeAttempts = [];
$parts = explode(',', trans('config.locale')); $parts = explode(',', (string)trans('config.locale'));
foreach ($parts as $code) { foreach ($parts as $code) {
$code = trim($code); $code = trim($code);
$localeAttempts[$code] = var_export(setlocale(LC_ALL, $code), true); $localeAttempts[$code] = var_export(setlocale(LC_ALL, $code), true);

View File

@@ -48,7 +48,7 @@ class ExportController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-file-archive-o'); app('view')->share('mainTitleIcon', 'fa-file-archive-o');
app('view')->share('title', trans('firefly.export_and_backup_data')); app('view')->share('title', (string)trans('firefly.export_and_backup_data'));
return $next($request); return $next($request);
} }
@@ -100,7 +100,7 @@ class ExportController extends Controller
*/ */
public function getStatus(ExportJob $job): JsonResponse public function getStatus(ExportJob $job): JsonResponse
{ {
return response()->json(['status' => trans('firefly.' . $job->status)]); return response()->json(['status' => (string)trans('firefly.' . $job->status)]);
} }
/** /**

View File

@@ -108,7 +108,7 @@ class HomeController extends Controller
if (0 === $count) { if (0 === $count) {
return redirect(route('new-user.index')); return redirect(route('new-user.index'));
} }
$subTitle = trans('firefly.welcomeBack'); $subTitle = (string)trans('firefly.welcomeBack');
$transactions = []; $transactions = [];
$frontPage = app('preferences')->get( $frontPage = app('preferences')->get(
'frontPageAccounts', 'frontPageAccounts',

View File

@@ -53,7 +53,7 @@ class IndexController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-archive'); app('view')->share('mainTitleIcon', 'fa-archive');
app('view')->share('title', trans('firefly.import_index_title')); app('view')->share('title', (string)trans('firefly.import_index_title'));
$this->repository = app(ImportJobRepositoryInterface::class); $this->repository = app(ImportJobRepositoryInterface::class);
$this->userRepository = app(UserRepositoryInterface::class); $this->userRepository = app(UserRepositoryInterface::class);
@@ -78,7 +78,7 @@ class IndexController extends Controller
$providers = array_keys($this->getProviders()); $providers = array_keys($this->getProviders());
if (!\in_array($importProvider, $providers, true)) { if (!\in_array($importProvider, $providers, true)) {
Log::error(sprintf('%s-provider is disabled. Cannot create job.', $importProvider)); Log::error(sprintf('%s-provider is disabled. Cannot create job.', $importProvider));
session()->flash('warning', trans('import.cannot_create_for_provider', ['provider' => $importProvider])); session()->flash('warning', (string)trans('import.cannot_create_for_provider', ['provider' => $importProvider]));
return redirect(route('import.index')); return redirect(route('import.index'));
} }
@@ -185,7 +185,7 @@ class IndexController extends Controller
public function index() public function index()
{ {
$providers = $this->getProviders(); $providers = $this->getProviders();
$subTitle = trans('import.index_breadcrumb'); $subTitle = (string)trans('import.index_breadcrumb');
$subTitleIcon = 'fa-home'; $subTitleIcon = 'fa-home';
return view('import.index', compact('subTitle', 'subTitleIcon', 'providers')); return view('import.index', compact('subTitle', 'subTitleIcon', 'providers'));

View File

@@ -50,7 +50,7 @@ class JobConfigurationController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-archive'); app('view')->share('mainTitleIcon', 'fa-archive');
app('view')->share('title', trans('firefly.import_index_title')); app('view')->share('title', (string)trans('firefly.import_index_title'));
$this->repository = app(ImportJobRepositoryInterface::class); $this->repository = app(ImportJobRepositoryInterface::class);
return $next($request); return $next($request);
@@ -74,7 +74,7 @@ class JobConfigurationController extends Controller
$allowed = ['has_prereq', 'need_job_config']; $allowed = ['has_prereq', 'need_job_config'];
if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) { if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) {
Log::debug(sprintf('Job has state "%s", but we only accept %s', $importJob->status, json_encode($allowed))); Log::debug(sprintf('Job has state "%s", but we only accept %s', $importJob->status, json_encode($allowed)));
session()->flash('error', trans('import.bad_job_status', ['status' => $importJob->status])); session()->flash('error', (string)trans('import.bad_job_status', ['status' => $importJob->status]));
return redirect(route('import.index')); return redirect(route('import.index'));
} }
@@ -104,7 +104,7 @@ class JobConfigurationController extends Controller
$view = $configurator->getNextView(); $view = $configurator->getNextView();
$data = $configurator->getNextData(); $data = $configurator->getNextData();
$subTitle = trans('import.job_configuration_breadcrumb', ['key' => $importJob->key]); $subTitle = (string)trans('import.job_configuration_breadcrumb', ['key' => $importJob->key]);
$subTitleIcon = 'fa-wrench'; $subTitleIcon = 'fa-wrench';
return view($view, compact('data', 'importJob', 'subTitle', 'subTitleIcon')); return view($view, compact('data', 'importJob', 'subTitle', 'subTitleIcon'));
@@ -125,7 +125,7 @@ class JobConfigurationController extends Controller
// catch impossible status: // catch impossible status:
$allowed = ['has_prereq', 'need_job_config']; $allowed = ['has_prereq', 'need_job_config'];
if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) { if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) {
session()->flash('error', trans('import.bad_job_status', ['status' => $importJob->status])); session()->flash('error', (string)trans('import.bad_job_status', ['status' => $importJob->status]));
return redirect(route('import.index')); return redirect(route('import.index'));
} }

View File

@@ -50,7 +50,7 @@ class JobStatusController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-archive'); app('view')->share('mainTitleIcon', 'fa-archive');
app('view')->share('title', trans('firefly.import_index_title')); app('view')->share('title', (string)trans('firefly.import_index_title'));
$this->repository = app(ImportJobRepositoryInterface::class); $this->repository = app(ImportJobRepositoryInterface::class);
return $next($request); return $next($request);
@@ -66,7 +66,7 @@ class JobStatusController extends Controller
public function index(ImportJob $importJob) public function index(ImportJob $importJob)
{ {
$subTitleIcon = 'fa-gear'; $subTitleIcon = 'fa-gear';
$subTitle = trans('import.job_status_breadcrumb', ['key' => $importJob->key]); $subTitle = (string)trans('import.job_status_breadcrumb', ['key' => $importJob->key]);
return view('import.status', compact('importJob', 'subTitle', 'subTitleIcon')); return view('import.status', compact('importJob', 'subTitle', 'subTitleIcon'));
} }
@@ -85,7 +85,7 @@ class JobStatusController extends Controller
'count' => $count, 'count' => $count,
'tag_id' => $importJob->tag_id, 'tag_id' => $importJob->tag_id,
'tag_name' => null === $importJob->tag_id ? null : $importJob->tag->tag, 'tag_name' => null === $importJob->tag_id ? null : $importJob->tag->tag,
'report_txt' => trans('import.unknown_import_result'), 'report_txt' => (string)trans('import.unknown_import_result'),
'download_config' => false, 'download_config' => false,
'download_config_text' => '', 'download_config_text' => '',
]; ];
@@ -93,8 +93,8 @@ class JobStatusController extends Controller
if ('file' === $importJob->provider) { if ('file' === $importJob->provider) {
$json['download_config'] = true; $json['download_config'] = true;
$json['download_config_text'] $json['download_config_text']
= trans('import.should_download_config', ['route' => route('import.job.download', [$importJob->key])]) . ' ' = (string)trans('import.should_download_config', ['route' => route('import.job.download', [$importJob->key])]) . ' '
. trans('import.share_config_file'); . (string)trans('import.share_config_file');
} }
// if count is zero: // if count is zero:
@@ -102,7 +102,7 @@ class JobStatusController extends Controller
$count = $importJob->tag->transactionJournals->count(); $count = $importJob->tag->transactionJournals->count();
} }
if (0 === $count) { if (0 === $count) {
$json['report_txt'] = trans('import.result_no_transactions'); $json['report_txt'] = (string)trans('import.result_no_transactions');
} }
if (1 === $count && null !== $importJob->tag_id) { if (1 === $count && null !== $importJob->tag_id) {
$json['report_txt'] = trans( $json['report_txt'] = trans(

View File

@@ -50,7 +50,7 @@ class PrerequisitesController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-archive'); app('view')->share('mainTitleIcon', 'fa-archive');
app('view')->share('title', trans('firefly.import_index_title')); app('view')->share('title', (string)trans('firefly.import_index_title'));
app('view')->share('subTitleIcon', 'fa-check'); app('view')->share('subTitleIcon', 'fa-check');
$this->repository = app(ImportJobRepositoryInterface::class); $this->repository = app(ImportJobRepositoryInterface::class);
@@ -76,12 +76,12 @@ class PrerequisitesController extends Controller
$allowed = ['new']; $allowed = ['new'];
if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) { if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) {
Log::error(sprintf('Job has state "%s" but this Prerequisites::index() only accepts %s', $importJob->status, json_encode($allowed))); Log::error(sprintf('Job has state "%s" but this Prerequisites::index() only accepts %s', $importJob->status, json_encode($allowed)));
session()->flash('error', trans('import.bad_job_status', ['status' => $importJob->status])); session()->flash('error', (string)trans('import.bad_job_status', ['status' => $importJob->status]));
return redirect(route('import.index')); return redirect(route('import.index'));
} }
app('view')->share('subTitle', trans('import.prerequisites_breadcrumb_' . $importProvider)); app('view')->share('subTitle', (string)trans('import.prerequisites_breadcrumb_' . $importProvider));
$class = (string)config(sprintf('import.prerequisites.%s', $importProvider)); $class = (string)config(sprintf('import.prerequisites.%s', $importProvider));
if (!class_exists($class)) { if (!class_exists($class)) {
throw new FireflyException(sprintf('No class to handle prerequisites for "%s".', $importProvider)); // @codeCoverageIgnore throw new FireflyException(sprintf('No class to handle prerequisites for "%s".', $importProvider)); // @codeCoverageIgnore
@@ -132,7 +132,7 @@ class PrerequisitesController extends Controller
$allowed = ['new']; $allowed = ['new'];
if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) { if (null !== $importJob && !\in_array($importJob->status, $allowed, true)) {
Log::error(sprintf('Job has state "%s" but this Prerequisites::post() only accepts %s', $importJob->status, json_encode($allowed))); Log::error(sprintf('Job has state "%s" but this Prerequisites::post() only accepts %s', $importJob->status, json_encode($allowed)));
session()->flash('error', trans('import.bad_job_status', ['status' => $importJob->status])); session()->flash('error', (string)trans('import.bad_job_status', ['status' => $importJob->status]));
return redirect(route('import.index')); return redirect(route('import.index'));
} }

View File

@@ -105,7 +105,7 @@ class IntroController
Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key)); Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('preferences')->set($key, false); app('preferences')->set($key, false);
return response()->json(['message' => trans('firefly.intro_boxes_after_refresh')]); return response()->json(['message' => (string)trans('firefly.intro_boxes_after_refresh')]);
} }
/** /**
@@ -142,7 +142,7 @@ class IntroController
$currentStep = $options; $currentStep = $options;
// get the text: // get the text:
$currentStep['intro'] = trans('intro.' . $route . '_' . $key); $currentStep['intro'] = (string)trans('intro.' . $route . '_' . $key);
// save in array: // save in array:
$steps[] = $currentStep; $steps[] = $currentStep;
@@ -173,7 +173,7 @@ class IntroController
$currentStep = $options; $currentStep = $options;
// get the text: // get the text:
$currentStep['intro'] = trans('intro.' . $route . '_' . $specificPage . '_' . $key); $currentStep['intro'] = (string)trans('intro.' . $route . '_' . $specificPage . '_' . $key);
// save in array: // save in array:
$steps[] = $currentStep; $steps[] = $currentStep;

View File

@@ -64,7 +64,7 @@ class ReconcileController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-credit-card'); app('view')->share('mainTitleIcon', 'fa-credit-card');
app('view')->share('title', trans('firefly.accounts')); app('view')->share('title', (string)trans('firefly.accounts'));
$this->repository = app(JournalRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class);
$this->accountRepos = app(AccountRepositoryInterface::class); $this->accountRepos = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class); $this->currencyRepos = app(CurrencyRepositoryInterface::class);

View File

@@ -42,7 +42,7 @@ class JsonController extends Controller
$keys = array_keys(config('firefly.rule-actions')); $keys = array_keys(config('firefly.rule-actions'));
$actions = []; $actions = [];
foreach ($keys as $key) { foreach ($keys as $key) {
$actions[$key] = trans('firefly.rule_action_' . $key . '_choice'); $actions[$key] = (string)trans('firefly.rule_action_' . $key . '_choice');
} }
$view = view('rules.partials.action', compact('actions', 'count'))->render(); $view = view('rules.partials.action', compact('actions', 'count'))->render();
@@ -62,7 +62,7 @@ class JsonController extends Controller
$triggers = []; $triggers = [];
foreach ($keys as $key) { foreach ($keys as $key) {
if ('user_action' !== $key) { if ('user_action' !== $key) {
$triggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice'); $triggers[$key] = (string)trans('firefly.rule_trigger_' . $key . '_choice');
} }
} }
asort($triggers); asort($triggers);

View File

@@ -58,7 +58,7 @@ class NewUserController extends Controller
*/ */
public function index() public function index()
{ {
app('view')->share('title', trans('firefly.welcome')); app('view')->share('title', (string)trans('firefly.welcome'));
app('view')->share('mainTitleIcon', 'fa-fire'); app('view')->share('mainTitleIcon', 'fa-fire');
$types = config('firefly.accountTypesByIdentifier.asset'); $types = config('firefly.accountTypesByIdentifier.asset');

View File

@@ -60,7 +60,7 @@ class PiggyBankController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.piggyBanks')); app('view')->share('title', (string)trans('firefly.piggyBanks'));
app('view')->share('mainTitleIcon', 'fa-sort-amount-asc'); app('view')->share('mainTitleIcon', 'fa-sort-amount-asc');
$this->piggyRepos = app(PiggyBankRepositoryInterface::class); $this->piggyRepos = app(PiggyBankRepositoryInterface::class);
@@ -129,7 +129,7 @@ class PiggyBankController extends Controller
*/ */
public function create() public function create()
{ {
$subTitle = trans('firefly.new_piggy_bank'); $subTitle = (string)trans('firefly.new_piggy_bank');
$subTitleIcon = 'fa-plus'; $subTitleIcon = 'fa-plus';
// put previous url in session if not redirect from store (not "create another"). // put previous url in session if not redirect from store (not "create another").
@@ -148,7 +148,7 @@ class PiggyBankController extends Controller
*/ */
public function delete(PiggyBank $piggyBank) public function delete(PiggyBank $piggyBank)
{ {
$subTitle = trans('firefly.delete_piggy_bank', ['name' => $piggyBank->name]); $subTitle = (string)trans('firefly.delete_piggy_bank', ['name' => $piggyBank->name]);
// put previous url in session // put previous url in session
$this->rememberPreviousUri('piggy-banks.delete.uri'); $this->rememberPreviousUri('piggy-banks.delete.uri');
@@ -177,7 +177,7 @@ class PiggyBankController extends Controller
*/ */
public function edit(PiggyBank $piggyBank) public function edit(PiggyBank $piggyBank)
{ {
$subTitle = trans('firefly.update_piggy_title', ['name' => $piggyBank->name]); $subTitle = (string)trans('firefly.update_piggy_title', ['name' => $piggyBank->name]);
$subTitleIcon = 'fa-pencil'; $subTitleIcon = 'fa-pencil';
$targetDate = null; $targetDate = null;
$startDate = null; $startDate = null;

View File

@@ -40,7 +40,7 @@ class PreferencesController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.preferences')); app('view')->share('title', (string)trans('firefly.preferences'));
app('view')->share('mainTitleIcon', 'fa-gear'); app('view')->share('mainTitleIcon', 'fa-gear');
return $next($request); return $next($request);

View File

@@ -61,7 +61,7 @@ class ProfileController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.profile')); app('view')->share('title', (string)trans('firefly.profile'));
app('view')->share('mainTitleIcon', 'fa-user'); app('view')->share('mainTitleIcon', 'fa-user');
return $next($request); return $next($request);

View File

@@ -54,8 +54,8 @@ class CreateController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-paint-brush'); app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', trans('firefly.recurrences')); app('view')->share('title', (string)trans('firefly.recurrences'));
app('view')->share('subTitle', trans('firefly.create_new_recurrence')); app('view')->share('subTitle', (string)trans('firefly.create_new_recurrence'));
$this->recurring = app(RecurringRepositoryInterface::class); $this->recurring = app(RecurringRepositoryInterface::class);
$this->budgets = app(BudgetRepositoryInterface::class); $this->budgets = app(BudgetRepositoryInterface::class);
@@ -86,16 +86,16 @@ class CreateController extends Controller
// when will it end? // when will it end?
$repetitionEnds = [ $repetitionEnds = [
'forever' => trans('firefly.repeat_forever'), 'forever' => (string)trans('firefly.repeat_forever'),
'until_date' => trans('firefly.repeat_until_date'), 'until_date' => (string)trans('firefly.repeat_until_date'),
'times' => trans('firefly.repeat_times'), 'times' => (string)trans('firefly.repeat_times'),
]; ];
// what to do in the weekend? // what to do in the weekend?
$weekendResponses = [ $weekendResponses = [
RecurrenceRepetition::WEEKEND_DO_NOTHING => trans('firefly.do_nothing'), RecurrenceRepetition::WEEKEND_DO_NOTHING => (string)trans('firefly.do_nothing'),
RecurrenceRepetition::WEEKEND_SKIP_CREATION => trans('firefly.skip_transaction'), RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string)trans('firefly.skip_transaction'),
RecurrenceRepetition::WEEKEND_TO_FRIDAY => trans('firefly.jump_to_friday'), RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string)trans('firefly.jump_to_friday'),
RecurrenceRepetition::WEEKEND_TO_MONDAY => trans('firefly.jump_to_monday'), RecurrenceRepetition::WEEKEND_TO_MONDAY => (string)trans('firefly.jump_to_monday'),
]; ];
// flash some data: // flash some data:

View File

@@ -48,7 +48,7 @@ class DeleteController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-paint-brush'); app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', trans('firefly.recurrences')); app('view')->share('title', (string)trans('firefly.recurrences'));
$this->recurring = app(RecurringRepositoryInterface::class); $this->recurring = app(RecurringRepositoryInterface::class);
@@ -64,7 +64,7 @@ class DeleteController extends Controller
*/ */
public function delete(Recurrence $recurrence) public function delete(Recurrence $recurrence)
{ {
$subTitle = trans('firefly.delete_recurring', ['title' => $recurrence->title]); $subTitle = (string)trans('firefly.delete_recurring', ['title' => $recurrence->title]);
// put previous url in session // put previous url in session
$this->rememberPreviousUri('recurrences.delete.uri'); $this->rememberPreviousUri('recurrences.delete.uri');

View File

@@ -56,8 +56,8 @@ class EditController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-paint-brush'); app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', trans('firefly.recurrences')); app('view')->share('title', (string)trans('firefly.recurrences'));
app('view')->share('subTitle', trans('firefly.recurrences')); app('view')->share('subTitle', (string)trans('firefly.recurrences'));
$this->recurring = app(RecurringRepositoryInterface::class); $this->recurring = app(RecurringRepositoryInterface::class);
$this->budgets = app(BudgetRepositoryInterface::class); $this->budgets = app(BudgetRepositoryInterface::class);
@@ -105,9 +105,9 @@ class EditController extends Controller
$repetitionEnd = 'forever'; $repetitionEnd = 'forever';
// types of repetitions: // types of repetitions:
$repetitionEnds = [ $repetitionEnds = [
'forever' => trans('firefly.repeat_forever'), 'forever' => (string)trans('firefly.repeat_forever'),
'until_date' => trans('firefly.repeat_until_date'), 'until_date' => (string)trans('firefly.repeat_until_date'),
'times' => trans('firefly.repeat_times'), 'times' => (string)trans('firefly.repeat_times'),
]; ];
if (null !== $recurrence->repeat_until) { if (null !== $recurrence->repeat_until) {
$repetitionEnd = 'until_date'; $repetitionEnd = 'until_date';
@@ -118,10 +118,10 @@ class EditController extends Controller
// what to do in the weekend? // what to do in the weekend?
$weekendResponses = [ $weekendResponses = [
RecurrenceRepetition::WEEKEND_DO_NOTHING => trans('firefly.do_nothing'), RecurrenceRepetition::WEEKEND_DO_NOTHING => (string)trans('firefly.do_nothing'),
RecurrenceRepetition::WEEKEND_SKIP_CREATION => trans('firefly.skip_transaction'), RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string)trans('firefly.skip_transaction'),
RecurrenceRepetition::WEEKEND_TO_FRIDAY => trans('firefly.jump_to_friday'), RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string)trans('firefly.jump_to_friday'),
RecurrenceRepetition::WEEKEND_TO_MONDAY => trans('firefly.jump_to_monday'), RecurrenceRepetition::WEEKEND_TO_MONDAY => (string)trans('firefly.jump_to_monday'),
]; ];
// code to handle active-checkboxes // code to handle active-checkboxes

View File

@@ -55,7 +55,7 @@ class IndexController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-paint-brush'); app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', trans('firefly.recurrences')); app('view')->share('title', (string)trans('firefly.recurrences'));
$this->recurring = app(RecurringRepositoryInterface::class); $this->recurring = app(RecurringRepositoryInterface::class);
@@ -201,7 +201,7 @@ class IndexController extends Controller
} }
} }
$subTitle = trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]); $subTitle = (string)trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]);
return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'transactions')); return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'transactions'));
} }
@@ -225,12 +225,12 @@ class IndexController extends Controller
$yearly = sprintf('yearly,%s', $date->format('Y-m-d')); $yearly = sprintf('yearly,%s', $date->format('Y-m-d'));
$yearlyDate = $date->formatLocalized(trans('config.month_and_day_no_year')); $yearlyDate = $date->formatLocalized(trans('config.month_and_day_no_year'));
$result = [ $result = [
'daily' => ['label' => trans('firefly.recurring_daily'), 'selected' => 0 === strpos($preSelected, 'daily')], 'daily' => ['label' => (string)trans('firefly.recurring_daily'), 'selected' => 0 === strpos($preSelected, 'daily')],
$weekly => ['label' => trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]), 'selected' => 0 === strpos($preSelected, 'weekly')], $weekly => ['label' => (string)trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]), 'selected' => 0 === strpos($preSelected, 'weekly')],
$monthly => ['label' => trans('firefly.recurring_monthly', ['dayOfMonth' => $date->day]), 'selected' => 0 === strpos($preSelected, 'monthly')], $monthly => ['label' => (string)trans('firefly.recurring_monthly', ['dayOfMonth' => $date->day]), 'selected' => 0 === strpos($preSelected, 'monthly')],
$ndom => ['label' => trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]), $ndom => ['label' => (string)trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]),
'selected' => 0 === strpos($preSelected, 'ndom')], 'selected' => 0 === strpos($preSelected, 'ndom')],
$yearly => ['label' => trans('firefly.recurring_yearly', ['date' => $yearlyDate]), 'selected' => 0 === strpos($preSelected, 'yearly')], $yearly => ['label' => (string)trans('firefly.recurring_yearly', ['date' => $yearlyDate]), 'selected' => 0 === strpos($preSelected, 'yearly')],
]; ];
} }

View File

@@ -58,7 +58,7 @@ class ReportController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.reports')); app('view')->share('title', (string)trans('firefly.reports'));
app('view')->share('mainTitleIcon', 'fa-line-chart'); app('view')->share('mainTitleIcon', 'fa-line-chart');
app('view')->share('subTitleIcon', 'fa-calendar'); app('view')->share('subTitleIcon', 'fa-calendar');
$this->helper = app(ReportHelperInterface::class); $this->helper = app(ReportHelperInterface::class);
@@ -81,7 +81,7 @@ class ReportController extends Controller
public function accountReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end) public function accountReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
{ {
if ($end < $start) { if ($end < $start) {
return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
} }
if ($start < session('first')) { if ($start < session('first')) {
@@ -115,7 +115,7 @@ class ReportController extends Controller
public function auditReport(Collection $accounts, Carbon $start, Carbon $end) public function auditReport(Collection $accounts, Carbon $start, Carbon $end)
{ {
if ($end < $start) { if ($end < $start) {
return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
} }
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');
@@ -152,7 +152,7 @@ class ReportController extends Controller
public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end) public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
{ {
if ($end < $start) { if ($end < $start) {
return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
} }
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');
@@ -190,7 +190,7 @@ class ReportController extends Controller
public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end) public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
{ {
if ($end < $start) { if ($end < $start) {
return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
} }
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');
@@ -227,7 +227,7 @@ class ReportController extends Controller
public function defaultReport(Collection $accounts, Carbon $start, Carbon $end) public function defaultReport(Collection $accounts, Carbon $start, Carbon $end)
{ {
if ($end < $start) { if ($end < $start) {
return view('error')->with('message', trans('firefly.end_after_start_date')); return view('error')->with('message', (string)trans('firefly.end_after_start_date'));
} }
if ($start < session('first')) { if ($start < session('first')) {
@@ -322,31 +322,31 @@ class ReportController extends Controller
if (0 === $request->getAccountList()->count()) { if (0 === $request->getAccountList()->count()) {
Log::debug('Account count is zero'); Log::debug('Account count is zero');
session()->flash('error', trans('firefly.select_more_than_one_account')); session()->flash('error', (string)trans('firefly.select_more_than_one_account'));
return redirect(route('reports.index')); return redirect(route('reports.index'));
} }
if ('category' === $reportType && 0 === $request->getCategoryList()->count()) { if ('category' === $reportType && 0 === $request->getCategoryList()->count()) {
session()->flash('error', trans('firefly.select_more_than_one_category')); session()->flash('error', (string)trans('firefly.select_more_than_one_category'));
return redirect(route('reports.index')); return redirect(route('reports.index'));
} }
if ('budget' === $reportType && 0 === $request->getBudgetList()->count()) { if ('budget' === $reportType && 0 === $request->getBudgetList()->count()) {
session()->flash('error', trans('firefly.select_more_than_one_budget')); session()->flash('error', (string)trans('firefly.select_more_than_one_budget'));
return redirect(route('reports.index')); return redirect(route('reports.index'));
} }
if ('tag' === $reportType && 0 === $request->getTagList()->count()) { if ('tag' === $reportType && 0 === $request->getTagList()->count()) {
session()->flash('error', trans('firefly.select_more_than_one_tag')); session()->flash('error', (string)trans('firefly.select_more_than_one_tag'));
return redirect(route('reports.index')); return redirect(route('reports.index'));
} }
if ($request->getEndDate() < $request->getStartDate()) { if ($request->getEndDate() < $request->getStartDate()) {
return view('error')->with('message', trans('firefly.end_after_start_date')); return view('error')->with('message', (string)trans('firefly.end_after_start_date'));
} }
switch ($reportType) { switch ($reportType) {
@@ -386,7 +386,7 @@ class ReportController extends Controller
public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end) public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
{ {
if ($end < $start) { if ($end < $start) {
return view('error')->with('message', trans('firefly.end_after_start_date')); // @codeCoverageIgnore return view('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
} }
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');

View File

@@ -69,7 +69,7 @@ class RuleController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.rules')); app('view')->share('title', (string)trans('firefly.rules'));
app('view')->share('mainTitleIcon', 'fa-random'); app('view')->share('mainTitleIcon', 'fa-random');
$this->accountRepos = app(AccountRepositoryInterface::class); $this->accountRepos = app(AccountRepositoryInterface::class);
@@ -121,8 +121,8 @@ class RuleController extends Controller
if (null !== $bill && !$request->old()) { if (null !== $bill && !$request->old()) {
// create some sensible defaults: // create some sensible defaults:
$preFilled['title'] = trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]); $preFilled['title'] = (string)trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]);
$preFilled['description'] = trans('firefly.new_rule_for_bill_description', ['name' => $bill->name]); $preFilled['description'] = (string)trans('firefly.new_rule_for_bill_description', ['name' => $bill->name]);
// get triggers and actions for bill: // get triggers and actions for bill:
@@ -133,7 +133,7 @@ class RuleController extends Controller
$triggerCount = \count($oldTriggers); $triggerCount = \count($oldTriggers);
$actionCount = \count($oldActions); $actionCount = \count($oldActions);
$subTitleIcon = 'fa-clone'; $subTitleIcon = 'fa-clone';
$subTitle = trans('firefly.make_new_rule', ['title' => $ruleGroup->title]); $subTitle = (string)trans('firefly.make_new_rule', ['title' => $ruleGroup->title]);
$request->session()->flash('preFilled', $preFilled); $request->session()->flash('preFilled', $preFilled);
@@ -161,7 +161,7 @@ class RuleController extends Controller
*/ */
public function delete(Rule $rule) public function delete(Rule $rule)
{ {
$subTitle = trans('firefly.delete_rule', ['title' => $rule->title]); $subTitle = (string)trans('firefly.delete_rule', ['title' => $rule->title]);
// put previous url in session // put previous url in session
$this->rememberPreviousUri('rules.delete.uri'); $this->rememberPreviousUri('rules.delete.uri');
@@ -181,7 +181,7 @@ class RuleController extends Controller
$title = $rule->title; $title = $rule->title;
$this->ruleRepos->destroy($rule); $this->ruleRepos->destroy($rule);
session()->flash('success', trans('firefly.deleted_rule', ['title' => $title])); session()->flash('success', (string)trans('firefly.deleted_rule', ['title' => $title]));
app('preferences')->mark(); app('preferences')->mark();
return redirect($this->getPreviousUri('rules.delete.uri')); return redirect($this->getPreviousUri('rules.delete.uri'));
@@ -237,7 +237,7 @@ class RuleController extends Controller
// get rule trigger for update / store-journal: // get rule trigger for update / store-journal:
$primaryTrigger = $this->ruleRepos->getPrimaryTrigger($rule); $primaryTrigger = $this->ruleRepos->getPrimaryTrigger($rule);
$subTitle = trans('firefly.edit_rule', ['title' => $rule->title]); $subTitle = (string)trans('firefly.edit_rule', ['title' => $rule->title]);
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('rules.edit.fromUpdate')) { if (true !== session('rules.edit.fromUpdate')) {
@@ -357,7 +357,7 @@ class RuleController extends Controller
{ {
$data = $request->getRuleData(); $data = $request->getRuleData();
$rule = $this->ruleRepos->store($data); $rule = $this->ruleRepos->store($data);
session()->flash('success', trans('firefly.stored_new_rule', ['title' => $rule->title])); session()->flash('success', (string)trans('firefly.stored_new_rule', ['title' => $rule->title]));
app('preferences')->mark(); app('preferences')->mark();
// redirect to show bill. // redirect to show bill.
@@ -400,7 +400,7 @@ class RuleController extends Controller
$triggers = $this->getValidTriggerList($request); $triggers = $this->getValidTriggerList($request);
if (0 === \count($triggers)) { if (0 === \count($triggers)) {
return response()->json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
} }
$limit = (int)config('firefly.test-triggers.limit'); $limit = (int)config('firefly.test-triggers.limit');
@@ -424,10 +424,10 @@ class RuleController extends Controller
// Warn the user if only a subset of transactions is returned // Warn the user if only a subset of transactions is returned
$warning = ''; $warning = '';
if ($matchingTransactions->count() === $limit) { if ($matchingTransactions->count() === $limit) {
$warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); // @codeCoverageIgnore $warning = (string)trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); // @codeCoverageIgnore
} }
if (0 === $matchingTransactions->count()) { if (0 === $matchingTransactions->count()) {
$warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); // @codeCoverageIgnore $warning = (string)trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); // @codeCoverageIgnore
} }
// Return json response // Return json response
@@ -462,7 +462,7 @@ class RuleController extends Controller
$triggers = $rule->ruleTriggers; $triggers = $rule->ruleTriggers;
if (0 === \count($triggers)) { if (0 === \count($triggers)) {
return response()->json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]); // @codeCoverageIgnore
} }
$limit = (int)config('firefly.test-triggers.limit'); $limit = (int)config('firefly.test-triggers.limit');
@@ -486,10 +486,10 @@ class RuleController extends Controller
// Warn the user if only a subset of transactions is returned // Warn the user if only a subset of transactions is returned
$warning = ''; $warning = '';
if ($matchingTransactions->count() === $limit) { if ($matchingTransactions->count() === $limit) {
$warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); // @codeCoverageIgnore $warning = (string)trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]); // @codeCoverageIgnore
} }
if (0 === $matchingTransactions->count()) { if (0 === $matchingTransactions->count()) {
$warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); // @codeCoverageIgnore $warning = (string)trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]); // @codeCoverageIgnore
} }
// Return json response // Return json response
@@ -530,7 +530,7 @@ class RuleController extends Controller
$data = $request->getRuleData(); $data = $request->getRuleData();
$this->ruleRepos->update($rule, $data); $this->ruleRepos->update($rule, $data);
session()->flash('success', trans('firefly.updated_rule', ['title' => $rule->title])); session()->flash('success', (string)trans('firefly.updated_rule', ['title' => $rule->title]));
app('preferences')->mark(); app('preferences')->mark();
$redirect = redirect($this->getPreviousUri('rules.edit.uri')); $redirect = redirect($this->getPreviousUri('rules.edit.uri'));
if (1 === (int)$request->get('return_to_edit')) { if (1 === (int)$request->get('return_to_edit')) {
@@ -553,20 +553,20 @@ class RuleController extends Controller
$data = [ $data = [
'rule_group_id' => $this->ruleRepos->getFirstRuleGroup()->id, 'rule_group_id' => $this->ruleRepos->getFirstRuleGroup()->id,
'stop-processing' => 0, 'stop-processing' => 0,
'title' => trans('firefly.default_rule_name'), 'title' => (string)trans('firefly.default_rule_name'),
'description' => trans('firefly.default_rule_description'), 'description' => (string)trans('firefly.default_rule_description'),
'trigger' => 'store-journal', 'trigger' => 'store-journal',
'strict' => true, 'strict' => true,
'rule-triggers' => [ 'rule-triggers' => [
[ [
'name' => 'description_is', 'name' => 'description_is',
'value' => trans('firefly.default_rule_trigger_description'), 'value' => (string)trans('firefly.default_rule_trigger_description'),
'stop-processing' => false, 'stop-processing' => false,
], ],
[ [
'name' => 'from_account_is', 'name' => 'from_account_is',
'value' => trans('firefly.default_rule_trigger_from_account'), 'value' => (string)trans('firefly.default_rule_trigger_from_account'),
'stop-processing' => false, 'stop-processing' => false,
], ],
@@ -575,12 +575,12 @@ class RuleController extends Controller
'rule-actions' => [ 'rule-actions' => [
[ [
'name' => 'prepend_description', 'name' => 'prepend_description',
'value' => trans('firefly.default_rule_action_prepend'), 'value' => (string)trans('firefly.default_rule_action_prepend'),
'stop-processing' => false, 'stop-processing' => false,
], ],
[ [
'name' => 'set_category', 'name' => 'set_category',
'value' => trans('firefly.default_rule_action_set_category'), 'value' => (string)trans('firefly.default_rule_action_set_category'),
'stop-processing' => false, 'stop-processing' => false,
], ],
], ],
@@ -597,8 +597,8 @@ class RuleController extends Controller
{ {
if (0 === $this->ruleGroupRepos->count()) { if (0 === $this->ruleGroupRepos->count()) {
$data = [ $data = [
'title' => trans('firefly.default_rule_group_name'), 'title' => (string)trans('firefly.default_rule_group_name'),
'description' => trans('firefly.default_rule_group_description'), 'description' => (string)trans('firefly.default_rule_group_description'),
]; ];
$this->ruleGroupRepos->store($data); $this->ruleGroupRepos->store($data);

View File

@@ -47,7 +47,7 @@ class RuleGroupController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.rules')); app('view')->share('title', (string)trans('firefly.rules'));
app('view')->share('mainTitleIcon', 'fa-random'); app('view')->share('mainTitleIcon', 'fa-random');
return $next($request); return $next($request);
@@ -61,7 +61,7 @@ class RuleGroupController extends Controller
public function create() public function create()
{ {
$subTitleIcon = 'fa-clone'; $subTitleIcon = 'fa-clone';
$subTitle = trans('firefly.make_new_rule_group'); $subTitle = (string)trans('firefly.make_new_rule_group');
// put previous url in session if not redirect from store (not "create another"). // put previous url in session if not redirect from store (not "create another").
if (true !== session('rule-groups.create.fromStore')) { if (true !== session('rule-groups.create.fromStore')) {
@@ -79,7 +79,7 @@ class RuleGroupController extends Controller
*/ */
public function delete(RuleGroup $ruleGroup) public function delete(RuleGroup $ruleGroup)
{ {
$subTitle = trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]); $subTitle = (string)trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]);
// put previous url in session // put previous url in session
$this->rememberPreviousUri('rule-groups.delete.uri'); $this->rememberPreviousUri('rule-groups.delete.uri');
@@ -132,7 +132,7 @@ class RuleGroupController extends Controller
*/ */
public function edit(Request $request, RuleGroup $ruleGroup) public function edit(Request $request, RuleGroup $ruleGroup)
{ {
$subTitle = trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]); $subTitle = (string)trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]);
$hasOldInput = null !== $request->old('_token'); $hasOldInput = null !== $request->old('_token');
$preFilled = [ $preFilled = [

View File

@@ -43,7 +43,7 @@ class SearchController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-search'); app('view')->share('mainTitleIcon', 'fa-search');
app('view')->share('title', trans('firefly.search')); app('view')->share('title', (string)trans('firefly.search'));
return $next($request); return $next($request);
} }
@@ -63,7 +63,7 @@ class SearchController extends Controller
// parse search terms: // parse search terms:
$searcher->parseQuery($fullQuery); $searcher->parseQuery($fullQuery);
$query = $searcher->getWordsAsString(); $query = $searcher->getWordsAsString();
$subTitle = trans('breadcrumbs.search_result', ['query' => $query]); $subTitle = (string)trans('breadcrumbs.search_result', ['query' => $query]);
return view('search.index', compact('query', 'fullQuery', 'subTitle')); return view('search.index', compact('query', 'fullQuery', 'subTitle'));
} }

View File

@@ -67,7 +67,7 @@ class TagController extends Controller
*/ */
public function create() public function create()
{ {
$subTitle = trans('firefly.new_tag'); $subTitle = (string)trans('firefly.new_tag');
$subTitleIcon = 'fa-tag'; $subTitleIcon = 'fa-tag';
// put previous url in session if not redirect from store (not "create another"). // put previous url in session if not redirect from store (not "create another").
@@ -88,7 +88,7 @@ class TagController extends Controller
*/ */
public function delete(Tag $tag) public function delete(Tag $tag)
{ {
$subTitle = trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]); $subTitle = (string)trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]);
// put previous url in session // put previous url in session
$this->rememberPreviousUri('tags.delete.uri'); $this->rememberPreviousUri('tags.delete.uri');
@@ -121,7 +121,7 @@ class TagController extends Controller
*/ */
public function edit(Tag $tag) public function edit(Tag $tag)
{ {
$subTitle = trans('firefly.edit_tag', ['tag' => $tag->tag]); $subTitle = (string)trans('firefly.edit_tag', ['tag' => $tag->tag]);
$subTitleIcon = 'fa-tag'; $subTitleIcon = 'fa-tag';
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
@@ -184,7 +184,7 @@ class TagController extends Controller
// prep for "all" view. // prep for "all" view.
if ('all' === $moment) { if ('all' === $moment) {
$subTitle = trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]); $subTitle = (string)trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);
$start = $this->repository->firstUseDate($tag); $start = $this->repository->firstUseDate($tag);
$end = new Carbon; $end = new Carbon;
$path = route('tags.show', [$tag->id, 'all']); $path = route('tags.show', [$tag->id, 'all']);

View File

@@ -52,7 +52,7 @@ class BulkController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
$this->repository = app(JournalRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class);
app('view')->share('title', trans('firefly.transactions')); app('view')->share('title', (string)trans('firefly.transactions'));
app('view')->share('mainTitleIcon', 'fa-repeat'); app('view')->share('mainTitleIcon', 'fa-repeat');
return $next($request); return $next($request);
@@ -67,7 +67,7 @@ class BulkController extends Controller
*/ */
public function edit(Collection $journals) public function edit(Collection $journals)
{ {
$subTitle = trans('firefly.mass_bulk_journals'); $subTitle = (string)trans('firefly.mass_bulk_journals');
// get list of budgets: // get list of budgets:
/** @var BudgetRepositoryInterface $repository */ /** @var BudgetRepositoryInterface $repository */
@@ -128,7 +128,7 @@ class BulkController extends Controller
} }
app('preferences')->mark(); app('preferences')->mark();
$request->session()->flash('success', trans('firefly.mass_edited_transactions_success', ['amount' => $count])); $request->session()->flash('success', (string)trans('firefly.mass_edited_transactions_success', ['amount' => $count]));
// redirect to previous URL: // redirect to previous URL:
return redirect($this->getPreviousUri('transactions.bulk-edit.uri')); return redirect($this->getPreviousUri('transactions.bulk-edit.uri'));

View File

@@ -53,7 +53,7 @@ class ConvertController extends Controller
function ($request, $next) { function ($request, $next) {
$this->repository = app(JournalRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class);
app('view')->share('title', trans('firefly.transactions')); app('view')->share('title', (string)trans('firefly.transactions'));
app('view')->share('mainTitleIcon', 'fa-exchange'); app('view')->share('mainTitleIcon', 'fa-exchange');
return $next($request); return $next($request);
@@ -79,13 +79,13 @@ class ConvertController extends Controller
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
$positiveAmount = $this->repository->getJournalTotal($journal); $positiveAmount = $this->repository->getJournalTotal($journal);
$sourceType = $journal->transactionType; $sourceType = $journal->transactionType;
$subTitle = trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]); $subTitle = (string)trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]);
$subTitleIcon = 'fa-exchange'; $subTitleIcon = 'fa-exchange';
// cannot convert to its own type. // cannot convert to its own type.
if ($sourceType->type === $destinationType->type) { if ($sourceType->type === $destinationType->type) {
Log::debug('This is already a transaction of the expected type..'); Log::debug('This is already a transaction of the expected type..');
session()->flash('info', trans('firefly.convert_is_already_type_' . $destinationType->type)); session()->flash('info', (string)trans('firefly.convert_is_already_type_' . $destinationType->type));
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }
@@ -93,7 +93,7 @@ class ConvertController extends Controller
// cannot convert split. // cannot convert split.
if ($journal->transactions()->count() > 2) { if ($journal->transactions()->count() > 2) {
Log::info('This journal has more than two transactions.'); Log::info('This journal has more than two transactions.');
session()->flash('error', trans('firefly.cannot_convert_split_journal')); session()->flash('error', (string)trans('firefly.cannot_convert_split_journal'));
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }
@@ -135,14 +135,14 @@ class ConvertController extends Controller
if ($journal->transactionType->type === $destinationType->type) { if ($journal->transactionType->type === $destinationType->type) {
Log::info('Journal is already of the desired type.'); Log::info('Journal is already of the desired type.');
session()->flash('error', trans('firefly.convert_is_already_type_' . $destinationType->type)); session()->flash('error', (string)trans('firefly.convert_is_already_type_' . $destinationType->type));
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }
if ($journal->transactions()->count() > 2) { if ($journal->transactions()->count() > 2) {
Log::info('Journal has more than two transactions.'); Log::info('Journal has more than two transactions.');
session()->flash('error', trans('firefly.cannot_convert_split_journal')); session()->flash('error', (string)trans('firefly.cannot_convert_split_journal'));
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }
@@ -158,7 +158,7 @@ class ConvertController extends Controller
return redirect(route('transactions.convert.index', [strtolower($destinationType->type), $journal->id]))->withErrors($errors)->withInput(); return redirect(route('transactions.convert.index', [strtolower($destinationType->type), $journal->id]))->withErrors($errors)->withInput();
} }
session()->flash('success', trans('firefly.converted_to_' . $destinationType->type)); session()->flash('success', (string)trans('firefly.converted_to_' . $destinationType->type));
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }

View File

@@ -50,7 +50,7 @@ class LinkController extends Controller
// some useful repositories: // some useful repositories:
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.transactions')); app('view')->share('title', (string)trans('firefly.transactions'));
app('view')->share('mainTitleIcon', 'fa-repeat'); app('view')->share('mainTitleIcon', 'fa-repeat');
$this->journalRepository = app(JournalRepositoryInterface::class); $this->journalRepository = app(JournalRepositoryInterface::class);
@@ -69,7 +69,7 @@ class LinkController extends Controller
public function delete(TransactionJournalLink $link) public function delete(TransactionJournalLink $link)
{ {
$subTitleIcon = 'fa-link'; $subTitleIcon = 'fa-link';
$subTitle = trans('breadcrumbs.delete_journal_link'); $subTitle = (string)trans('breadcrumbs.delete_journal_link');
$this->rememberPreviousUri('journal_links.delete.uri'); $this->rememberPreviousUri('journal_links.delete.uri');
return view('transactions.links.delete', compact('link', 'subTitle', 'subTitleIcon')); return view('transactions.links.delete', compact('link', 'subTitle', 'subTitleIcon'));
@@ -102,14 +102,14 @@ class LinkController extends Controller
Log::debug('We are here (store)'); Log::debug('We are here (store)');
$linkInfo = $request->getLinkInfo(); $linkInfo = $request->getLinkInfo();
if (0 === $linkInfo['transaction_journal_id']) { if (0 === $linkInfo['transaction_journal_id']) {
session()->flash('error', trans('firefly.invalid_link_selection')); session()->flash('error', (string)trans('firefly.invalid_link_selection'));
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }
$other = $this->journalRepository->findNull($linkInfo['transaction_journal_id']); $other = $this->journalRepository->findNull($linkInfo['transaction_journal_id']);
if (null === $other) { if (null === $other) {
session()->flash('error', trans('firefly.invalid_link_selection')); session()->flash('error', (string)trans('firefly.invalid_link_selection'));
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }
@@ -117,19 +117,19 @@ class LinkController extends Controller
$alreadyLinked = $this->repository->findLink($journal, $other); $alreadyLinked = $this->repository->findLink($journal, $other);
if ($other->id === $journal->id) { if ($other->id === $journal->id) {
session()->flash('error', trans('firefly.journals_link_to_self')); session()->flash('error', (string)trans('firefly.journals_link_to_self'));
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }
if ($alreadyLinked) { if ($alreadyLinked) {
session()->flash('error', trans('firefly.journals_error_linked')); session()->flash('error', (string)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)); Log::debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));
$this->repository->storeLink($linkInfo, $other, $journal); $this->repository->storeLink($linkInfo, $other, $journal);
session()->flash('success', trans('firefly.journals_linked')); session()->flash('success', (string)trans('firefly.journals_linked'));
return redirect(route('transactions.show', [$journal->id])); return redirect(route('transactions.show', [$journal->id]));
} }

View File

@@ -57,7 +57,7 @@ class MassController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.transactions')); app('view')->share('title', (string)trans('firefly.transactions'));
app('view')->share('mainTitleIcon', 'fa-repeat'); app('view')->share('mainTitleIcon', 'fa-repeat');
$this->repository = app(JournalRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class);
@@ -73,7 +73,7 @@ class MassController extends Controller
*/ */
public function delete(Collection $journals): IlluminateView public function delete(Collection $journals): IlluminateView
{ {
$subTitle = trans('firefly.mass_delete_journals'); $subTitle = (string)trans('firefly.mass_delete_journals');
// put previous url in session // put previous url in session
$this->rememberPreviousUri('transactions.mass-delete.uri'); $this->rememberPreviousUri('transactions.mass-delete.uri');
@@ -110,7 +110,7 @@ class MassController extends Controller
} }
app('preferences')->mark(); app('preferences')->mark();
session()->flash('success', trans('firefly.mass_deleted_transactions_success', ['amount' => $count])); session()->flash('success', (string)trans('firefly.mass_deleted_transactions_success', ['amount' => $count]));
// redirect to previous URL: // redirect to previous URL:
return redirect($this->getPreviousUri('transactions.mass-delete.uri')); return redirect($this->getPreviousUri('transactions.mass-delete.uri'));
@@ -125,7 +125,7 @@ class MassController extends Controller
{ {
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
$subTitle = trans('firefly.mass_edit_journals'); $subTitle = (string)trans('firefly.mass_edit_journals');
/** @var AccountRepositoryInterface $repository */ /** @var AccountRepositoryInterface $repository */
@@ -240,7 +240,7 @@ class MassController extends Controller
} }
} }
app('preferences')->mark(); app('preferences')->mark();
session()->flash('success', trans('firefly.mass_edited_transactions_success', ['amount' => $count])); session()->flash('success', (string)trans('firefly.mass_edited_transactions_success', ['amount' => $count]));
// redirect to previous URL: // redirect to previous URL:
return redirect($this->getPreviousUri('transactions.mass-edit.uri')); return redirect($this->getPreviousUri('transactions.mass-edit.uri'));

View File

@@ -71,7 +71,7 @@ class SingleController extends Controller
$this->attachments = app(AttachmentHelperInterface::class); $this->attachments = app(AttachmentHelperInterface::class);
$this->repository = app(JournalRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class);
app('view')->share('title', trans('firefly.transactions')); app('view')->share('title', (string)trans('firefly.transactions'));
app('view')->share('mainTitleIcon', 'fa-repeat'); app('view')->share('mainTitleIcon', 'fa-repeat');
return $next($request); return $next($request);
@@ -145,7 +145,7 @@ class SingleController extends Controller
$what = (string)($request->old('what') ?? $what); $what = (string)($request->old('what') ?? $what);
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets()); $budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets());
$preFilled = session()->has('preFilled') ? session('preFilled') : []; $preFilled = session()->has('preFilled') ? session('preFilled') : [];
$subTitle = trans('form.add_new_' . $what); $subTitle = (string)trans('form.add_new_' . $what);
$subTitleIcon = 'fa-plus'; $subTitleIcon = 'fa-plus';
$optionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data; $optionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data;
$source = (int)$request->get('source'); $source = (int)$request->get('source');
@@ -192,7 +192,7 @@ class SingleController extends Controller
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
$what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type); $what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
$subTitle = trans('firefly.delete_' . $what, ['description' => $journal->description]); $subTitle = (string)trans('firefly.delete_' . $what, ['description' => $journal->description]);
// put previous url in session // put previous url in session
$this->rememberPreviousUri('transactions.delete.uri'); $this->rememberPreviousUri('transactions.delete.uri');
@@ -253,7 +253,7 @@ class SingleController extends Controller
$budgetList = ExpandedForm::makeSelectListWithEmpty($this->budgets->getBudgets()); $budgetList = ExpandedForm::makeSelectListWithEmpty($this->budgets->getBudgets());
// view related code // view related code
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); $subTitle = (string)trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
// journal related code // journal related code
$sourceAccounts = $repository->getJournalSourceAccounts($journal); $sourceAccounts = $repository->getJournalSourceAccounts($journal);

View File

@@ -72,7 +72,7 @@ class SplitController extends Controller
$this->currencies = app(CurrencyRepositoryInterface::class); $this->currencies = app(CurrencyRepositoryInterface::class);
$this->repository = app(JournalRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class);
app('view')->share('mainTitleIcon', 'fa-share-alt'); app('view')->share('mainTitleIcon', 'fa-share-alt');
app('view')->share('title', trans('firefly.split-transactions')); app('view')->share('title', (string)trans('firefly.split-transactions'));
return $next($request); return $next($request);
} }
@@ -93,7 +93,7 @@ class SplitController extends Controller
} }
// basic fields: // basic fields:
$uploadSize = min(app('steam')->phpBytes(ini_get('upload_max_filesize')), app('steam')->phpBytes(ini_get('post_max_size'))); $uploadSize = min(app('steam')->phpBytes(ini_get('upload_max_filesize')), app('steam')->phpBytes(ini_get('post_max_size')));
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]); $subTitle = (string)trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
$subTitleIcon = 'fa-pencil'; $subTitleIcon = 'fa-pencil';
// lists and collections // lists and collections

View File

@@ -60,7 +60,7 @@ class TransactionController extends Controller
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.transactions')); app('view')->share('title', (string)trans('firefly.transactions'));
app('view')->share('mainTitleIcon', 'fa-repeat'); app('view')->share('mainTitleIcon', 'fa-repeat');
$this->repository = app(JournalRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class);
@@ -101,7 +101,7 @@ class TransactionController extends Controller
$startStr = $start->formatLocalized($this->monthAndDayFormat); $startStr = $start->formatLocalized($this->monthAndDayFormat);
$endStr = $end->formatLocalized($this->monthAndDayFormat); $endStr = $end->formatLocalized($this->monthAndDayFormat);
$subTitle = trans('firefly.title_' . $what . '_between', ['start' => $startStr, 'end' => $endStr]); $subTitle = (string)trans('firefly.title_' . $what . '_between', ['start' => $startStr, 'end' => $endStr]);
$periods = $this->getPeriodOverview($what, $end); $periods = $this->getPeriodOverview($what, $end);
/** @var JournalCollectorInterface $collector */ /** @var JournalCollectorInterface $collector */
@@ -134,7 +134,7 @@ class TransactionController extends Controller
$first = $this->repository->firstNull(); $first = $this->repository->firstNull();
$start = null === $first ? new Carbon : $first->date; $start = null === $first ? new Carbon : $first->date;
$end = new Carbon; $end = new Carbon;
$subTitle = trans('firefly.all_' . $what); $subTitle = (string)trans('firefly.all_' . $what);
/** @var JournalCollectorInterface $collector */ /** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class); $collector = app(JournalCollectorInterface::class);
@@ -230,7 +230,7 @@ class TransactionController extends Controller
$events = $this->repository->getPiggyBankEvents($journal); $events = $this->repository->getPiggyBankEvents($journal);
$what = strtolower($transactionType); $what = strtolower($transactionType);
$subTitle = trans('firefly.' . $what) . ' "' . $journal->description . '"'; $subTitle = (string)trans('firefly.' . $what) . ' "' . $journal->description . '"';
return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions', 'linkTypes', 'links')); return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions', 'linkTypes', 'links'));
} }

View File

@@ -80,7 +80,7 @@ class Range
$lang = $pref->data; $lang = $pref->data;
App::setLocale($lang); App::setLocale($lang);
Carbon::setLocale(substr($lang, 0, 2)); Carbon::setLocale(substr($lang, 0, 2));
$locale = explode(',', trans('config.locale')); $locale = explode(',', (string)trans('config.locale'));
$locale = array_map('trim', $locale); $locale = array_map('trim', $locale);
setlocale(LC_TIME, $locale); setlocale(LC_TIME, $locale);

View File

@@ -250,7 +250,7 @@ class JournalFormRequest extends Request
&& 0 !== $accountCurrency && 0 !== $accountCurrency
) { ) {
Log::debug('ADD validation error on native_amount'); Log::debug('ADD validation error on native_amount');
$validator->errors()->add('native_amount', trans('validation.numeric_native')); $validator->errors()->add('native_amount', (string)trans('validation.numeric_native'));
return; return;
} }
@@ -265,7 +265,7 @@ class JournalFormRequest extends Request
&& 0 !== $selectedCurrency && 0 !== $selectedCurrency
&& 0 !== $accountCurrency && 0 !== $accountCurrency
) { ) {
$validator->errors()->add('native_amount', trans('validation.numeric_native')); $validator->errors()->add('native_amount', (string)trans('validation.numeric_native'));
return; return;
} }
@@ -285,15 +285,15 @@ class JournalFormRequest extends Request
&& 0 !== $sourceCurrency && 0 !== $sourceCurrency
&& 0 !== $destinationCurrency && 0 !== $destinationCurrency
) { ) {
$validator->errors()->add('source_amount', trans('validation.numeric_source')); $validator->errors()->add('source_amount', (string)trans('validation.numeric_source'));
} }
if ($sourceCurrency !== $destinationCurrency && '' === $destinationAmount if ($sourceCurrency !== $destinationCurrency && '' === $destinationAmount
&& 0 !== $sourceCurrency && 0 !== $sourceCurrency
&& 0 !== $destinationCurrency && 0 !== $destinationCurrency
) { ) {
$validator->errors()->add('destination_amount', trans('validation.numeric_destination')); $validator->errors()->add('destination_amount', (string)trans('validation.numeric_destination'));
$validator->errors()->add('destination_amount', trans('validation.numeric', ['attribute' => 'destination_amount'])); $validator->errors()->add('destination_amount', (string)trans('validation.numeric', ['attribute' => 'destination_amount']));
} }
return; return;

View File

@@ -155,8 +155,8 @@ class SplitJournalFormRequest extends Request
/** @var array $array */ /** @var array $array */
foreach ($transactions as $array) { foreach ($transactions as $array) {
if (null !== $array['destination_id'] && null !== $array['source_id'] && $array['destination_id'] === $array['source_id']) { if (null !== $array['destination_id'] && null !== $array['source_id'] && $array['destination_id'] === $array['source_id']) {
$validator->errors()->add('journal_source_id', trans('validation.source_equals_destination')); $validator->errors()->add('journal_source_id', (string)trans('validation.source_equals_destination'));
$validator->errors()->add('journal_destination_id', trans('validation.source_equals_destination')); $validator->errors()->add('journal_destination_id', (string)trans('validation.source_equals_destination'));
} }
} }

View File

@@ -114,8 +114,8 @@ class FakeJobConfiguration implements JobConfigurationInterface
{ {
return [ return [
'rulesOptions' => [ 'rulesOptions' => [
1 => trans('firefly.yes'), 1 => (string)trans('firefly.yes'),
0 => trans('firefly.no'), 0 => (string)trans('firefly.no'),
], ],
]; ];
} }

View File

@@ -56,7 +56,7 @@ class AssetAccountIbans implements MapperInterface
/** @noinspection AdditionOperationOnArraysInspection */ /** @noinspection AdditionOperationOnArraysInspection */
$list = $topList + $list; $list = $topList + $list;
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => (string)trans('import.map_do_not_map')] + $list;
return $list; return $list;
} }

View File

@@ -52,7 +52,7 @@ class AssetAccounts implements MapperInterface
$list[$accountId] = $name; $list[$accountId] = $name;
} }
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => (string)trans('import.map_do_not_map')] + $list;
return $list; return $list;
} }

View File

@@ -46,7 +46,7 @@ class Bills implements MapperInterface
$list[$billId] = $bill->name; $list[$billId] = $bill->name;
} }
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => (string)trans('import.map_do_not_map')] + $list;
return $list; return $list;
} }

View File

@@ -46,7 +46,7 @@ class Budgets implements MapperInterface
$list[$budgetId] = $budget->name; $list[$budgetId] = $budget->name;
} }
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => (string)trans('import.map_do_not_map')] + $list;
return $list; return $list;
} }

View File

@@ -46,7 +46,7 @@ class Categories implements MapperInterface
$list[$categoryId] = $category->name; $list[$categoryId] = $category->name;
} }
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => (string)trans('import.map_do_not_map')] + $list;
return $list; return $list;
} }

View File

@@ -61,7 +61,7 @@ class OpposingAccountIbans implements MapperInterface
} }
$list = $topList + $list; $list = $topList + $list;
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => (string)trans('import.map_do_not_map')] + $list;
return $list; return $list;
} }

View File

@@ -58,7 +58,7 @@ class OpposingAccounts implements MapperInterface
$list[$accountId] = $name; $list[$accountId] = $name;
} }
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => (string)trans('import.map_do_not_map')] + $list;
return $list; return $list;
} }

View File

@@ -46,7 +46,7 @@ class Tags implements MapperInterface
$list[$tagId] = $tag->tag; $list[$tagId] = $tag->tag;
} }
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => (string)trans('import.map_do_not_map')] + $list;
return $list; return $list;
} }

View File

@@ -44,7 +44,7 @@ class TransactionCurrencies implements MapperInterface
} }
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => (string)trans('import.map_do_not_map')] + $list;
return $list; return $list;
} }

View File

@@ -72,7 +72,7 @@ class AbnAmroDescription implements SpecificInterface
// If the description could not be parsed, specify an unknown opposing // If the description could not be parsed, specify an unknown opposing
// account, as an opposing account is required // account, as an opposing account is required
if (!$parsed) { if (!$parsed) {
$this->row[8] = trans('firefly.unknown'); // opposing-account-name $this->row[8] = (string)trans('firefly.unknown'); // opposing-account-name
} }
return $this->row; return $this->row;

View File

@@ -260,7 +260,7 @@ class ImportArrayStorage
$repository = app(TagRepositoryInterface::class); $repository = app(TagRepositoryInterface::class);
$repository->setUser($this->importJob->user); $repository->setUser($this->importJob->user);
$data = [ $data = [
'tag' => trans('import.import_with_key', ['key' => $this->importJob->key]), 'tag' => (string)trans('import.import_with_key', ['key' => $this->importJob->key]),
'date' => new Carbon, 'date' => new Carbon,
'description' => null, 'description' => null,
'latitude' => null, 'latitude' => null,

View File

@@ -255,7 +255,7 @@ class CreateRecurringTransactions implements ShouldQueue
'date' => $date, 'date' => $date,
'tags' => $this->repository->getTags($recurrence), 'tags' => $this->repository->getTags($recurrence),
'user' => $recurrence->user_id, 'user' => $recurrence->user_id,
'notes' => trans('firefly.created_from_recurrence', ['id' => $recurrence->id, 'title' => $recurrence->title]), 'notes' => (string)trans('firefly.created_from_recurrence', ['id' => $recurrence->id, 'title' => $recurrence->title]),
// journal data: // journal data:
'description' => $recurrence->recurrenceTransactions()->first()->description, 'description' => $recurrence->recurrenceTransactions()->first()->description,

View File

@@ -64,10 +64,10 @@ class JournalRepository implements JournalRepositoryInterface
if ($source->id === $destination->id || null === $source->id || null === $destination->id) { if ($source->id === $destination->id || null === $source->id || null === $destination->id) {
// default message bag that shows errors for everything. // default message bag that shows errors for everything.
$messages = new MessageBag; $messages = new MessageBag;
$messages->add('source_account_revenue', trans('firefly.invalid_convert_selection')); $messages->add('source_account_revenue', (string)trans('firefly.invalid_convert_selection'));
$messages->add('destination_account_asset', trans('firefly.invalid_convert_selection')); $messages->add('destination_account_asset', (string)trans('firefly.invalid_convert_selection'));
$messages->add('destination_account_expense', trans('firefly.invalid_convert_selection')); $messages->add('destination_account_expense', (string)trans('firefly.invalid_convert_selection'));
$messages->add('source_account_asset', trans('firefly.invalid_convert_selection')); $messages->add('source_account_asset', (string)trans('firefly.invalid_convert_selection'));
return $messages; return $messages;
} }
@@ -78,10 +78,10 @@ class JournalRepository implements JournalRepositoryInterface
// default message bag that shows errors for everything. // default message bag that shows errors for everything.
$messages = new MessageBag; $messages = new MessageBag;
$messages->add('source_account_revenue', trans('firefly.source_or_dest_invalid')); $messages->add('source_account_revenue', (string)trans('firefly.source_or_dest_invalid'));
$messages->add('destination_account_asset', trans('firefly.source_or_dest_invalid')); $messages->add('destination_account_asset', (string)trans('firefly.source_or_dest_invalid'));
$messages->add('destination_account_expense', trans('firefly.source_or_dest_invalid')); $messages->add('destination_account_expense', (string)trans('firefly.source_or_dest_invalid'));
$messages->add('source_account_asset', trans('firefly.source_or_dest_invalid')); $messages->add('source_account_asset', (string)trans('firefly.source_or_dest_invalid'));
return $messages; return $messages;
} }

View File

@@ -526,23 +526,23 @@ class RecurringRepository implements RecurringRepositoryInterface
throw new FireflyException(sprintf('Cannot translate recurring transaction repetition type "%s"', $repetition->repetition_type)); throw new FireflyException(sprintf('Cannot translate recurring transaction repetition type "%s"', $repetition->repetition_type));
break; break;
case 'daily': case 'daily':
return trans('firefly.recurring_daily', [], $language); return (string)trans('firefly.recurring_daily', [], $language);
break; break;
case 'weekly': case 'weekly':
$dayOfWeek = trans(sprintf('config.dow_%s', $repetition->repetition_moment), [], $language); $dayOfWeek = trans(sprintf('config.dow_%s', $repetition->repetition_moment), [], $language);
return trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek], $language); return (string)trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek], $language);
break; break;
case 'monthly': case 'monthly':
// format a date: // format a date:
return trans('firefly.recurring_monthly', ['dayOfMonth' => $repetition->repetition_moment], $language); return (string)trans('firefly.recurring_monthly', ['dayOfMonth' => $repetition->repetition_moment], $language);
break; break;
case 'ndom': case 'ndom':
$parts = explode(',', $repetition->repetition_moment); $parts = explode(',', $repetition->repetition_moment);
// first part is number of week, second is weekday. // first part is number of week, second is weekday.
$dayOfWeek = trans(sprintf('config.dow_%s', $parts[1]), [], $language); $dayOfWeek = trans(sprintf('config.dow_%s', $parts[1]), [], $language);
return trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $parts[0]], $language); return (string)trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $parts[0]], $language);
break; break;
case 'yearly': case 'yearly':
// //
@@ -553,7 +553,7 @@ class RecurringRepository implements RecurringRepositoryInterface
$repDate->addYears($diffInYears); // technically not necessary. $repDate->addYears($diffInYears); // technically not necessary.
$string = $repDate->formatLocalized(trans('config.month_and_day_no_year')); $string = $repDate->formatLocalized(trans('config.month_and_day_no_year'));
return trans('firefly.recurring_yearly', ['date' => $string], $language); return (string)trans('firefly.recurring_yearly', ['date' => $string], $language);
break; break;
} }

View File

@@ -54,7 +54,7 @@ class BelongsUser implements Rule
*/ */
public function message() public function message()
{ {
return trans('validation.belongs_user'); return (string)trans('validation.belongs_user');
} }
/** /**

View File

@@ -54,7 +54,7 @@ class IsValidAttachmentModel implements Rule
*/ */
public function message(): string public function message(): string
{ {
return trans('validation.model_id_invalid'); return (string)trans('validation.model_id_invalid');
} }
/** /**

View File

@@ -59,7 +59,7 @@ class UniqueIban implements Rule
*/ */
public function message() public function message()
{ {
return trans('validation.unique_iban_for_user'); return (string)trans('validation.unique_iban_for_user');
} }
/** /**

View File

@@ -38,7 +38,7 @@ class ValidRecurrenceRepetitionType implements Rule
*/ */
public function message(): string public function message(): string
{ {
return trans('validation.valid_recurrence_rep_type'); return (string)trans('validation.valid_recurrence_rep_type');
} }
/** /**

View File

@@ -41,7 +41,7 @@ class ValidRecurrenceRepetitionValue implements Rule
*/ */
public function message(): string public function message(): string
{ {
return trans('validation.valid_recurrence_rep_type'); return (string)trans('validation.valid_recurrence_rep_type');
} }
/** /**

View File

@@ -51,7 +51,7 @@ class ValidTransactions implements Rule
*/ */
public function message() public function message()
{ {
return trans('validation.invalid_selection'); return (string)trans('validation.invalid_selection');
} }
/** /**

View File

@@ -186,7 +186,7 @@ class Transaction extends SpectreObject
switch ($key) { switch ($key) {
case 'account_number': case 'account_number':
$data['number'] = $value; $data['number'] = $value;
$data['name'] = $data['name'] ?? trans('import.spectre_account_with_number', ['number' => $value]); $data['name'] = $data['name'] ?? (string)trans('import.spectre_account_with_number', ['number' => $value]);
break; break;
case 'payee': case 'payee':
$data['name'] = $value; $data['name'] = $value;

View File

@@ -118,7 +118,7 @@ class Amount
*/ */
public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true): string public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true): string
{ {
$locale = explode(',', trans('config.locale')); $locale = explode(',', (string)trans('config.locale'));
$locale = array_map('trim', $locale); $locale = array_map('trim', $locale);
setlocale(LC_MONETARY, $locale); setlocale(LC_MONETARY, $locale);
$float = round($amount, 12); $float = round($amount, 12);

View File

@@ -74,22 +74,22 @@ class SimpleJournalList implements BinderInterface
$sources = $repository->getJournalSourceAccounts($journal); $sources = $repository->getJournalSourceAccounts($journal);
$destinations = $repository->getJournalDestinationAccounts($journal); $destinations = $repository->getJournalDestinationAccounts($journal);
if ($sources->count() > 1) { if ($sources->count() > 1) {
$messages[] = trans('firefly.cannot_edit_multiple_source', ['description' => $journal->description, 'id' => $journal->id]); $messages[] = (string)trans('firefly.cannot_edit_multiple_source', ['description' => $journal->description, 'id' => $journal->id]);
continue; continue;
} }
if ($destinations->count() > 1) { if ($destinations->count() > 1) {
$messages[] = trans('firefly.cannot_edit_multiple_dest', ['description' => $journal->description, 'id' => $journal->id]); $messages[] = (string)trans('firefly.cannot_edit_multiple_dest', ['description' => $journal->description, 'id' => $journal->id]);
continue; continue;
} }
if (TransactionType::OPENING_BALANCE === $repository->getTransactionType($journal)) { if (TransactionType::OPENING_BALANCE === $repository->getTransactionType($journal)) {
$messages[] = trans('firefly.cannot_edit_opening_balance'); $messages[] = (string)trans('firefly.cannot_edit_opening_balance');
continue; continue;
} }
// cannot edit reconciled transactions / journals: // cannot edit reconciled transactions / journals:
if ($repository->isJournalReconciled($journal)) { if ($repository->isJournalReconciled($journal)) {
$messages[] = trans('firefly.cannot_edit_reconciled', ['description' => $journal->description, 'id' => $journal->id]); $messages[] = (string)trans('firefly.cannot_edit_reconciled', ['description' => $journal->description, 'id' => $journal->id]);
continue; continue;
} }

View File

@@ -302,7 +302,7 @@ class ExpandedForm
// get all currencies: // get all currencies:
$list = $currencyRepos->get(); $list = $currencyRepos->get();
$array = [ $array = [
0 => trans('firefly.no_currency'), 0 => (string)trans('firefly.no_currency'),
]; ];
/** @var TransactionCurrency $currency */ /** @var TransactionCurrency $currency */
foreach ($list as $currency) { foreach ($list as $currency) {
@@ -593,7 +593,7 @@ class ExpandedForm
$repository = app(PiggyBankRepositoryInterface::class); $repository = app(PiggyBankRepositoryInterface::class);
$piggyBanks = $repository->getPiggyBanksWithAmount(); $piggyBanks = $repository->getPiggyBanksWithAmount();
$array = [ $array = [
0 => trans('firefly.none_in_select_list'), 0 => (string)trans('firefly.none_in_select_list'),
]; ];
/** @var PiggyBank $piggy */ /** @var PiggyBank $piggy */
foreach ($piggyBanks as $piggy) { foreach ($piggyBanks as $piggy) {
@@ -644,7 +644,7 @@ class ExpandedForm
// get all currencies: // get all currencies:
$list = $groupRepos->get(); $list = $groupRepos->get();
$array = [ $array = [
0 => trans('firefly.none_in_select_list'), 0 => (string)trans('firefly.none_in_select_list'),
]; ];
/** @var RuleGroup $group */ /** @var RuleGroup $group */
foreach ($list as $group) { foreach ($list as $group) {

View File

@@ -34,7 +34,6 @@ use FireflyIII\Support\CacheProperties;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log; use Log;
use Preferences;
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore

View File

@@ -86,7 +86,7 @@ class ChooseAccountsHandler implements BunqJobConfigurationInterface
} }
if (\count($mapping) === 0) { if (\count($mapping) === 0) {
$messages = new MessageBag; $messages = new MessageBag;
$messages->add('nomap', trans('import.bunq_no_mapping')); $messages->add('nomap', (string)trans('import.bunq_no_mapping'));
return $messages; return $messages;
} }

View File

@@ -296,7 +296,7 @@ class ConfigureRolesHandler implements FileConfigurationInterface
{ {
$roles = []; $roles = [];
foreach (array_keys(config('csv.import_roles')) as $role) { foreach (array_keys(config('csv.import_roles')) as $role) {
$roles[$role] = trans('import.column_' . $role); $roles[$role] = (string)trans('import.column_' . $role);
} }
asort($roles); asort($roles);

View File

@@ -80,7 +80,7 @@ class ConfigureUploadHandler implements FileConfigurationInterface
} }
if (!$complete) { if (!$complete) {
$messages = new MessageBag; $messages = new MessageBag;
$messages->add('account', trans('import.invalid_import_account')); $messages->add('account', (string)trans('import.invalid_import_account'));
return $messages; return $messages;
} }
@@ -96,9 +96,9 @@ class ConfigureUploadHandler implements FileConfigurationInterface
public function getNextData(): array public function getNextData(): array
{ {
$delimiters = [ $delimiters = [
',' => trans('form.csv_comma'), ',' => (string)trans('form.csv_comma'),
';' => trans('form.csv_semicolon'), ';' => (string)trans('form.csv_semicolon'),
'tab' => trans('form.csv_tab'), 'tab' => (string)trans('form.csv_tab'),
]; ];
$config = $this->importJob->configuration; $config = $this->importJob->configuration;
$config['date-format'] = $config['date-format'] ?? 'Ymd'; $config['date-format'] = $config['date-format'] ?? 'Ymd';

View File

@@ -91,7 +91,7 @@ class NewFileJobHandler implements FileConfigurationInterface
$importFileTypes = []; $importFileTypes = [];
$defaultImportType = config('import.options.file.default_import_format'); $defaultImportType = config('import.options.file.default_import_format');
foreach ($allowedTypes as $type) { foreach ($allowedTypes as $type) {
$importFileTypes[$type] = trans('import.import_file_type_' . $type); $importFileTypes[$type] = (string)trans('import.import_file_type_' . $type);
} }
return [ return [
@@ -145,7 +145,7 @@ class NewFileJobHandler implements FileConfigurationInterface
// check if content is UTF8: // check if content is UTF8:
if (!$this->isUTF8($attachment)) { if (!$this->isUTF8($attachment)) {
$message = trans('import.file_not_utf8'); $message = (string)trans('import.file_not_utf8');
Log::error($message); Log::error($message);
$messages->add('import_file', $message); $messages->add('import_file', $message);
// delete attachment: // delete attachment:

View File

@@ -100,7 +100,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
$config['apply-rules'] = $applyRules; $config['apply-rules'] = $applyRules;
$this->repository->setConfiguration($this->importJob, $config); $this->repository->setConfiguration($this->importJob, $config);
if ($final === [0 => 0] || \count($final) === 0) { if ($final === [0 => 0] || \count($final) === 0) {
$messages->add('count', trans('import.spectre_no_mapping')); $messages->add('count', (string)trans('import.spectre_no_mapping'));
} }
return $messages; return $messages;

View File

@@ -236,7 +236,7 @@ class ImportTransaction
$this->note = trim($this->note . ' ' . $columnValue->getValue()); $this->note = trim($this->note . ' ' . $columnValue->getValue());
break; break;
case 'opposing-id': case 'opposing-id':
$mappedValue = $this->getMappedValue($columnValue); $mappedValue = $this->getMappedValue($columnValue);
$this->opposingId = $mappedValue; $this->opposingId = $mappedValue;
Log::debug(sprintf('Going to set the OPPOSING-id. Original value is "%s", mapped value is "%s".', $columnValue->getValue(), $mappedValue)); Log::debug(sprintf('Going to set the OPPOSING-id. Original value is "%s", mapped value is "%s".', $columnValue->getValue(), $mappedValue));
break; break;

View File

@@ -302,19 +302,19 @@ class Navigation
{ {
$date = clone $theDate; $date = clone $theDate;
$formatMap = [ $formatMap = [
'1D' => trans('config.specific_day'), '1D' => (string)trans('config.specific_day'),
'daily' => trans('config.specific_day'), 'daily' => (string)trans('config.specific_day'),
'custom' => trans('config.specific_day'), 'custom' => (string)trans('config.specific_day'),
'1W' => trans('config.week_in_year'), '1W' => (string)trans('config.week_in_year'),
'week' => trans('config.week_in_year'), 'week' => (string)trans('config.week_in_year'),
'weekly' => trans('config.week_in_year'), 'weekly' => (string)trans('config.week_in_year'),
'1M' => trans('config.month'), '1M' => (string)trans('config.month'),
'month' => trans('config.month'), 'month' => (string)trans('config.month'),
'monthly' => trans('config.month'), 'monthly' => (string)trans('config.month'),
'1Y' => trans('config.year'), '1Y' => (string)trans('config.year'),
'year' => trans('config.year'), 'year' => (string)trans('config.year'),
'yearly' => trans('config.year'), 'yearly' => (string)trans('config.year'),
'6M' => trans('config.half_year'), '6M' => (string)trans('config.half_year'),
]; ];
if (isset($formatMap[$repeatFrequency])) { if (isset($formatMap[$repeatFrequency])) {

View File

@@ -261,7 +261,7 @@ class Transaction extends Twig_Extension
} }
if (AccountType::CASH === $type) { if (AccountType::CASH === $type) {
$txt = '<span class="text-success">(' . trans('firefly.cash') . ')</span>'; $txt = '<span class="text-success">(' . (string)trans('firefly.cash') . ')</span>';
return $txt; return $txt;
} }
@@ -310,19 +310,19 @@ class Transaction extends Twig_Extension
{ {
switch ($transaction->transaction_type_type) { switch ($transaction->transaction_type_type) {
case TransactionType::WITHDRAWAL: case TransactionType::WITHDRAWAL:
$txt = sprintf('<i class="fa fa-long-arrow-left fa-fw" title="%s"></i>', trans('firefly.withdrawal')); $txt = sprintf('<i class="fa fa-long-arrow-left fa-fw" title="%s"></i>', (string)trans('firefly.withdrawal'));
break; break;
case TransactionType::DEPOSIT: case TransactionType::DEPOSIT:
$txt = sprintf('<i class="fa fa-long-arrow-right fa-fw" title="%s"></i>', trans('firefly.deposit')); $txt = sprintf('<i class="fa fa-long-arrow-right fa-fw" title="%s"></i>', (string)trans('firefly.deposit'));
break; break;
case TransactionType::TRANSFER: case TransactionType::TRANSFER:
$txt = sprintf('<i class="fa fa-fw fa-exchange" title="%s"></i>', trans('firefly.transfer')); $txt = sprintf('<i class="fa fa-fw fa-exchange" title="%s"></i>', (string)trans('firefly.transfer'));
break; break;
case TransactionType::OPENING_BALANCE: case TransactionType::OPENING_BALANCE:
$txt = sprintf('<i class="fa-fw fa fa-star-o" title="%s"></i>', trans('firefly.opening_balance')); $txt = sprintf('<i class="fa-fw fa fa-star-o" title="%s"></i>', (string)trans('firefly.opening_balance'));
break; break;
case TransactionType::RECONCILIATION: case TransactionType::RECONCILIATION:
$txt = sprintf('<i class="fa-fw fa fa-calculator" title="%s"></i>', trans('firefly.reconciliation_transaction')); $txt = sprintf('<i class="fa-fw fa fa-calculator" title="%s"></i>', (string)trans('firefly.reconciliation_transaction'));
break; break;
default: default:
$txt = ''; $txt = '';
@@ -412,7 +412,7 @@ class Transaction extends Twig_Extension
} }
if (AccountType::CASH === $type) { if (AccountType::CASH === $type) {
$txt = '<span class="text-success">(' . trans('firefly.cash') . ')</span>'; $txt = '<span class="text-success">(' . (string)trans('firefly.cash') . ')</span>';
return $txt; return $txt;
} }

View File

@@ -43,7 +43,7 @@ class Rule extends Twig_Extension
$ruleActions = array_keys(Config::get('firefly.rule-actions')); $ruleActions = array_keys(Config::get('firefly.rule-actions'));
$possibleActions = []; $possibleActions = [];
foreach ($ruleActions as $key) { foreach ($ruleActions as $key) {
$possibleActions[$key] = trans('firefly.rule_action_' . $key . '_choice'); $possibleActions[$key] = (string)trans('firefly.rule_action_' . $key . '_choice');
} }
unset($key, $ruleActions); unset($key, $ruleActions);
asort($possibleActions); asort($possibleActions);
@@ -62,8 +62,8 @@ class Rule extends Twig_Extension
'allJournalTriggers', 'allJournalTriggers',
function () { function () {
return [ return [
'store-journal' => trans('firefly.rule_trigger_store_journal'), 'store-journal' => (string)trans('firefly.rule_trigger_store_journal'),
'update-journal' => trans('firefly.rule_trigger_update_journal'), 'update-journal' => (string)trans('firefly.rule_trigger_update_journal'),
]; ];
} }
); );
@@ -81,7 +81,7 @@ class Rule extends Twig_Extension
$possibleTriggers = []; $possibleTriggers = [];
foreach ($ruleTriggers as $key) { foreach ($ruleTriggers as $key) {
if ('user_action' !== $key) { if ('user_action' !== $key) {
$possibleTriggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice'); $possibleTriggers[$key] = (string)trans('firefly.rule_trigger_' . $key . '_choice');
} }
} }
unset($key, $ruleTriggers); unset($key, $ruleTriggers);

View File

@@ -60,8 +60,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $id * @property int $id
* @property string $email * @property string $email
* @property bool $isAdmin used in admin user controller. * @property bool $isAdmin used in admin user controller.
* @property bool $has2FA used in admin user controller. * @property bool $has2FA used in admin user controller.
* @property array $prefs used in admin user controller. * @property array $prefs used in admin user controller.
* @property mixed password * @property mixed password
*/ */
class User extends Authenticatable class User extends Authenticatable

View File

@@ -51,7 +51,7 @@ trait RecurrenceValidation
foreach ($repetitions as $index => $repetition) { foreach ($repetitions as $index => $repetition) {
switch ($repetition['type']) { switch ($repetition['type']) {
default: default:
$validator->errors()->add(sprintf('repetitions.%d.type', $index), trans('validation.valid_recurrence_rep_type')); $validator->errors()->add(sprintf('repetitions.%d.type', $index), (string)trans('validation.valid_recurrence_rep_type'));
return; return;
case 'daily': case 'daily':
@@ -84,7 +84,7 @@ trait RecurrenceValidation
$repetitions = $data['repetitions'] ?? []; $repetitions = $data['repetitions'] ?? [];
// need at least one transaction // need at least one transaction
if (\count($repetitions) === 0) { if (\count($repetitions) === 0) {
$validator->errors()->add('description', trans('validation.at_least_one_repetition')); $validator->errors()->add('description', (string)trans('validation.at_least_one_repetition'));
} }
} }
@@ -101,8 +101,8 @@ trait RecurrenceValidation
$repeatUntil = $data['repeat_until'] ?? null; $repeatUntil = $data['repeat_until'] ?? null;
if (null !== $repetitions && null !== $repeatUntil) { if (null !== $repetitions && null !== $repeatUntil) {
// expect a date OR count: // expect a date OR count:
$validator->errors()->add('repeat_until', trans('validation.require_repeat_until')); $validator->errors()->add('repeat_until', (string)trans('validation.require_repeat_until'));
$validator->errors()->add('nr_of_repetitions', trans('validation.require_repeat_until')); $validator->errors()->add('nr_of_repetitions', (string)trans('validation.require_repeat_until'));
} }
} }
@@ -116,7 +116,7 @@ trait RecurrenceValidation
protected function validateDaily(Validator $validator, int $index, string $moment): void protected function validateDaily(Validator $validator, int $index, string $moment): void
{ {
if ('' !== $moment) { if ('' !== $moment) {
$validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment'));
} }
} }
@@ -130,7 +130,7 @@ trait RecurrenceValidation
protected function validateMonthly(Validator $validator, int $index, int $dayOfMonth): void protected function validateMonthly(Validator $validator, int $index, int $dayOfMonth): void
{ {
if ($dayOfMonth < 1 || $dayOfMonth > 31) { if ($dayOfMonth < 1 || $dayOfMonth > 31) {
$validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment'));
} }
} }
@@ -146,19 +146,19 @@ trait RecurrenceValidation
{ {
$parameters = explode(',', $moment); $parameters = explode(',', $moment);
if (\count($parameters) !== 2) { if (\count($parameters) !== 2) {
$validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment'));
return; return;
} }
$nthDay = (int)($parameters[0] ?? 0.0); $nthDay = (int)($parameters[0] ?? 0.0);
$dayOfWeek = (int)($parameters[1] ?? 0.0); $dayOfWeek = (int)($parameters[1] ?? 0.0);
if ($nthDay < 1 || $nthDay > 5) { if ($nthDay < 1 || $nthDay > 5) {
$validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment'));
return; return;
} }
if ($dayOfWeek < 1 || $dayOfWeek > 7) { if ($dayOfWeek < 1 || $dayOfWeek > 7) {
$validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment'));
} }
} }
@@ -172,7 +172,7 @@ trait RecurrenceValidation
protected function validateWeekly(Validator $validator, int $index, int $dayOfWeek): void protected function validateWeekly(Validator $validator, int $index, int $dayOfWeek): void
{ {
if ($dayOfWeek < 1 || $dayOfWeek > 7) { if ($dayOfWeek < 1 || $dayOfWeek > 7) {
$validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment'));
} }
} }
@@ -188,7 +188,7 @@ trait RecurrenceValidation
try { try {
Carbon::createFromFormat('Y-m-d', $moment); Carbon::createFromFormat('Y-m-d', $moment);
} catch (InvalidArgumentException|Exception $e) { } catch (InvalidArgumentException|Exception $e) {
$validator->errors()->add(sprintf('repetitions.%d.moment', $index), trans('validation.valid_recurrence_rep_moment')); $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string)trans('validation.valid_recurrence_rep_moment'));
} }
} }
} }

View File

@@ -92,14 +92,14 @@ trait TransactionValidation
$destinationAccount = $this->assetAccountExists($validator, $destinationId, $destinationName, $idField, $nameField); $destinationAccount = $this->assetAccountExists($validator, $destinationId, $destinationName, $idField, $nameField);
break; break;
default: default:
$validator->errors()->add($idField, trans('validation.invalid_account_info')); $validator->errors()->add($idField, (string)trans('validation.invalid_account_info'));
return; return;
} }
// add some errors in case of same account submitted: // add some errors in case of same account submitted:
if (null !== $sourceAccount && null !== $destinationAccount && $sourceAccount->id === $destinationAccount->id) { if (null !== $sourceAccount && null !== $destinationAccount && $sourceAccount->id === $destinationAccount->id) {
$validator->errors()->add($idField, trans('validation.source_equals_destination')); $validator->errors()->add($idField, (string)trans('validation.source_equals_destination'));
} }
} }
} }
@@ -124,7 +124,7 @@ trait TransactionValidation
// no valid descriptions and empty journal description? error. // no valid descriptions and empty journal description? error.
if ($validDescriptions === 0 && '' === $journalDescription) { if ($validDescriptions === 0 && '' === $journalDescription) {
$validator->errors()->add('description', trans('validation.filled', ['attribute' => trans('validation.attributes.description')])); $validator->errors()->add('description', (string)trans('validation.filled', ['attribute' => (string)trans('validation.attributes.description')]));
} }
} }
@@ -144,7 +144,7 @@ trait TransactionValidation
|| isset($transaction['foreign_currency_code']))) { || isset($transaction['foreign_currency_code']))) {
$validator->errors()->add( $validator->errors()->add(
'transactions.' . $index . '.foreign_amount', 'transactions.' . $index . '.foreign_amount',
trans('validation.require_currency_info') (string)trans('validation.require_currency_info')
); );
} }
} }
@@ -164,7 +164,7 @@ trait TransactionValidation
$description = (string)($transaction['description'] ?? ''); $description = (string)($transaction['description'] ?? '');
// description cannot be equal to journal description. // description cannot be equal to journal description.
if ($description === $journalDescription) { if ($description === $journalDescription) {
$validator->errors()->add('transactions.' . $index . '.description', trans('validation.equal_description')); $validator->errors()->add('transactions.' . $index . '.description', (string)trans('validation.equal_description'));
} }
} }
} }
@@ -180,7 +180,7 @@ trait TransactionValidation
$transactions = $data['transactions'] ?? []; $transactions = $data['transactions'] ?? [];
// need at least one transaction // need at least one transaction
if (\count($transactions) === 0) { if (\count($transactions) === 0) {
$validator->errors()->add('description', trans('validation.at_least_one_transaction')); $validator->errors()->add('description', (string)trans('validation.at_least_one_transaction'));
} }
} }
@@ -223,18 +223,18 @@ trait TransactionValidation
switch ($data['type']) { switch ($data['type']) {
case 'withdrawal': case 'withdrawal':
if (\count($sources) > 1) { if (\count($sources) > 1) {
$validator->errors()->add('transactions.0.source_id', trans('validation.all_accounts_equal')); $validator->errors()->add('transactions.0.source_id', (string)trans('validation.all_accounts_equal'));
} }
break; break;
case 'deposit': case 'deposit':
if (\count($destinations) > 1) { if (\count($destinations) > 1) {
$validator->errors()->add('transactions.0.destination_id', trans('validation.all_accounts_equal')); $validator->errors()->add('transactions.0.destination_id', (string)trans('validation.all_accounts_equal'));
} }
break; break;
case 'transfer': case 'transfer':
if (\count($sources) > 1 || \count($destinations) > 1) { if (\count($sources) > 1 || \count($destinations) > 1) {
$validator->errors()->add('transactions.0.source_id', trans('validation.all_accounts_equal')); $validator->errors()->add('transactions.0.source_id', (string)trans('validation.all_accounts_equal'));
$validator->errors()->add('transactions.0.destination_id', trans('validation.all_accounts_equal')); $validator->errors()->add('transactions.0.destination_id', (string)trans('validation.all_accounts_equal'));
} }
break; break;
} }
@@ -256,7 +256,7 @@ trait TransactionValidation
if ('' === $description && \count($transactions) > 1) { if ('' === $description && \count($transactions) > 1) {
$validator->errors()->add( $validator->errors()->add(
'transactions.' . $index . '.description', 'transactions.' . $index . '.description',
trans('validation.filled', ['attribute' => trans('validation.attributes.transaction_description')]) (string)trans('validation.filled', ['attribute' => (string)trans('validation.attributes.transaction_description')])
); );
} }
} }
@@ -283,7 +283,7 @@ trait TransactionValidation
$accountName = (string)$accountName; $accountName = (string)$accountName;
// both empty? hard exit. // both empty? hard exit.
if ($accountId < 1 && '' === $accountName) { if ($accountId < 1 && '' === $accountName) {
$validator->errors()->add($idField, trans('validation.filled', ['attribute' => $idField])); $validator->errors()->add($idField, (string)trans('validation.filled', ['attribute' => $idField]));
return null; return null;
} }
@@ -297,7 +297,7 @@ trait TransactionValidation
/** @var Account $first */ /** @var Account $first */
$first = $set->first(); $first = $set->first();
if ($first->accountType->type !== AccountType::ASSET) { if ($first->accountType->type !== AccountType::ASSET) {
$validator->errors()->add($idField, trans('validation.belongs_user')); $validator->errors()->add($idField, (string)trans('validation.belongs_user'));
return null; return null;
} }
@@ -308,7 +308,7 @@ trait TransactionValidation
$account = $repository->findByName($accountName, [AccountType::ASSET]); $account = $repository->findByName($accountName, [AccountType::ASSET]);
if (null === $account) { if (null === $account) {
$validator->errors()->add($nameField, trans('validation.belongs_user')); $validator->errors()->add($nameField, (string)trans('validation.belongs_user'));
return null; return null;
} }
@@ -350,7 +350,7 @@ trait TransactionValidation
/** @var Account $first */ /** @var Account $first */
$first = $set->first(); $first = $set->first();
if ($first->accountType->type !== $type) { if ($first->accountType->type !== $type) {
$validator->errors()->add($idField, trans('validation.belongs_user')); $validator->errors()->add($idField, (string)trans('validation.belongs_user'));
return null; return null;
} }