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);
$max = (float)($data['amount_max'] ?? 0);
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'] ?? [];
// need at least one transaction
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'] ?? [];
// need at least one transaction
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(
function ($request, $next) {
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);
@@ -70,7 +70,7 @@ class CreateController extends Controller
$what = $what ?? 'asset';
$defaultCurrency = app('amount')->getDefaultCurrency();
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
$subTitle = trans('firefly.make_new_' . $what . '_account');
$subTitle = (string)trans('firefly.make_new_' . $what . '_account');
$roles = [];
foreach (config('firefly.accountRoles') as $role) {
$roles[$role] = (string)trans('firefly.account_role_' . $role);

View File

@@ -50,7 +50,7 @@ class DeleteController extends Controller
$this->middleware(
function ($request, $next) {
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);
@@ -67,7 +67,7 @@ class DeleteController extends Controller
public function delete(Account $account)
{
$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]));
unset($accountList[$account->id]);

View File

@@ -53,7 +53,7 @@ class EditController extends Controller
$this->middleware(
function ($request, $next) {
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->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -76,7 +76,7 @@ class EditController extends Controller
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
{
$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);
$roles = [];
foreach (config('firefly.accountRoles') as $role) {

View File

@@ -50,7 +50,7 @@ class IndexController extends Controller
$this->middleware(
function ($request, $next) {
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);
@@ -68,7 +68,7 @@ class IndexController extends Controller
public function index(Request $request, string $what)
{
$what = $what ?? 'asset';
$subTitle = trans('firefly.' . $what . '_accounts');
$subTitle = (string)trans('firefly.' . $what . '_accounts');
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
$types = config('firefly.accountTypesByIdentifier.' . $what);
$collection = $this->repository->getAccountsByType($types);

View File

@@ -64,7 +64,7 @@ class ReconcileController extends Controller
$this->middleware(
function ($request, $next) {
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->accountRepos = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -85,7 +85,7 @@ class ReconcileController extends Controller
return redirect(route('transactions.edit', [$journal->id]));
}
// view related code
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
$subTitle = (string)trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
// journal related code
$pTransaction = $this->repository->getFirstPosTransaction($journal);
@@ -126,7 +126,7 @@ class ReconcileController extends Controller
return $this->redirectToOriginalAccount($account);
}
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)]));
}
@@ -153,7 +153,7 @@ class ReconcileController extends Controller
$startBalance = round(app('steam')->balance($account, $startDate), $currency->decimal_places);
$endBalance = round(app('steam')->balance($account, $end), $currency->decimal_places);
$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
$transactionsUri = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']);
@@ -180,7 +180,7 @@ class ReconcileController extends Controller
if (TransactionType::RECONCILIATION !== $journal->transactionType->type) {
return redirect(route('transactions.show', [$journal->id]));
}
$subTitle = trans('firefly.reconciliation') . ' "' . $journal->description . '"';
$subTitle = (string)trans('firefly.reconciliation') . ' "' . $journal->description . '"';
// get main transaction:
$transaction = $this->repository->getAssetTransaction($journal);
@@ -272,7 +272,7 @@ class ReconcileController extends Controller
}
Log::debug('End of routine.');
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]));
}
@@ -293,7 +293,7 @@ class ReconcileController extends Controller
return redirect(route('transactions.show', [$journal->id]));
}
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();
}

View File

