mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-16 14:48:11 +00:00
Code cleanup for #595
This commit is contained in:
@@ -307,8 +307,7 @@ class AccountController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// fix title:
|
||||
if ((strlen($moment) > 0 && $moment !== 'all') || strlen($moment) === 0) {
|
||||
if ($moment != 'all' && $loop > 1) {
|
||||
$subTitle = trans(
|
||||
'firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
|
||||
'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||
@@ -478,7 +477,7 @@ class AccountController extends Controller
|
||||
$opposingTransaction = $journal->transactions()->where('transactions.id', '!=', $transaction->id)->first();
|
||||
|
||||
if (is_null($opposingTransaction)) {
|
||||
throw new FireflyException('Expected an opposing transaction. This account has none. BEEP, error.');
|
||||
throw new FireflyException('Expected an opposing transaction. This account has none. BEEP, error.'); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
return redirect(route('accounts.show', [$opposingTransaction->account_id]));
|
||||
|
||||
@@ -176,10 +176,11 @@ class AttachmentController extends Controller
|
||||
Preferences::mark();
|
||||
|
||||
if (intval($request->get('return_to_edit')) === 1) {
|
||||
// set value so edit routine will not overwrite URL:
|
||||
// @codeCoverageIgnoreStart
|
||||
$request->session()->put('attachments.edit.fromUpdate', true);
|
||||
|
||||
return redirect(route('attachments.edit', [$attachment->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
|
||||
@@ -240,10 +240,11 @@ class BillController extends Controller
|
||||
Preferences::mark();
|
||||
|
||||
if (intval($request->get('create_another')) === 1) {
|
||||
// set value so create routine will not overwrite URL:
|
||||
// @codeCoverageIgnoreStart
|
||||
$request->session()->put('bills.create.fromStore', true);
|
||||
|
||||
return redirect(route('bills.create'))->withInput();
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
@@ -267,10 +268,11 @@ class BillController extends Controller
|
||||
Preferences::mark();
|
||||
|
||||
if (intval($request->get('return_to_edit')) === 1) {
|
||||
// set value so edit routine will not overwrite URL:
|
||||
// @codeCoverageIgnoreStart
|
||||
$request->session()->put('bills.edit.fromUpdate', true);
|
||||
|
||||
return redirect(route('bills.edit', [$bill->id]))->withInput(['return_to_edit' => 1]);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
return redirect($this->getPreviousUri('bills.edit.uri'));
|
||||
|
||||
@@ -259,8 +259,7 @@ class BudgetController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// fix title:
|
||||
if (((strlen($moment) > 0 && $moment !== 'all') || strlen($moment) === 0) && $count > 0) {
|
||||
if ($moment != 'all' && $loop > 1) {
|
||||
$subTitle = trans(
|
||||
'firefly.without_budget_between',
|
||||
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||
|
||||
@@ -219,8 +219,7 @@ class CategoryController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// fix title:
|
||||
if (((strlen($moment) > 0 && $moment !== 'all') || strlen($moment) === 0) && $count > 0) {
|
||||
if ($moment != 'all' && $loop > 1) {
|
||||
$subTitle = trans(
|
||||
'firefly.without_category_between',
|
||||
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||
@@ -302,8 +301,7 @@ class CategoryController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// fix title:
|
||||
if (((strlen($moment) > 0 && $moment !== 'all') || strlen($moment) === 0) && $count > 0) {
|
||||
if ($moment != 'all' && $loop > 1) {
|
||||
$subTitle = trans(
|
||||
'firefly.journals_in_period_for_category',
|
||||
['name' => $category->name,'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||
@@ -313,66 +311,6 @@ class CategoryController extends Controller
|
||||
return view('categories.show', compact('category', 'moment', 'journals', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @param Request $request
|
||||
// * @param CategoryRepositoryInterface $repository
|
||||
// * @param Category $category
|
||||
// *
|
||||
// * @return View
|
||||
// */
|
||||
// public function showAll(Request $request, CategoryRepositoryInterface $repository, Category $category)
|
||||
// {
|
||||
// $range = Preferences::get('viewRange', '1M')->data;
|
||||
// $start = $repository->firstUseDate($category);
|
||||
// if ($start->year == 1900) {
|
||||
// $start = new Carbon;
|
||||
// }
|
||||
// $end = Navigation::endOfPeriod(new Carbon, $range);
|
||||
// $subTitle = $category->name;
|
||||
// $subTitleIcon = 'fa-bar-chart';
|
||||
// $hideCategory = true; // used in list.
|
||||
// $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||
// $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||
// $method = 'all';
|
||||
//
|
||||
// /** @var JournalCollectorInterface $collector */
|
||||
// $collector = app(JournalCollectorInterface::class);
|
||||
// $collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setCategory($category)->withBudgetInformation();
|
||||
// $journals = $collector->getPaginatedJournals();
|
||||
// $journals->setPath('categories/show/' . $category->id . '/all');
|
||||
//
|
||||
// return view('categories.show', compact('category', 'method', 'journals', 'hideCategory', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param Request $request
|
||||
// * @param Category $category
|
||||
// * @param string $date
|
||||
// *
|
||||
// * @return View
|
||||
// */
|
||||
// public function showByDate(Request $request, Category $category, string $date)
|
||||
// {
|
||||
// $carbon = new Carbon($date);
|
||||
// $range = Preferences::get('viewRange', '1M')->data;
|
||||
// $start = Navigation::startOfPeriod($carbon, $range);
|
||||
// $end = Navigation::endOfPeriod($carbon, $range);
|
||||
// $subTitle = $category->name;
|
||||
// $subTitleIcon = 'fa-bar-chart';
|
||||
// $hideCategory = true; // used in list.
|
||||
// $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||
// $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||
// $entries = $this->getGroupedEntries($category);
|
||||
// $method = 'date';
|
||||
//
|
||||
// /** @var JournalCollectorInterface $collector */
|
||||
// $collector = app(JournalCollectorInterface::class);
|
||||
// $collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category)->withBudgetInformation();
|
||||
// $journals = $collector->getPaginatedJournals();
|
||||
// $journals->setPath('categories/show/' . $category->id . '/' . $date);
|
||||
//
|
||||
// return view('categories.show', compact('category', 'method', 'entries', 'journals', 'hideCategory', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param CategoryFormRequest $request
|
||||
|
||||
@@ -221,9 +221,10 @@ class TagController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param JournalCollectorInterface $collector
|
||||
* @param Tag $tag
|
||||
* @param Request $request
|
||||
* @param TagRepositoryInterface $repository
|
||||
* @param Tag $tag
|
||||
* @param string $moment
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
@@ -290,9 +291,8 @@ class TagController extends Controller
|
||||
Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
}
|
||||
}
|
||||
|
||||
// fix title:
|
||||
if (((strlen($moment) > 0 && $moment !== 'all') || strlen($moment) === 0) && $count > 0) {
|
||||
|
||||
if ($moment != 'all' && $loop > 1) {
|
||||
$subTitle = trans(
|
||||
'firefly.journals_in_period_for_tag',
|
||||
['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||
@@ -303,68 +303,6 @@ class TagController extends Controller
|
||||
return view('tags.show', compact('tag', 'periods', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end', 'moment'));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @param Request $request
|
||||
// * @param JournalCollectorInterface $collector
|
||||
// * @param Tag $tag
|
||||
// *
|
||||
// * @return View
|
||||
// */
|
||||
// public function showAll(Request $request, JournalCollectorInterface $collector, Tag $tag)
|
||||
// {
|
||||
// $subTitle = $tag->tag;
|
||||
// $subTitleIcon = 'fa-tag';
|
||||
// $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||
// $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||
// $collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page)->setTag($tag)
|
||||
// ->withOpposingAccount()->disableInternalFilter()
|
||||
// ->withBudgetInformation()->withCategoryInformation();
|
||||
// $journals = $collector->getPaginatedJournals();
|
||||
// $journals->setPath('tags/show/' . $tag->id . '/all');
|
||||
//
|
||||
// $sum = $journals->sum(
|
||||
// function (Transaction $transaction) {
|
||||
// return $transaction->transaction_amount;
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// return view('tags.show', compact('tag', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end'));
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public function showByDate(Request $request, JournalCollectorInterface $collector, Tag $tag, string $date)
|
||||
// {
|
||||
// $range = Preferences::get('viewRange', '1M')->data;
|
||||
//
|
||||
// try {
|
||||
// $start = new Carbon($date);
|
||||
// $end = Navigation::endOfPeriod($start, $range);
|
||||
// } catch (Exception $e) {
|
||||
// $start = Navigation::startOfPeriod($this->repository->firstUseDate($tag), $range);
|
||||
// $end = Navigation::startOfPeriod($this->repository->lastUseDate($tag), $range);
|
||||
// }
|
||||
//
|
||||
// $subTitle = $tag->tag;
|
||||
// $subTitleIcon = 'fa-tag';
|
||||
// $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||
// $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
|
||||
// $periods = $this->getPeriodOverview($tag);
|
||||
//
|
||||
// // use collector:
|
||||
// $collector->setAllAssetAccounts()
|
||||
// ->setLimit($pageSize)->setPage($page)->setTag($tag)->withOpposingAccount()->disableInternalFilter()
|
||||
// ->withBudgetInformation()->withCategoryInformation()->setRange($start, $end);
|
||||
// $journals = $collector->getPaginatedJournals();
|
||||
// $journals->setPath('tags/show/' . $tag->id);
|
||||
//
|
||||
// $sum = $journals->sum(
|
||||
// function (Transaction $transaction) {
|
||||
// return $transaction->transaction_amount;
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// return view('tags.show', compact('tag', 'periods', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end'));
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param TagFormRequest $request
|
||||
|
||||
@@ -125,8 +125,7 @@ class TransactionController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// fix title:
|
||||
if (((strlen($moment) > 0 && $moment !== 'all') || strlen($moment) === 0) && $count > 0) {
|
||||
if ($moment != 'all' && $loop > 1) {
|
||||
$subTitle = trans(
|
||||
'firefly.title_' . $what . '_between',
|
||||
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
|
||||
|
||||
Reference in New Issue
Block a user