mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix small issues in the category overview and the journal collector.
This commit is contained in:
@@ -214,7 +214,7 @@ class BillController extends Controller
|
||||
|
||||
// use collector:
|
||||
$collector = new JournalCollector(auth()->user());
|
||||
$collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setPage($page)->setLimit($pageSize);
|
||||
$collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setLimit($pageSize)->setPage($page);
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
$journals->setPath('/bills/show/' . $bill->id);
|
||||
|
||||
|
@@ -194,7 +194,7 @@ class CategoryController extends Controller
|
||||
|
||||
// use journal collector
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setPage($page)->setLimit($pageSize)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category);
|
||||
$collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category);
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
$journals->setPath('categories/show/' . $category->id);
|
||||
|
||||
@@ -226,7 +226,7 @@ class CategoryController extends Controller
|
||||
|
||||
// new collector:
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setPage($page)->setLimit($pageSize)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category);
|
||||
$collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setCategory($category);
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
$journals->setPath('categories/show/' . $category->id . '/all');
|
||||
|
||||
@@ -253,7 +253,7 @@ class CategoryController extends Controller
|
||||
|
||||
// new collector:
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setPage($page)->setLimit($pageSize)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category);
|
||||
$collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category);
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
$journals->setPath('categories/show/' . $category->id . '/' . $date);
|
||||
|
||||
|
@@ -134,27 +134,27 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
{
|
||||
$first = null;
|
||||
|
||||
|
||||
/** @var TransactionJournal $first */
|
||||
/** @var TransactionJournal $firstJournal */
|
||||
$firstJournal = $category->transactionJournals()->orderBy('date', 'ASC')->first(['transaction_journals.date']);
|
||||
|
||||
if ($firstJournal) {
|
||||
$first = $firstJournal->date;
|
||||
}
|
||||
|
||||
// check transactions:
|
||||
|
||||
$firstTransaction = $category->transactions()
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->orderBy('transaction_journals.date', 'ASC')->first(['transaction_journals.date']);
|
||||
|
||||
if (!is_null($firstTransaction) && ((!is_null($first) && $firstTransaction->date < $first) || is_null($first))) {
|
||||
$first = new Carbon($firstTransaction->date);
|
||||
// both exist, the one that is earliest "wins".
|
||||
if (!is_null($firstTransaction) && !is_null($first) && $firstTransaction->date->lt($first)) {
|
||||
$first = $firstTransaction->date;
|
||||
}
|
||||
|
||||
if (is_null($first)) {
|
||||
return new Carbon('1900-01-01');
|
||||
}
|
||||
|
||||
|
||||
return $first;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user