@@ -61,7 +61,7 @@ class ShowController extends Controller
$this->middleware(
function ($request, $next) {
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->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -107,7 +107,7 @@ class ShowController extends Controller
}
$fStart = $start->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')]);
$periods = $this->getPeriodOverview($account, $end);
/** @var JournalCollectorInterface $collector */
@@ -151,7 +151,7 @@ class ShowController extends Controller
if (0 === $currencyId) {
$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;
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);

View File

@@ -58,7 +58,7 @@ class LinkController extends Controller
*/
public function create()
{
$subTitle = trans('firefly.create_new_link_type');
$subTitle = (string)trans('firefly.create_new_link_type');
$subTitleIcon = 'fa-link';
// 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'));
}
$subTitle = trans('firefly.delete_link_type', ['name' => $linkType->name]);
$subTitle = (string)trans('firefly.delete_link_type', ['name' => $linkType->name]);
$otherTypes = $repository->get();
$count = $repository->countJournals($linkType);
$moveTo = [];
$moveTo[0] = trans('firefly.do_not_save_connection');
$moveTo[0] = (string)trans('firefly.do_not_save_connection');
/** @var LinkType $otherType */
foreach ($otherTypes as $otherType) {
if ($otherType->id !== $linkType->id) {
@@ -133,7 +133,7 @@ class LinkController extends Controller
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';
// 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)
{
$subTitle = trans('firefly.journal_link_configuration');
$subTitle = (string)trans('firefly.journal_link_configuration');
$subTitleIcon = 'fa-link';
$linkTypes = $repository->get();
$linkTypes->each(
@@ -171,7 +171,7 @@ class LinkController extends Controller
*/
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';
$links = $linkType->transactionJournalLinks()->get();

View File

@@ -62,14 +62,14 @@ class UpdateController extends Controller
*/
public function index()
{
$subTitle = trans('firefly.update_check_title');
$subTitle = (string)trans('firefly.update_check_title');
$subTitleIcon = 'fa-star';
$permission = app('fireflyconfig')->get('permission_update_check', -1);
$selected = $permission->data;
$options = [
-1 => trans('firefly.updates_ask_me_later'),
0 => trans('firefly.updates_do_not_check'),
1 => trans('firefly.updates_enable_check'),
-1 => (string)trans('firefly.updates_ask_me_later'),
0 => (string)trans('firefly.updates_do_not_check'),
1 => (string)trans('firefly.updates_enable_check'),
];
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)
{
$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'));
}

View File

@@ -50,7 +50,7 @@ class AttachmentController extends Controller
$this->middleware(
function ($request, $next) {
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);
return $next($request);
@@ -65,7 +65,7 @@ class AttachmentController extends Controller
*/
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
$this->rememberPreviousUri('attachments.delete.uri');
@@ -131,7 +131,7 @@ class AttachmentController extends Controller
public function edit(Request $request, Attachment $attachment)
{
$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").
if (true !== session('attachments.edit.fromUpdate')) {

View File

@@ -75,7 +75,7 @@ class ForgotPasswordController extends Controller
$user = User::where('email', $request->get('email'))->first();
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

View File

@@ -67,7 +67,7 @@ class BillController extends Controller
$this->middleware(
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');
$this->attachments = app(AttachmentHelperInterface::class);
$this->billRepository = app(BillRepositoryInterface::class);
@@ -91,7 +91,7 @@ class BillController extends Controller
foreach ($billPeriods as $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();
// 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
$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'));
}
@@ -147,10 +147,10 @@ class BillController extends Controller
$billPeriods = config('firefly.bill_periods');
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").
if (true !== session('bills.edit.fromUpdate')) {

View File

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

View File

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

View File

@@ -49,7 +49,7 @@ class DeleteController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('title', trans('firefly.budgets'));
app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-tasks');
$this->repository = app(BudgetRepositoryInterface::class);
@@ -66,7 +66,7 @@ class DeleteController extends Controller
*/
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
$this->rememberPreviousUri('budgets.delete.uri');

View File

@@ -51,7 +51,7 @@ class EditController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('title', trans('firefly.budgets'));
app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-tasks');
$this->repository = app(BudgetRepositoryInterface::class);
@@ -68,7 +68,7 @@ class EditController extends Controller
*/
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
$hasOldInput = null !== $request->old('_token');

View File

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

View File

@@ -58,7 +58,7 @@ class ShowController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('title', trans('firefly.budgets'));
app('view')->share('title', (string)trans('firefly.budgets'));
app('view')->share('mainTitleIcon', 'fa-tasks');
$this->repository = app(BudgetRepositoryInterface::class);
@@ -106,7 +106,7 @@ class ShowController extends Controller
*/
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();
$start = null === $first ? new Carbon : $first->date;
$end = new Carbon;
@@ -148,7 +148,7 @@ class ShowController extends Controller
$transactions = $collector->getPaginatedJournals();
$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'));
}

View File

@@ -57,7 +57,7 @@ class NoCategoryController extends Controller
$this->middleware(
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');
$this->journalRepos = app(JournalRepositoryInterface::class);
$this->repository = app(CategoryRepositoryInterface::class);
@@ -120,7 +120,7 @@ class NoCategoryController extends Controller
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
Log::debug('Start of noCategory()');
$subTitle = trans('firefly.all_journals_without_category');
$subTitle = (string)trans('firefly.all_journals_without_category');
$first = $this->journalRepos->firstNull();
$start = null === $first ? new Carbon : $first->date;
$end = new Carbon;

View File

@@ -63,7 +63,7 @@ class ShowController extends Controller
$this->middleware(
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');
$this->journalRepos = app(JournalRepositoryInterface::class);
$this->repository = app(CategoryRepositoryInterface::class);
@@ -130,7 +130,7 @@ class ShowController extends Controller
$periods = new Collection;
$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);
/** @var Carbon $start */
$start = $first ?? new Carbon;

View File

@@ -46,7 +46,7 @@ class CategoryController extends Controller
$this->middleware(
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');
$this->repository = app(CategoryRepositoryInterface::class);
@@ -66,7 +66,7 @@ class CategoryController extends Controller
$this->rememberPreviousUri('categories.create.uri');
}
$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'));
}
@@ -78,7 +78,7 @@ class CategoryController extends Controller
*/
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
$this->rememberPreviousUri('categories.delete.uri');
@@ -111,7 +111,7 @@ class CategoryController extends Controller
*/
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").
if (true !== session('categories.edit.fromUpdate')) {

View File

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

View File

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

View File

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

View File

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

View File

@@ -53,7 +53,7 @@ class CurrencyController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('title', trans('firefly.currencies'));
app('view')->share('title', (string)trans('firefly.currencies'));
app('view')->share('mainTitleIcon', 'fa-usd');
$this->repository = app(CurrencyRepositoryInterface::class);
$this->userRepository = app(UserRepositoryInterface::class);
@@ -74,13 +74,13 @@ class CurrencyController extends Controller
/** @var User $user */
$user = auth()->user();
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'));
}
$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").
if (true !== session('currencies.create.fromStore')) {
@@ -102,7 +102,7 @@ class CurrencyController extends Controller
app('preferences')->set('currencyPreference', $currency->code);
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('FFCURRENCYCODE');
@@ -122,21 +122,21 @@ class CurrencyController extends Controller
$user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) {
// @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'));
// @codeCoverageIgnoreEnd
}
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'));
}
// put previous url in session
$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'));
}
@@ -154,20 +154,20 @@ class CurrencyController extends Controller
$user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) {
// @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'));
// @codeCoverageIgnoreEnd
}
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'));
}
$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'));
}
@@ -185,14 +185,14 @@ class CurrencyController extends Controller
$user = auth()->user();
if (!$this->userRepository->hasRole($user, 'owner')) {
// @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'));
// @codeCoverageIgnoreEnd
}
$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);
// 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')));
$isOwner = true;
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;
}
@@ -258,7 +258,7 @@ class CurrencyController extends Controller
$currency = $this->repository->store($data);
$redirect = redirect($this->getPreviousUri('currencies.create.uri'));
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')) {
// @codeCoverageIgnoreStart
@@ -269,7 +269,7 @@ class CurrencyController extends Controller
}
}
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();
if (!$this->userRepository->hasRole($user, 'owner')) {
// @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'));
// @codeCoverageIgnoreEnd
@@ -297,7 +297,7 @@ class CurrencyController extends Controller
$data = $request->getCurrencyData();
$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();
if (1 === (int)$request->get('return_to_edit')) {

View File

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

View File

@@ -48,7 +48,7 @@ class ExportController extends Controller
$this->middleware(
function ($request, $next) {
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);
}
@@ -100,7 +100,7 @@ class ExportController extends Controller
*/
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) {
return redirect(route('new-user.index'));
}
$subTitle = trans('firefly.welcomeBack');
$subTitle = (string)trans('firefly.welcomeBack');
$transactions = [];
$frontPage = app('preferences')->get(
'frontPageAccounts',

View File

@@ -53,7 +53,7 @@ class IndexController extends Controller
$this->middleware(
function ($request, $next) {
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->userRepository = app(UserRepositoryInterface::class);
@@ -78,7 +78,7 @@ class IndexController extends Controller
$providers = array_keys($this->getProviders());
if (!\in_array($importProvider, $providers, true)) {
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'));
}
@@ -185,7 +185,7 @@ class IndexController extends Controller
public function index()
{
$providers = $this->getProviders();
$subTitle = trans('import.index_breadcrumb');
$subTitle = (string)trans('import.index_breadcrumb');
$subTitleIcon = 'fa-home';
return view('import.index', compact('subTitle', 'subTitleIcon', 'providers'));

View File

@@ -50,7 +50,7 @@ class JobConfigurationController extends Controller
$this->middleware(
function ($request, $next) {
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);
return $next($request);
@@ -74,7 +74,7 @@ class JobConfigurationController extends Controller
$allowed = ['has_prereq', 'need_job_config'];
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)));
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'));
}
@@ -104,7 +104,7 @@ class JobConfigurationController extends Controller
$view = $configurator->getNextView();
$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';
return view($view, compact('data', 'importJob', 'subTitle', 'subTitleIcon'));
@@ -125,7 +125,7 @@ class JobConfigurationController extends Controller
// catch impossible status:
$allowed = ['has_prereq', 'need_job_config'];
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'));
}

View File

@@ -50,7 +50,7 @@ class JobStatusController extends Controller
$this->middleware(
function ($request, $next) {
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);
return $next($request);
@@ -66,7 +66,7 @@ class JobStatusController extends Controller
public function index(ImportJob $importJob)
{
$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'));
}
@@ -85,7 +85,7 @@ class JobStatusController extends Controller
'count' => $count,
'tag_id' => $importJob->tag_id,
'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_text' => '',
];
@@ -93,8 +93,8 @@ class JobStatusController extends Controller
if ('file' === $importJob->provider) {
$json['download_config'] = true;
$json['download_config_text']
= trans('import.should_download_config', ['route' => route('import.job.download', [$importJob->key])]) . ' '
. trans('import.share_config_file');
= (string)trans('import.should_download_config', ['route' => route('import.job.download', [$importJob->key])]) . ' '
. (string)trans('import.share_config_file');
}
// if count is zero:
@@ -102,7 +102,7 @@ class JobStatusController extends Controller
$count = $importJob->tag->transactionJournals->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) {
$json['report_txt'] = trans(

View File

@@ -50,7 +50,7 @@ class PrerequisitesController extends Controller
$this->middleware(
function ($request, $next) {
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');
$this->repository = app(ImportJobRepositoryInterface::class);
@@ -76,12 +76,12 @@ class PrerequisitesController extends Controller
$allowed = ['new'];
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)));
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'));
}
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));
if (!class_exists($class)) {
throw new FireflyException(sprintf('No class to handle prerequisites for "%s".', $importProvider)); // @codeCoverageIgnore
@@ -132,7 +132,7 @@ class PrerequisitesController extends Controller
$allowed = ['new'];
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)));
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'));
}

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));
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;
// get the text:
$currentStep['intro'] = trans('intro.' . $route . '_' . $key);
$currentStep['intro'] = (string)trans('intro.' . $route . '_' . $key);
// save in array:
$steps[] = $currentStep;
@@ -173,7 +173,7 @@ class IntroController
$currentStep = $options;
// get the text:
$currentStep['intro'] = trans('intro.' . $route . '_' . $specificPage . '_' . $key);
$currentStep['intro'] = (string)trans('intro.' . $route . '_' . $specificPage . '_' . $key);
// save in array:
$steps[] = $currentStep;

