Various code fixes.

This commit is contained in:
James Cole
2022-10-31 05:53:36 +01:00
parent 0059ed7bde
commit 249b0c3377
88 changed files with 180 additions and 180 deletions

View File

@@ -71,7 +71,7 @@ class Date implements BinderInterface
try {
$result = new Carbon($value);
} catch (Exception $e) {
} catch (Exception $e) {
Log::error(sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage()));
throw new NotFoundHttpException();
}

View File

@@ -63,7 +63,7 @@ class ExpandedForm
//}
try {
$html = view('form.amount-no-currency', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Could not render amountNoCurrency(): %s', $e->getMessage()));
$html = 'Could not render amountNoCurrency.';
}
@@ -98,7 +98,7 @@ class ExpandedForm
unset($options['placeholder'], $options['autocomplete'], $options['class']);
try {
$html = view('form.checkbox', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render checkbox(): %s', $e->getMessage()));
$html = 'Could not render checkbox.';
}
@@ -122,7 +122,7 @@ class ExpandedForm
unset($options['placeholder']);
try {
$html = view('form.date', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render date(): %s', $e->getMessage()));
$html = 'Could not render date.';
}
@@ -144,7 +144,7 @@ class ExpandedForm
$classes = $this->getHolderClasses($name);
try {
$html = view('form.file', compact('classes', 'name', 'label', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render file(): %s', $e->getMessage()));
$html = 'Could not render file.';
}
@@ -169,7 +169,7 @@ class ExpandedForm
$options['step'] = '1';
try {
$html = view('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render integer(): %s', $e->getMessage()));
$html = 'Could not render integer.';
}
@@ -193,7 +193,7 @@ class ExpandedForm
$value = $this->fillFieldValue($name, $value);
try {
$html = view('form.location', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render location(): %s', $e->getMessage()));
$html = 'Could not render location.';
}
@@ -214,12 +214,12 @@ class ExpandedForm
$fields = ['title', 'name', 'description'];
/** @var Eloquent $entry */
foreach ($set as $entry) {
$entryId = (int) $entry->id;
$entryId = (int) $entry->id;
$current = $entry->toArray();
$title = null;
foreach ($fields as $field) {
if (array_key_exists($field, $current) && null === $title) {
$title = $current[$field];
$title = $current[$field];
}
}
$selectList[$entryId] = $title;
@@ -251,7 +251,7 @@ class ExpandedForm
}
try {
$html = view('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render nonSelectableAmount(): %s', $e->getMessage()));
$html = 'Could not render nonSelectableAmount.';
}
@@ -276,7 +276,7 @@ class ExpandedForm
unset($options['placeholder']);
try {
$html = view('form.number', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render number(): %s', $e->getMessage()));
$html = 'Could not render number.';
}
@@ -305,7 +305,7 @@ class ExpandedForm
try {
$html = view('form.object_group', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render objectGroup(): %s', $e->getMessage()));
$html = 'Could not render objectGroup.';
}
@@ -324,7 +324,7 @@ class ExpandedForm
{
try {
$html = view('form.options', compact('type', 'name'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render select(): %s', $e->getMessage()));
$html = 'Could not render optionsList.';
}
@@ -345,7 +345,7 @@ class ExpandedForm
$classes = $this->getHolderClasses($name);
try {
$html = view('form.password', compact('classes', 'name', 'label', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render password(): %s', $e->getMessage()));
$html = 'Could not render password.';
}
@@ -372,7 +372,7 @@ class ExpandedForm
unset($options['placeholder']);
try {
$html = view('form.percentage', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render percentage(): %s', $e->getMessage()));
$html = 'Could not render percentage.';
}
@@ -394,7 +394,7 @@ class ExpandedForm
$classes = $this->getHolderClasses($name);
try {
$html = view('form.static', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render staticText(): %s', $e->getMessage()));
$html = 'Could not render staticText.';
}
@@ -417,7 +417,7 @@ class ExpandedForm
$value = $this->fillFieldValue($name, $value);
try {
$html = view('form.text', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render text(): %s', $e->getMessage()));
$html = 'Could not render text.';
}
@@ -446,7 +446,7 @@ class ExpandedForm
try {
$html = view('form.textarea', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render textarea(): %s', $e->getMessage()));
$html = 'Could not render textarea.';
}

View File

@@ -46,7 +46,7 @@ class FireflyConfig
}
try {
Configuration::where('name', $name)->forceDelete();
} catch (Exception $e) {
} catch (Exception $e) {
// @ignoreException
}
}
@@ -68,7 +68,7 @@ class FireflyConfig
try {
/** @var Configuration|null $config */
$config = Configuration::where('name', $name)->first(['id', 'name', 'data']);
} catch (QueryException|Exception $e) {
} catch (QueryException|Exception $e) {
throw new FireflyException(sprintf('Could not poll the database: %s', $e->getMessage()));
}
@@ -95,7 +95,7 @@ class FireflyConfig
{
try {
$config = Configuration::whereName($name)->whereNull('deleted_at')->first();
} catch (QueryException|Exception $e) {
} catch (QueryException|Exception $e) {
$item = new Configuration();
$item->name = $name;
$item->data = $value;

View File

@@ -137,7 +137,7 @@ class AccountForm
unset($options['class']);
try {
$html = view('form.assetAccountCheckList', compact('classes', 'selected', 'name', 'label', 'options', 'grouped'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render assetAccountCheckList(): %s', $e->getMessage()));
$html = 'Could not render assetAccountCheckList.';
}

View File

@@ -96,7 +96,7 @@ class CurrencyForm
}
try {
$html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
$html = 'Could not render currencyField.';
}
@@ -165,7 +165,7 @@ class CurrencyForm
}
try {
$html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
$html = 'Could not render currencyField.';
}

View File

@@ -54,7 +54,7 @@ trait FormSupport
unset($options['autocomplete'], $options['placeholder']);
try {
$html = view('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Could not render select(): %s', $e->getMessage()));
$html = 'Could not render select.';
}
@@ -134,7 +134,7 @@ trait FormSupport
if (null !== request()->old($name)) {
$value = request()->old($name);
}
} catch (RuntimeException $e) {
} catch (RuntimeException $e) {
// don't care about session errors.
Log::debug(sprintf('Run time: %s', $e->getMessage()));
}
@@ -163,7 +163,7 @@ trait FormSupport
$date = null;
try {
$date = today(config('app.timezone'));
} catch (Exception $e) {
} catch (Exception $e) {
// @ignoreException
}

View File

@@ -57,7 +57,7 @@ trait ModelInformation
'count' => 1,
]
)->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Throwable was thrown in getActionsForBill(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
$result = 'Could not render view. See log files.';
@@ -144,7 +144,7 @@ trait ModelInformation
'triggers' => $triggers,
]
)->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
Log::debug($e->getTraceAsString());
$string = '';
@@ -258,7 +258,7 @@ trait ModelInformation
'triggers' => $triggers,
]
)->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
Log::debug($e->getTraceAsString());
$string = '';

View File

@@ -67,7 +67,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.balance-amount', compact('journals', 'budget', 'account'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
}
@@ -119,7 +119,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.budget-spent-amount', compact('journals', 'budget'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
}
@@ -146,7 +146,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.category-entry', compact('journals', 'category'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
}
@@ -167,7 +167,7 @@ trait RenderPartialViews
try {
$result = view('reports.options.category', compact('categories'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.category: %s', $e->getMessage()));
$result = 'Could not render view.';
}
@@ -208,7 +208,7 @@ trait RenderPartialViews
try {
$result = view('reports.options.double', compact('set'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
}
@@ -241,7 +241,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.expense-entry', compact('journals', 'account'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
}
@@ -275,7 +275,7 @@ trait RenderPartialViews
'count' => $count,
]
)->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
}
@@ -329,7 +329,7 @@ trait RenderPartialViews
'triggers' => $triggers,
]
)->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
}
@@ -365,7 +365,7 @@ trait RenderPartialViews
try {
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
}
@@ -382,7 +382,7 @@ trait RenderPartialViews
{
try {
$result = view('reports.options.no-options')->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.no-options: %s', $e->getMessage()));
$result = 'Could not render view.';
}
@@ -404,7 +404,7 @@ trait RenderPartialViews
try {
$result = view('reports.options.tag', compact('tags'))->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
}

View File

@@ -58,7 +58,7 @@ trait RuleManagement
'count' => $index + 1,
]
)->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getPreviousActions(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
}
@@ -104,7 +104,7 @@ trait RuleManagement
'triggers' => $triggers,
]
)->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
}
@@ -146,7 +146,7 @@ trait RuleManagement
'triggers' => $triggers,
]
)->render();
} catch (Throwable $e) {
} catch (Throwable $e) {
Log::debug(sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage()));
Log::error($e->getTraceAsString());
}

