mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-02 03:02:18 +00:00
Compare commits
15 Commits
develop-20
...
develop-20
Author | SHA1 | Date | |
---|---|---|---|
|
71d39707d9 | ||
|
9ccb8ae692 | ||
|
8cd50bb5bd | ||
|
ae9e1278e5 | ||
|
58c03797b2 | ||
|
7db38b4c6c | ||
|
da6b447e64 | ||
|
c19ac2b0f3 | ||
|
d5ca2171b3 | ||
|
20972cb29f | ||
|
7b714d0866 | ||
|
240ae8fa57 | ||
|
5a2f6b2652 | ||
|
4196ce31f0 | ||
|
be8ca5db50 |
@@ -85,7 +85,8 @@ class AccountController extends Controller
|
||||
$query = $data['query'];
|
||||
$date = $data['date'] ?? today(config('app.timezone'));
|
||||
$return = [];
|
||||
Timer::start(sprintf('AC accounts "%s"', $query));
|
||||
$timer = Timer::getInstance();
|
||||
$timer->start(sprintf('AC accounts "%s"', $query));
|
||||
$result = $this->repository->searchAccount((string) $query, $types, $this->parameters->get('limit'));
|
||||
|
||||
// set date to subday + end-of-day for account balance. so it is at $date 23:59:59
|
||||
@@ -137,7 +138,7 @@ class AccountController extends Controller
|
||||
return $posA - $posB;
|
||||
}
|
||||
);
|
||||
Timer::stop(sprintf('AC accounts "%s"', $query));
|
||||
$timer->stop(sprintf('AC accounts "%s"', $query));
|
||||
|
||||
return response()->api($return);
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@ use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* Class ShowController
|
||||
@@ -81,7 +82,9 @@ class ShowController extends Controller
|
||||
* */
|
||||
public function show(Request $request, Account $account, ?Carbon $start = null, ?Carbon $end = null)
|
||||
{
|
||||
|
||||
if (0 === $account->id) {
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
|
||||
|
||||
if (!$this->isEditableAccount($account)) {
|
||||
@@ -116,18 +119,19 @@ class ShowController extends Controller
|
||||
$firstTransaction = $this->repository->oldestJournalDate($account) ?? $start;
|
||||
|
||||
Log::debug('Start period overview');
|
||||
Timer::start('period-overview');
|
||||
$timer = Timer::getInstance();
|
||||
$timer->start('period-overview');
|
||||
$periods = $this->getAccountPeriodOverview($account, $firstTransaction, $end);
|
||||
|
||||
Log::debug('End period overview');
|
||||
Timer::stop('period-overview');
|
||||
$timer->stop('period-overview');
|
||||
|
||||
// if layout = v2, overrule the page title.
|
||||
if ('v1' !== config('view.layout')) {
|
||||
$subTitle = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]);
|
||||
}
|
||||
Log::debug('Collect transactions');
|
||||
Timer::start('collection');
|
||||
$timer->start('collection');
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -146,7 +150,7 @@ class ShowController extends Controller
|
||||
|
||||
|
||||
Log::debug('End collect transactions');
|
||||
Timer::stop('collection');
|
||||
$timer->stop('collection');
|
||||
|
||||
// enrich data in arrays.
|
||||
|
||||
|
@@ -188,16 +188,7 @@ class ReportController extends Controller
|
||||
$start->endOfDay(); // end of day so the final balance is at the end of that day.
|
||||
$end->endOfDay();
|
||||
|
||||
app('view')->share(
|
||||
'subTitle',
|
||||
trans(
|
||||
'firefly.report_default',
|
||||
[
|
||||
'start' => $start->isoFormat($this->monthAndDayFormat),
|
||||
'end' => $end->isoFormat($this->monthAndDayFormat),
|
||||
]
|
||||
)
|
||||
);
|
||||
app('view')->share('subTitle', trans('firefly.report_default', ['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]));
|
||||
|
||||
$generator = ReportGeneratorFactory::reportGenerator('Standard', $start, $end);
|
||||
$generator->setAccounts($accounts);
|
||||
@@ -222,16 +213,7 @@ class ReportController extends Controller
|
||||
$start->endOfDay(); // end of day so the final balance is at the end of that day.
|
||||
$end->endOfDay();
|
||||
|
||||
app('view')->share(
|
||||
'subTitle',
|
||||
trans(
|
||||
'firefly.report_double',
|
||||
[
|
||||
'start' => $start->isoFormat($this->monthAndDayFormat),
|
||||
'end' => $end->isoFormat($this->monthAndDayFormat),
|
||||
]
|
||||
)
|
||||
);
|
||||
app('view')->share('subTitle', trans('firefly.report_double', ['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]));
|
||||
|
||||
$generator = ReportGeneratorFactory::reportGenerator('Account', $start, $end);
|
||||
$generator->setAccounts($accounts);
|
||||
|
@@ -566,7 +566,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
|
||||
'transaction_types.type',
|
||||
'transaction_journals.transaction_currency_id',
|
||||
'transactions.amount',
|
||||
'transactions.native_amount',
|
||||
'transactions.native_amount as pc_amount',
|
||||
'transactions.foreign_amount',
|
||||
])
|
||||
->toArray()
|
||||
|
@@ -28,19 +28,34 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Timer
|
||||
{
|
||||
private static array $times = [];
|
||||
private array $times = [];
|
||||
private static ?Timer $instance = null;
|
||||
|
||||
public static function start(string $title): void
|
||||
private function __construct()
|
||||
{
|
||||
self::$times[$title] = microtime(true);
|
||||
// Private constructor to prevent direct instantiation.
|
||||
}
|
||||
|
||||
public static function stop(string $title): void
|
||||
public static function getInstance(): self
|
||||
{
|
||||
$start = self::$times[$title] ?? 0;
|
||||
if (null === self::$instance) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function start(string $title): void
|
||||
{
|
||||
$this->times[$title] = microtime(true);
|
||||
}
|
||||
|
||||
public function stop(string $title): void
|
||||
{
|
||||
$start = $this->times[$title] ?? 0;
|
||||
$end = microtime(true);
|
||||
$diff = $end - $start;
|
||||
unset(self::$times[$title]);
|
||||
unset($this->times[$title]);
|
||||
Log::debug(sprintf('Timer "%s" took %f seconds', $title, $diff));
|
||||
}
|
||||
}
|
||||
|
@@ -80,7 +80,8 @@ trait PeriodOverview
|
||||
protected function getAccountPeriodOverview(Account $account, Carbon $start, Carbon $end): array
|
||||
{
|
||||
Log::debug('Now in getAccountPeriodOverview()');
|
||||
Timer::start('account-period-total');
|
||||
$timer = Timer::getInstance();
|
||||
$timer->start('account-period-total');
|
||||
$this->accountRepository = app(AccountRepositoryInterface::class);
|
||||
$range = Navigation::getViewRange(true);
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
@@ -92,23 +93,24 @@ trait PeriodOverview
|
||||
$cache->addProperty('account-show-period-entries');
|
||||
$cache->addProperty($account->id);
|
||||
if ($cache->has()) {
|
||||
// return $cache->get();
|
||||
Log::debug('Return CACHED in getAccountPeriodOverview()');
|
||||
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
/** @var array $dates */
|
||||
$dates = Navigation::blockPeriods($start, $end, $range);
|
||||
$entries = [];
|
||||
$spent = [];
|
||||
$earned = [];
|
||||
$transferredAway = [];
|
||||
$transferredIn = [];
|
||||
|
||||
// run a custom query because doing this with the collector is MEGA slow.
|
||||
$timer->start('account-period-collect');
|
||||
$transactions = $this->accountRepository->periodCollection($account, $start, $end);
|
||||
$timer->stop('account-period-collect');
|
||||
// loop dates
|
||||
Log::debug(sprintf('Count of loops: %d', count($dates)));
|
||||
$loops = 0;
|
||||
// stop after 10 loops for memory reasons.
|
||||
$timer->start('account-period-loop');
|
||||
foreach ($dates as $currentDate) {
|
||||
$title = Navigation::periodShow($currentDate['start'], $currentDate['period']);
|
||||
[$transactions, $spent] = $this->filterTransactionsByType(TransactionTypeEnum::WITHDRAWAL, $transactions, $currentDate['start'], $currentDate['end']);
|
||||
@@ -127,8 +129,9 @@ trait PeriodOverview
|
||||
];
|
||||
++$loops;
|
||||
}
|
||||
$timer->stop('account-period-loop');
|
||||
$cache->store($entries);
|
||||
Timer::stop('account-period-total');
|
||||
$timer->stop('account-period-total');
|
||||
Log::debug('End of getAccountPeriodOverview()');
|
||||
|
||||
return $entries;
|
||||
@@ -168,7 +171,7 @@ trait PeriodOverview
|
||||
* @var array $item
|
||||
*/
|
||||
foreach ($transactions as $index => $item) {
|
||||
$date = Carbon::parse($item['date']);
|
||||
$date = Carbon::parse($item['date']);
|
||||
if ($date >= $start && $date <= $end) {
|
||||
if ('away' === $direction && -1 === bccomp((string)$item['amount'], '0')) {
|
||||
$result[] = $item;
|
||||
@@ -180,8 +183,8 @@ trait PeriodOverview
|
||||
|
||||
continue;
|
||||
}
|
||||
$filtered[] = $item;
|
||||
}
|
||||
$filtered[] = $item;
|
||||
}
|
||||
|
||||
return [$filtered, $result];
|
||||
|
@@ -19,18 +19,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- [Issue 10071](https://github.com/firefly-iii/firefly-iii/issues/10071) (Allow toggling password field to text) reported by @ragul-engg
|
||||
- Renamed all instances of "default" and "native" currency to "primary" currency. This influences translations and API endpoints. The database is not changed because that's difficult to do reliably.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Any API-field called `default_*` or `native_*`. Use `primary_*` instead.
|
||||
- All v2 endpoints.
|
||||
|
||||
### Removed
|
||||
|
||||
- Any API-field called `default_*` or `native_*`. Use `primary_*` instead.
|
||||
- All v2 endpoints.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Issue 9849](https://github.com/firefly-iii/firefly-iii/issues/9849) ("Display native amounts" not taken into account in report's pie charts) reported by @polter-rnd
|
||||
- [Issue 10565](https://github.com/firefly-iii/firefly-iii/issues/10565) (Unable to delete reconciliation transaction) reported by @berta24
|
||||
- [Issue 10600](https://github.com/firefly-iii/firefly-iii/issues/10600) (Show attachmen iccon when listing tranactions) reported by @JcMinarro
|
||||
- [Discussion 10618](https://github.com/orgs/firefly-iii/discussions/10618) (Starting balance includes transactions that occur at 00:00 on the 1st of month) started by @jteez
|
||||
@@ -40,6 +35,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- [Issue 10687](https://github.com/firefly-iii/firefly-iii/issues/10687) (Creating new Piggy Bank via API fails (Unexpected empty currency)) reported by @Madnex
|
||||
- [Issue 10700](https://github.com/firefly-iii/firefly-iii/issues/10700) (Setting financial year date is inconsistent due to timezone calculations) reported by @AgeManning
|
||||
- [Issue 10702](https://github.com/firefly-iii/firefly-iii/issues/10702) (Wrong order of months in category report) reported by @kapuett
|
||||
- [Issue 10703](https://github.com/firefly-iii/firefly-iii/issues/10703) (Fire more than 5 webhooks in batch or through the cron job, and document it.) reported by @JC5
|
||||
- [Issue 10704](https://github.com/firefly-iii/firefly-iii/issues/10704) (Some triggers with rule automation seems to have an issue) reported by @Alienlog
|
||||
- [Issue 10706](https://github.com/firefly-iii/firefly-iii/issues/10706) (Add KRW in Default Currency List) reported by @readingsnail
|
||||
- [Issue 10708](https://github.com/firefly-iii/firefly-iii/issues/10708) (Incomplete display of a rule when a trigger negates "description caontains") reported by @dethegeek
|
||||
|
@@ -78,8 +78,8 @@ return [
|
||||
'running_balance_column' => env('USE_RUNNING_BALANCE', false),
|
||||
// see cer.php for exchange rates feature flag.
|
||||
],
|
||||
'version' => 'develop/2025-08-09',
|
||||
'build_time' => 1754750540,
|
||||
'version' => 'develop/2025-08-10',
|
||||
'build_time' => 1754800876,
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 26,
|
||||
|
||||
|
@@ -2333,6 +2333,7 @@ return [
|
||||
|
||||
|
||||
// reports:
|
||||
'quick_link_needs_accounts' => 'In order to generate reports, you need to add at least one asset account to Firefly III.',
|
||||
'report_default' => 'Default financial report between :start and :end',
|
||||
'report_audit' => 'Transaction history overview between :start and :end',
|
||||
'report_category' => 'Category report between :start and :end',
|
||||
|
@@ -12,7 +12,6 @@
|
||||
<td style="text-align: right;">{{ period.total_transactions }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
{% for entry in period.spent %}
|
||||
{% if entry.amount != 0 %}
|
||||
<tr>
|
||||
|
@@ -128,6 +128,12 @@
|
||||
<h3 class="box-title">{{ 'quick_link_reports'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{% if '' == accountList %}
|
||||
<p class="text-danger">
|
||||
{{ 'quick_link_needs_accounts'|_ }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if '' != accountList %}
|
||||
<p>
|
||||
{{ 'quick_link_examples'|_ }}
|
||||
</p>
|
||||
@@ -172,6 +178,7 @@
|
||||
<p>
|
||||
<em>{{ 'reports_can_bookmark'|_ }}</em>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user