View File

@@ -64,7 +64,7 @@ class ReconcileController extends Controller
$this->middleware(
function ($request, $next) {
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->accountRepos = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);

View File

@@ -42,7 +42,7 @@ class JsonController extends Controller
$keys = array_keys(config('firefly.rule-actions'));
$actions = [];
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();
@@ -62,7 +62,7 @@ class JsonController extends Controller
$triggers = [];
foreach ($keys as $key) {
if ('user_action' !== $key) {
$triggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice');
$triggers[$key] = (string)trans('firefly.rule_trigger_' . $key . '_choice');
}
}
asort($triggers);

View File

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

View File

@@ -60,7 +60,7 @@ class PiggyBankController extends Controller
$this->middleware(
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');
$this->piggyRepos = app(PiggyBankRepositoryInterface::class);
@@ -129,7 +129,7 @@ class PiggyBankController extends Controller
*/
public function create()
{
$subTitle = trans('firefly.new_piggy_bank');
$subTitle = (string)trans('firefly.new_piggy_bank');
$subTitleIcon = 'fa-plus';
// 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)
{
$subTitle = trans('firefly.delete_piggy_bank', ['name' => $piggyBank->name]);
$subTitle = (string)trans('firefly.delete_piggy_bank', ['name' => $piggyBank->name]);
// put previous url in session
$this->rememberPreviousUri('piggy-banks.delete.uri');
@@ -177,7 +177,7 @@ class PiggyBankController extends Controller
*/
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';
$targetDate = null;
$startDate = null;

View File

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

View File

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

View File

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

View File

@@ -48,7 +48,7 @@ class DeleteController extends Controller
$this->middleware(
function ($request, $next) {
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);
@@ -64,7 +64,7 @@ class DeleteController extends Controller
*/
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
$this->rememberPreviousUri('recurrences.delete.uri');

View File

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

View File

@@ -55,7 +55,7 @@ class IndexController extends Controller
$this->middleware(
function ($request, $next) {
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);
@@ -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'));
}
@@ -225,12 +225,12 @@ class IndexController extends Controller
$yearly = sprintf('yearly,%s', $date->format('Y-m-d'));
$yearlyDate = $date->formatLocalized(trans('config.month_and_day_no_year'));
$result = [
'daily' => ['label' => trans('firefly.recurring_daily'), 'selected' => 0 === strpos($preSelected, 'daily')],
$weekly => ['label' => 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')],
$ndom => ['label' => trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]),
'daily' => ['label' => (string)trans('firefly.recurring_daily'), 'selected' => 0 === strpos($preSelected, 'daily')],
$weekly => ['label' => (string)trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]), 'selected' => 0 === strpos($preSelected, 'weekly')],
$monthly => ['label' => (string)trans('firefly.recurring_monthly', ['dayOfMonth' => $date->day]), 'selected' => 0 === strpos($preSelected, 'monthly')],
$ndom => ['label' => (string)trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]),
'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(
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('subTitleIcon', 'fa-calendar');
$this->helper = app(ReportHelperInterface::class);
@@ -81,7 +81,7 @@ class ReportController extends Controller
public function accountReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
{
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')) {
@@ -115,7 +115,7 @@ class ReportController extends Controller
public function auditReport(Collection $accounts, Carbon $start, Carbon $end)
{
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')) {
$start = session('first');
@@ -152,7 +152,7 @@ class ReportController extends Controller
public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
{
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')) {
$start = session('first');
@@ -190,7 +190,7 @@ class ReportController extends Controller
public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
{
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')) {
$start = session('first');
@@ -227,7 +227,7 @@ class ReportController extends Controller
public function defaultReport(Collection $accounts, Carbon $start, Carbon $end)
{
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')) {
@@ -322,31 +322,31 @@ class ReportController extends Controller
if (0 === $request->getAccountList()->count()) {
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'));
}
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'));
}
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'));
}
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'));
}
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) {
@@ -386,7 +386,7 @@ class ReportController extends Controller
public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
{
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')) {
$start = session('first');

View File

@@ -69,7 +69,7 @@ class RuleController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('title', trans('firefly.rules'));
app('view')->share('title', (string)trans('firefly.rules'));
app('view')->share('mainTitleIcon', 'fa-random');
$this->accountRepos = app(AccountRepositoryInterface::class);
@@ -121,8 +121,8 @@ class RuleController extends Controller
if (null !== $bill && !$request->old()) {
// create some sensible defaults:
$preFilled['title'] = trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]);
$preFilled['description'] = trans('firefly.new_rule_for_bill_description', ['name' => $bill->name]);
$preFilled['title'] = (string)trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]);
$preFilled['description'] = (string)trans('firefly.new_rule_for_bill_description', ['name' => $bill->name]);
// get triggers and actions for bill:
@@ -133,7 +133,7 @@ class RuleController extends Controller
$triggerCount = \count($oldTriggers);
$actionCount = \count($oldActions);
$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);
@@ -161,7 +161,7 @@ class RuleController extends Controller
*/
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
$this->rememberPreviousUri('rules.delete.uri');
@@ -181,7 +181,7 @@ class RuleController extends Controller
$title = $rule->title;
$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();
return redirect($this->getPreviousUri('rules.delete.uri'));
@@ -237,7 +237,7 @@ class RuleController extends Controller
// get rule trigger for update / store-journal:
$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").
if (true !== session('rules.edit.fromUpdate')) {
@@ -357,7 +357,7 @@ class RuleController extends Controller
{
$data = $request->getRuleData();
$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();
// redirect to show bill.
@@ -400,7 +400,7 @@ class RuleController extends Controller
$triggers = $this->getValidTriggerList($request);
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');
@@ -424,10 +424,10 @@ class RuleController extends Controller
// Warn the user if only a subset of transactions is returned
$warning = '';
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()) {
$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
@@ -462,7 +462,7 @@ class RuleController extends Controller
$triggers = $rule->ruleTriggers;
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');
@@ -486,10 +486,10 @@ class RuleController extends Controller
// Warn the user if only a subset of transactions is returned
$warning = '';
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()) {
$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
@@ -530,7 +530,7 @@ class RuleController extends Controller
$data = $request->getRuleData();
$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();
$redirect = redirect($this->getPreviousUri('rules.edit.uri'));
if (1 === (int)$request->get('return_to_edit')) {
@@ -553,20 +553,20 @@ class RuleController extends Controller
$data = [
'rule_group_id' => $this->ruleRepos->getFirstRuleGroup()->id,
'stop-processing' => 0,
'title' => trans('firefly.default_rule_name'),
'description' => trans('firefly.default_rule_description'),
'title' => (string)trans('firefly.default_rule_name'),
'description' => (string)trans('firefly.default_rule_description'),
'trigger' => 'store-journal',
'strict' => true,
'rule-triggers' => [
[
'name' => 'description_is',
'value' => trans('firefly.default_rule_trigger_description'),
'value' => (string)trans('firefly.default_rule_trigger_description'),
'stop-processing' => false,
],
[
'name' => 'from_account_is',
'value' => trans('firefly.default_rule_trigger_from_account'),
'value' => (string)trans('firefly.default_rule_trigger_from_account'),
'stop-processing' => false,
],
@@ -575,12 +575,12 @@ class RuleController extends Controller
'rule-actions' => [
[
'name' => 'prepend_description',
'value' => trans('firefly.default_rule_action_prepend'),
'value' => (string)trans('firefly.default_rule_action_prepend'),
'stop-processing' => false,
],
[
'name' => 'set_category',
'value' => trans('firefly.default_rule_action_set_category'),
'value' => (string)trans('firefly.default_rule_action_set_category'),
'stop-processing' => false,
],
],
@@ -597,8 +597,8 @@ class RuleController extends Controller
{
if (0 === $this->ruleGroupRepos->count()) {
$data = [
'title' => trans('firefly.default_rule_group_name'),
'description' => trans('firefly.default_rule_group_description'),
'title' => (string)trans('firefly.default_rule_group_name'),
'description' => (string)trans('firefly.default_rule_group_description'),
];
$this->ruleGroupRepos->store($data);

View File

@@ -47,7 +47,7 @@ class RuleGroupController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('title', trans('firefly.rules'));
app('view')->share('title', (string)trans('firefly.rules'));
app('view')->share('mainTitleIcon', 'fa-random');
return $next($request);
@@ -61,7 +61,7 @@ class RuleGroupController extends Controller
public function create()
{
$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").
if (true !== session('rule-groups.create.fromStore')) {
@@ -79,7 +79,7 @@ class RuleGroupController extends Controller
*/
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
$this->rememberPreviousUri('rule-groups.delete.uri');
@@ -132,7 +132,7 @@ class RuleGroupController extends Controller
*/
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');
$preFilled = [

View File

@@ -43,7 +43,7 @@ class SearchController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-search');
app('view')->share('title', trans('firefly.search'));
app('view')->share('title', (string)trans('firefly.search'));
return $next($request);
}
@@ -63,7 +63,7 @@ class SearchController extends Controller
// parse search terms:
$searcher->parseQuery($fullQuery);
$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'));
}

View File

@@ -67,7 +67,7 @@ class TagController extends Controller
*/
public function create()
{
$subTitle = trans('firefly.new_tag');
$subTitle = (string)trans('firefly.new_tag');
$subTitleIcon = 'fa-tag';
// 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)
{
$subTitle = trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]);
$subTitle = (string)trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]);
// put previous url in session
$this->rememberPreviousUri('tags.delete.uri');
@@ -121,7 +121,7 @@ class TagController extends Controller
*/
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';
// 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.
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);
$end = new Carbon;
$path = route('tags.show', [$tag->id, 'all']);

View File

@@ -52,7 +52,7 @@ class BulkController extends Controller
$this->middleware(
function ($request, $next) {
$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');
return $next($request);
@@ -67,7 +67,7 @@ class BulkController extends Controller
*/
public function edit(Collection $journals)
{
$subTitle = trans('firefly.mass_bulk_journals');
$subTitle = (string)trans('firefly.mass_bulk_journals');
// get list of budgets:
/** @var BudgetRepositoryInterface $repository */
@@ -128,7 +128,7 @@ class BulkController extends Controller
}
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:
return redirect($this->getPreviousUri('transactions.bulk-edit.uri'));

View File

@@ -53,7 +53,7 @@ class ConvertController extends Controller
function ($request, $next) {
$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');
return $next($request);
@@ -79,13 +79,13 @@ class ConvertController extends Controller
// @codeCoverageIgnoreEnd
$positiveAmount = $this->repository->getJournalTotal($journal);
$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';
// cannot convert to its own type.
if ($sourceType->type === $destinationType->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]));
}
@@ -93,7 +93,7 @@ class ConvertController extends Controller
// cannot convert split.
if ($journal->transactions()->count() > 2) {
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]));
}
@@ -135,14 +135,14 @@ class ConvertController extends Controller
if ($journal->transactionType->type === $destinationType->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]));
}
if ($journal->transactions()->count() > 2) {
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]));
}
@@ -158,7 +158,7 @@ class ConvertController extends Controller
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]));
}

