mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #3314
This commit is contained in:
parent
c3c9a2f3c0
commit
9d9053d828
@ -56,7 +56,7 @@ class BulkController extends Controller
|
|||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
$this->repository = app(JournalRepositoryInterface::class);
|
$this->repository = app(JournalRepositoryInterface::class);
|
||||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class CreateController extends Controller
|
|||||||
$this->middleware(
|
$this->middleware(
|
||||||
static function ($request, $next) {
|
static function ($request, $next) {
|
||||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class DeleteController extends Controller
|
|||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||||
|
|
||||||
$this->repository = app(TransactionGroupRepositoryInterface::class);
|
$this->repository = app(TransactionGroupRepositoryInterface::class);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class EditController extends Controller
|
|||||||
static function ($request, $next) {
|
static function ($request, $next) {
|
||||||
|
|
||||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ class IndexController extends Controller
|
|||||||
// translations:
|
// translations:
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('mainTitleIcon', 'fa-credit-card');
|
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||||
app('view')->share('title', (string) trans('firefly.accounts'));
|
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||||
|
|
||||||
$this->repository = app(JournalRepositoryInterface::class);
|
$this->repository = app(JournalRepositoryInterface::class);
|
||||||
|
|
||||||
@ -88,7 +88,9 @@ class IndexController extends Controller
|
|||||||
$end = session('end');
|
$end = session('end');
|
||||||
}
|
}
|
||||||
if (null === $end) {
|
if (null === $end) {
|
||||||
$end = session('end'); // @codeCoverageIgnore
|
// get last transaction ever?
|
||||||
|
$last = $this->repository->getLast();
|
||||||
|
$end = $last ? $last->date : session('end');
|
||||||
}
|
}
|
||||||
|
|
||||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||||
@ -134,14 +136,15 @@ class IndexController extends Controller
|
|||||||
$repository = app(JournalRepositoryInterface::class);
|
$repository = app(JournalRepositoryInterface::class);
|
||||||
|
|
||||||
|
|
||||||
$subTitleIcon = config('firefly.transactionIconsByWhat.' . $objectType);
|
$subTitleIcon = config('firefly.transactionIconsByType.' . $objectType);
|
||||||
$types = config('firefly.transactionTypesByWhat.' . $objectType);
|
$types = config('firefly.transactionTypesByType.' . $objectType);
|
||||||
$page = (int) $request->get('page');
|
$page = (int) $request->get('page');
|
||||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||||
$path = route('transactions.index.all', [$objectType]);
|
$path = route('transactions.index.all', [$objectType]);
|
||||||
$first = $repository->firstNull();
|
$first = $repository->firstNull();
|
||||||
$start = null === $first ? new Carbon : $first->date;
|
$start = null === $first ? new Carbon : $first->date;
|
||||||
$end = new Carbon;
|
$last = $this->repository->getLast();
|
||||||
|
$end = $last ? $last->date : new Carbon;
|
||||||
$subTitle = (string) trans('firefly.all_' . $objectType);
|
$subTitle = (string) trans('firefly.all_' . $objectType);
|
||||||
|
|
||||||
/** @var GroupCollectorInterface $collector */
|
/** @var GroupCollectorInterface $collector */
|
||||||
|
@ -57,7 +57,7 @@ class LinkController extends Controller
|
|||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||||
|
|
||||||
$this->journalRepository = app(JournalRepositoryInterface::class);
|
$this->journalRepository = app(JournalRepositoryInterface::class);
|
||||||
$this->repository = app(LinkTypeRepositoryInterface::class);
|
$this->repository = app(LinkTypeRepositoryInterface::class);
|
||||||
|
@ -62,7 +62,7 @@ class MassController extends Controller
|
|||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||||
$this->repository = app(JournalRepositoryInterface::class);
|
$this->repository = app(JournalRepositoryInterface::class);
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
@ -407,4 +407,19 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
|
|
||||||
return $transaction->account;
|
return $transaction->account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return TransactionJournal|null
|
||||||
|
*/
|
||||||
|
public function getLast(): ?TransactionJournal
|
||||||
|
{
|
||||||
|
/** @var TransactionJournal $entry */
|
||||||
|
$entry = $this->user->transactionJournals()->orderBy('date', 'DESC')->first(['transaction_journals.*']);
|
||||||
|
$result = null;
|
||||||
|
if (null !== $entry) {
|
||||||
|
$result = $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,10 @@ use Illuminate\Support\Collection;
|
|||||||
*/
|
*/
|
||||||
interface JournalRepositoryInterface
|
interface JournalRepositoryInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return TransactionJournal|null
|
||||||
|
*/
|
||||||
|
public function getLast(): ?TransactionJournal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO maybe create JSON repository?
|
* TODO maybe create JSON repository?
|
||||||
@ -44,6 +48,7 @@ interface JournalRepositoryInterface
|
|||||||
* Search in journal descriptions.
|
* Search in journal descriptions.
|
||||||
*
|
*
|
||||||
* @param string $search
|
* @param string $search
|
||||||
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function searchJournalDescriptions(string $search): Collection;
|
public function searchJournalDescriptions(string $search): Collection;
|
||||||
|
@ -383,7 +383,7 @@ return [
|
|||||||
'Opening balance' => 'opening-balance',
|
'Opening balance' => 'opening-balance',
|
||||||
'Reconciliation' => 'reconciliation',
|
'Reconciliation' => 'reconciliation',
|
||||||
],
|
],
|
||||||
'transactionIconsByWhat' => [
|
'transactionIconsByType' => [
|
||||||
'expenses' => 'fa-long-arrow-left',
|
'expenses' => 'fa-long-arrow-left',
|
||||||
'withdrawal' => 'fa-long-arrow-left',
|
'withdrawal' => 'fa-long-arrow-left',
|
||||||
'revenue' => 'fa-long-arrow-right',
|
'revenue' => 'fa-long-arrow-right',
|
||||||
|
Loading…
Reference in New Issue
Block a user