mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-11 23:28:54 +00:00
Auto commit for release 'branch-v6.2' on 2024-12-22
This commit is contained in:
@@ -37,7 +37,6 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use FireflyIII\Support\Search\OperatorQuerySearch;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Trait RenderPartialViews
|
||||
@@ -52,24 +51,24 @@ trait RenderPartialViews
|
||||
protected function budgetEntry(array $attributes): string // generate view for report.
|
||||
{
|
||||
/** @var PopupReportInterface $popupHelper */
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
|
||||
/** @var BudgetRepositoryInterface $budgetRepository */
|
||||
$budgetRepository = app(BudgetRepositoryInterface::class);
|
||||
$budget = $budgetRepository->find((int) $attributes['budgetId']);
|
||||
|
||||
$accountRepos = app(AccountRepositoryInterface::class);
|
||||
$account = $accountRepos->find((int) $attributes['accountId']);
|
||||
$accountRepos = app(AccountRepositoryInterface::class);
|
||||
$account = $accountRepos->find((int) $attributes['accountId']);
|
||||
|
||||
if (null === $budget || null === $account) {
|
||||
throw new FireflyException('Could not render popup.report.balance-amount because budget or account is null.');
|
||||
}
|
||||
|
||||
$journals = $popupHelper->balanceForBudget($budget, $account, $attributes);
|
||||
$journals = $popupHelper->balanceForBudget($budget, $account, $attributes);
|
||||
|
||||
try {
|
||||
$view = view('popup.report.balance-amount', compact('journals', 'budget', 'account'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
|
||||
$view = 'Firefly III could not render the view. Please see the log files.';
|
||||
|
||||
@@ -92,7 +91,7 @@ trait RenderPartialViews
|
||||
|
||||
try {
|
||||
$result = view('reports.options.budget', compact('budgets'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
|
||||
@@ -113,18 +112,18 @@ trait RenderPartialViews
|
||||
$budgetRepository = app(BudgetRepositoryInterface::class);
|
||||
|
||||
/** @var PopupReportInterface $popupHelper */
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
|
||||
$budget = $budgetRepository->find((int) $attributes['budgetId']);
|
||||
$budget = $budgetRepository->find((int) $attributes['budgetId']);
|
||||
if (null === $budget) {
|
||||
// transactions without a budget.
|
||||
$budget = new Budget();
|
||||
}
|
||||
$journals = $popupHelper->byBudget($budget, $attributes);
|
||||
$journals = $popupHelper->byBudget($budget, $attributes);
|
||||
|
||||
try {
|
||||
$view = view('popup.report.budget-spent-amount', compact('journals', 'budget'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
|
||||
$view = 'Firefly III could not render the view. Please see the log files.';
|
||||
|
||||
@@ -142,7 +141,7 @@ trait RenderPartialViews
|
||||
protected function categoryEntry(array $attributes): string // generate view for report.
|
||||
{
|
||||
/** @var PopupReportInterface $popupHelper */
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
|
||||
/** @var CategoryRepositoryInterface $categoryRepository */
|
||||
$categoryRepository = app(CategoryRepositoryInterface::class);
|
||||
@@ -151,7 +150,7 @@ trait RenderPartialViews
|
||||
|
||||
try {
|
||||
$view = view('popup.report.category-entry', compact('journals', 'category'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
|
||||
$view = 'Firefly III could not render the view. Please see the log files.';
|
||||
|
||||
@@ -174,7 +173,7 @@ trait RenderPartialViews
|
||||
|
||||
try {
|
||||
$result = view('reports.options.category', compact('categories'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render reports.options.category: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
|
||||
@@ -216,7 +215,7 @@ trait RenderPartialViews
|
||||
|
||||
try {
|
||||
$result = view('reports.options.double', compact('set'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
|
||||
@@ -237,19 +236,19 @@ trait RenderPartialViews
|
||||
$accountRepository = app(AccountRepositoryInterface::class);
|
||||
|
||||
/** @var PopupReportInterface $popupHelper */
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
|
||||
$account = $accountRepository->find((int) $attributes['accountId']);
|
||||
$account = $accountRepository->find((int) $attributes['accountId']);
|
||||
|
||||
if (null === $account) {
|
||||
return 'This is an unknown account. Apologies.';
|
||||
}
|
||||
|
||||
$journals = $popupHelper->byExpenses($account, $attributes);
|
||||
$journals = $popupHelper->byExpenses($account, $attributes);
|
||||
|
||||
try {
|
||||
$view = view('popup.report.expense-entry', compact('journals', 'account'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
|
||||
$view = 'Firefly III could not render the view. Please see the log files.';
|
||||
|
||||
@@ -266,8 +265,8 @@ trait RenderPartialViews
|
||||
*/
|
||||
protected function getCurrentActions(Rule $rule): array // get info from object and present.
|
||||
{
|
||||
$index = 0;
|
||||
$actions = [];
|
||||
$index = 0;
|
||||
$actions = [];
|
||||
// must be repos
|
||||
$currentActions = $rule->ruleActions()->orderBy('order', 'ASC')->get();
|
||||
|
||||
@@ -285,7 +284,7 @@ trait RenderPartialViews
|
||||
'count' => $count,
|
||||
]
|
||||
)->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
|
||||
@@ -306,8 +305,8 @@ trait RenderPartialViews
|
||||
protected function getCurrentTriggers(Rule $rule): array // get info from object and present.
|
||||
{
|
||||
// TODO duplicated code.
|
||||
$operators = config('search.operators');
|
||||
$triggers = [];
|
||||
$operators = config('search.operators');
|
||||
$triggers = [];
|
||||
foreach ($operators as $key => $operator) {
|
||||
if ('user_action' !== $key && false === $operator['alias']) {
|
||||
$triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));
|
||||
@@ -325,7 +324,7 @@ trait RenderPartialViews
|
||||
$count = ($index + 1);
|
||||
|
||||
try {
|
||||
$rootOperator = OperatorQuerySearch::getRootOperator((string) $entry->trigger_type);
|
||||
$rootOperator = OperatorQuerySearch::getRootOperator((string) $entry->trigger_type);
|
||||
if (str_starts_with($rootOperator, '-')) {
|
||||
$rootOperator = substr($rootOperator, 1);
|
||||
}
|
||||
@@ -340,7 +339,7 @@ trait RenderPartialViews
|
||||
'triggers' => $triggers,
|
||||
]
|
||||
)->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
|
||||
@@ -365,18 +364,18 @@ trait RenderPartialViews
|
||||
$accountRepository = app(AccountRepositoryInterface::class);
|
||||
|
||||
/** @var PopupReportInterface $popupHelper */
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
$account = $accountRepository->find((int) $attributes['accountId']);
|
||||
$popupHelper = app(PopupReportInterface::class);
|
||||
$account = $accountRepository->find((int) $attributes['accountId']);
|
||||
|
||||
if (null === $account) {
|
||||
return 'This is an unknown category. Apologies.';
|
||||
}
|
||||
|
||||
$journals = $popupHelper->byIncome($account, $attributes);
|
||||
$journals = $popupHelper->byIncome($account, $attributes);
|
||||
|
||||
try {
|
||||
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Could not render: %s', $e->getMessage()));
|
||||
$view = 'Firefly III could not render the view. Please see the log files.';
|
||||
|
||||
@@ -395,7 +394,7 @@ trait RenderPartialViews
|
||||
{
|
||||
try {
|
||||
$result = view('reports.options.no-options')->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render reports.options.no-options: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
|
||||
@@ -418,7 +417,7 @@ trait RenderPartialViews
|
||||
|
||||
try {
|
||||
$result = view('reports.options.tag', compact('tags'))->render();
|
||||
} catch (Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
|
||||
$result = 'Could not render view.';
|
||||
|
||||
|
Reference in New Issue
Block a user