View File

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

View File

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

View File

@@ -71,7 +71,7 @@ class SingleController extends Controller
$this->attachments = app(AttachmentHelperInterface::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');
return $next($request);
@@ -145,7 +145,7 @@ class SingleController extends Controller
$what = (string)($request->old('what') ?? $what);
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets());
$preFilled = session()->has('preFilled') ? session('preFilled') : [];
$subTitle = trans('form.add_new_' . $what);
$subTitle = (string)trans('form.add_new_' . $what);
$subTitleIcon = 'fa-plus';
$optionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data;
$source = (int)$request->get('source');
@@ -192,7 +192,7 @@ class SingleController extends Controller
// @codeCoverageIgnoreEnd
$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
$this->rememberPreviousUri('transactions.delete.uri');
@@ -253,7 +253,7 @@ class SingleController extends Controller
$budgetList = ExpandedForm::makeSelectListWithEmpty($this->budgets->getBudgets());
// view related code
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
$subTitle = (string)trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
// journal related code
$sourceAccounts = $repository->getJournalSourceAccounts($journal);

View File

@@ -72,7 +72,7 @@ class SplitController extends Controller
$this->currencies = app(CurrencyRepositoryInterface::class);
$this->repository = app(JournalRepositoryInterface::class);
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);
}
@@ -93,7 +93,7 @@ class SplitController extends Controller
}
// basic fields:
$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';
// lists and collections