View File

@@ -189,7 +189,7 @@ class OperatorQuerySearch implements SearchInterface
throw new FireflyException(sprintf('Firefly III search cant handle "%s"-nodes', $class));
case Subquery::class:
// loop all notes in subquery:
foreach ($searchNode->getNodes() as $subNode) {
foreach ($searchNode->getNodes() as $subNode) {
$this->handleSearchNode($subNode); // let's hope it's not too recursive
}
break;

View File

@@ -160,7 +160,7 @@ class Steam
->orderBy('transaction_journals.date', 'ASC')
->whereNull('transaction_journals.deleted_at')
->get(
[
[
'transaction_journals.date',
'transactions.transaction_currency_id',
DB::raw('SUM(transactions.amount) AS modified'),
@@ -331,7 +331,7 @@ class Steam
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
->groupBy('transactions.transaction_currency_id');
$balances = $query->get(['transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) as sum_for_currency')]);
$balances = $query->get(['transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) as sum_for_currency')]);
$return = [];
/** @var stdClass $entry */
foreach ($balances as $entry) {
@@ -416,7 +416,7 @@ class Steam
$set = auth()->user()->transactions()
->whereIn('transactions.account_id', $accounts)
->groupBy(['transactions.account_id', 'transaction_journals.user_id'])
->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]);
->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]);
foreach ($set as $entry) {
$date = new Carbon($entry->max_date, config('app.timezone'));