mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +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:
|
// use collector:
|
||||||
$collector = new JournalCollector(auth()->user());
|
$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 = $collector->getPaginatedJournals();
|
||||||
$journals->setPath('/bills/show/' . $bill->id);
|
$journals->setPath('/bills/show/' . $bill->id);
|
||||||
|
|
||||||
|
@@ -194,7 +194,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
// use journal collector
|
// use journal collector
|
||||||
$collector = app(JournalCollectorInterface::class);
|
$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 = $collector->getPaginatedJournals();
|
||||||
$journals->setPath('categories/show/' . $category->id);
|
$journals->setPath('categories/show/' . $category->id);
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
// new collector:
|
// new collector:
|
||||||
$collector = app(JournalCollectorInterface::class);
|
$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 = $collector->getPaginatedJournals();
|
||||||
$journals->setPath('categories/show/' . $category->id . '/all');
|
$journals->setPath('categories/show/' . $category->id . '/all');
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
// new collector:
|
// new collector:
|
||||||
$collector = app(JournalCollectorInterface::class);
|
$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 = $collector->getPaginatedJournals();
|
||||||
$journals->setPath('categories/show/' . $category->id . '/' . $date);
|
$journals->setPath('categories/show/' . $category->id . '/' . $date);
|
||||||
|
|
||||||
|
@@ -134,27 +134,27 @@ class CategoryRepository implements CategoryRepositoryInterface
|
|||||||
{
|
{
|
||||||
$first = null;
|
$first = null;
|
||||||
|
|
||||||
|
/** @var TransactionJournal $firstJournal */
|
||||||
/** @var TransactionJournal $first */
|
|
||||||
$firstJournal = $category->transactionJournals()->orderBy('date', 'ASC')->first(['transaction_journals.date']);
|
$firstJournal = $category->transactionJournals()->orderBy('date', 'ASC')->first(['transaction_journals.date']);
|
||||||
|
|
||||||
if ($firstJournal) {
|
if ($firstJournal) {
|
||||||
$first = $firstJournal->date;
|
$first = $firstJournal->date;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check transactions:
|
// check transactions:
|
||||||
|
|
||||||
$firstTransaction = $category->transactions()
|
$firstTransaction = $category->transactions()
|
||||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||||
->orderBy('transaction_journals.date', 'ASC')->first(['transaction_journals.date']);
|
->orderBy('transaction_journals.date', 'ASC')->first(['transaction_journals.date']);
|
||||||
|
|
||||||
if (!is_null($firstTransaction) && ((!is_null($first) && $firstTransaction->date < $first) || is_null($first))) {
|
// both exist, the one that is earliest "wins".
|
||||||
$first = new Carbon($firstTransaction->date);
|
if (!is_null($firstTransaction) && !is_null($first) && $firstTransaction->date->lt($first)) {
|
||||||
|
$first = $firstTransaction->date;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($first)) {
|
if (is_null($first)) {
|
||||||
return new Carbon('1900-01-01');
|
return new Carbon('1900-01-01');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $first;
|
return $first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user