View File

@@ -60,7 +60,7 @@ class TransactionController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('title', trans('firefly.transactions'));
app('view')->share('title', (string)trans('firefly.transactions'));
app('view')->share('mainTitleIcon', 'fa-repeat');
$this->repository = app(JournalRepositoryInterface::class);
@@ -101,7 +101,7 @@ class TransactionController extends Controller
$startStr = $start->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);
/** @var JournalCollectorInterface $collector */
@@ -134,7 +134,7 @@ class TransactionController extends Controller
$first = $this->repository->firstNull();
$start = null === $first ? new Carbon : $first->date;
$end = new Carbon;
$subTitle = trans('firefly.all_' . $what);
$subTitle = (string)trans('firefly.all_' . $what);
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
@@ -230,7 +230,7 @@ class TransactionController extends Controller
$events = $this->repository->getPiggyBankEvents($journal);
$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'));
}

View File

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

View File

@@ -250,7 +250,7 @@ class JournalFormRequest extends Request
&& 0 !== $accountCurrency
) {
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;
}
@@ -265,7 +265,7 @@ class JournalFormRequest extends Request
&& 0 !== $selectedCurrency
&& 0 !== $accountCurrency
) {
$validator->errors()->add('native_amount', trans('validation.numeric_native'));
$validator->errors()->add('native_amount', (string)trans('validation.numeric_native'));
return;
}
@@ -285,15 +285,15 @@ class JournalFormRequest extends Request
&& 0 !== $sourceCurrency
&& 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
&& 0 !== $sourceCurrency
&& 0 !== $destinationCurrency
) {
$validator->errors()->add('destination_amount', trans('validation.numeric_destination'));
$validator->errors()->add('destination_amount', trans('validation.numeric', ['attribute' => 'destination_amount']));
$validator->errors()->add('destination_amount', (string)trans('validation.numeric_destination'));
$validator->errors()->add('destination_amount', (string)trans('validation.numeric', ['attribute' => 'destination_amount']));
}
return;

View File

@@ -155,8 +155,8 @@ class SplitJournalFormRequest extends Request
/** @var array $array */
foreach ($transactions as $array) {
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_destination_id', trans('validation.source_equals_destination'));
$validator->errors()->add('journal_source_id', (string)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 [
'rulesOptions' => [
1 => trans('firefly.yes'),
0 => trans('firefly.no'),
1 => (string)trans('firefly.yes'),
0 => (string)trans('firefly.no'),
],
];
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -260,7 +260,7 @@ class ImportArrayStorage
$repository = app(TagRepositoryInterface::class);
$repository->setUser($this->importJob->user);
$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,
'description' => null,
'latitude' => null,

View File

@@ -255,7 +255,7 @@ class CreateRecurringTransactions implements ShouldQueue
'date' => $date,
'tags' => $this->repository->getTags($recurrence),
'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:
'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) {
// default message bag that shows errors for everything.
$messages = new MessageBag;
$messages->add('source_account_revenue', trans('firefly.invalid_convert_selection'));
$messages->add('destination_account_asset', trans('firefly.invalid_convert_selection'));
$messages->add('destination_account_expense', trans('firefly.invalid_convert_selection'));
$messages->add('source_account_asset', trans('firefly.invalid_convert_selection'));
$messages->add('source_account_revenue', (string)trans('firefly.invalid_convert_selection'));
$messages->add('destination_account_asset', (string)trans('firefly.invalid_convert_selection'));
$messages->add('destination_account_expense', (string)trans('firefly.invalid_convert_selection'));
$messages->add('source_account_asset', (string)trans('firefly.invalid_convert_selection'));
return $messages;
}
@@ -78,10 +78,10 @@ class JournalRepository implements JournalRepositoryInterface
// default message bag that shows errors for everything.
$messages = new MessageBag;
$messages->add('source_account_revenue', trans('firefly.source_or_dest_invalid'));
$messages->add('destination_account_asset', trans('firefly.source_or_dest_invalid'));
$messages->add('destination_account_expense', trans('firefly.source_or_dest_invalid'));
$messages->add('source_account_asset', trans('firefly.source_or_dest_invalid'));
$messages->add('source_account_revenue', (string)trans('firefly.source_or_dest_invalid'));
$messages->add('destination_account_asset', (string)trans('firefly.source_or_dest_invalid'));
$messages->add('destination_account_expense', (string)trans('firefly.source_or_dest_invalid'));
$messages->add('source_account_asset', (string)trans('firefly.source_or_dest_invalid'));
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));
break;
case 'daily':
return trans('firefly.recurring_daily', [], $language);
return (string)trans('firefly.recurring_daily', [], $language);
break;
case 'weekly':
$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;
case 'monthly':
// 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;
case 'ndom':
$parts = explode(',', $repetition->repetition_moment);
// first part is number of week, second is weekday.
$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;
case 'yearly':
//
@@ -553,7 +553,7 @@ class RecurringRepository implements RecurringRepositoryInterface
$repDate->addYears($diffInYears); // technically not necessary.
$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;
}

View File

@@ -54,7 +54,7 @@ class BelongsUser implements Rule
*/
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
{
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()
{
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
{
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
{
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()
{
return trans('validation.invalid_selection');
return (string)trans('validation.invalid_selection');
}
/**

View File

@@ -186,7 +186,7 @@ class Transaction extends SpectreObject
switch ($key) {
case 'account_number':
$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;
case 'payee':
$data['name'] = $value;

View File

@@ -118,7 +118,7 @@ class Amount
*/
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);
setlocale(LC_MONETARY, $locale);
$float = round($amount, 12);

View File

@@ -74,22 +74,22 @@ class SimpleJournalList implements BinderInterface
$sources = $repository->getJournalSourceAccounts($journal);
$destinations = $repository->getJournalDestinationAccounts($journal);
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;
}
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;
}
if (TransactionType::OPENING_BALANCE === $repository->getTransactionType($journal)) {
$messages[] = trans('firefly.cannot_edit_opening_balance');
$messages[] = (string)trans('firefly.cannot_edit_opening_balance');
continue;
}
// cannot edit reconciled transactions / journals:
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;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -100,7 +100,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
$config['apply-rules'] = $applyRules;
$this->repository->setConfiguration($this->importJob, $config);
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;

View File

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

View File

@@ -261,7 +261,7 @@ class Transaction extends Twig_Extension
}
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;
}
@@ -310,19 +310,19 @@ class Transaction extends Twig_Extension
{
switch ($transaction->transaction_type_type) {
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;
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;
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;
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;
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;
default:
$txt = '';
@@ -412,7 +412,7 @@ class Transaction extends Twig_Extension
}
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;
}

View File

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

View File

@@ -51,7 +51,7 @@ trait RecurrenceValidation
foreach ($repetitions as $index => $repetition) {
switch ($repetition['type']) {
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;
case 'daily':
@@ -84,7 +84,7 @@ trait RecurrenceValidation
$repetitions = $data['repetitions'] ?? [];
// need at least one transaction
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;
if (null !== $repetitions && null !== $repeatUntil) {
// expect a date OR count:
$validator->errors()->add('repeat_until', trans('validation.require_repeat_until'));
$validator->errors()->add('nr_of_repetitions', trans('validation.require_repeat_until'));
$validator->errors()->add('repeat_until', (string)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
{
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
{
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);
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;
}
$nthDay = (int)($parameters[0] ?? 0.0);
$dayOfWeek = (int)($parameters[1] ?? 0.0);
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;
}
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
{
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 {
Carbon::createFromFormat('Y-m-d', $moment);
} 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);
break;
default:
$validator->errors()->add($idField, trans('validation.invalid_account_info'));
$validator->errors()->add($idField, (string)trans('validation.invalid_account_info'));
return;
}
// add some errors in case of same account submitted:
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.
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']))) {
$validator->errors()->add(
'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 cannot be equal to journal description.
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'] ?? [];
// need at least one transaction
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']) {
case 'withdrawal':
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;
case 'deposit':
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;
case 'transfer':
if (\count($sources) > 1 || \count($destinations) > 1) {
$validator->errors()->add('transactions.0.source_id', trans('validation.all_accounts_equal'));
$validator->errors()->add('transactions.0.destination_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', (string)trans('validation.all_accounts_equal'));
}
break;
}
@@ -256,7 +256,7 @@ trait TransactionValidation
if ('' === $description && \count($transactions) > 1) {
$validator->errors()->add(
'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;
// both empty? hard exit.
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;
}
@@ -297,7 +297,7 @@ trait TransactionValidation
/** @var Account $first */
$first = $set->first();
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;
}
@@ -308,7 +308,7 @@ trait TransactionValidation
$account = $repository->findByName($accountName, [AccountType::ASSET]);
if (null === $account) {
$validator->errors()->add($nameField, trans('validation.belongs_user'));
$validator->errors()->add($nameField, (string)trans('validation.belongs_user'));
return null;
}
@@ -350,7 +350,7 @@ trait TransactionValidation
/** @var Account $first */
$first = $set->first();
if ($first->accountType->type !== $type) {
$validator->errors()->add($idField, trans('validation.belongs_user'));
$validator->errors()->add($idField, (string)trans('validation.belongs_user'));
return null;
}