mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
Fix various code.
This commit is contained in:
@@ -83,7 +83,7 @@ class AccountBalanceCalculator
|
||||
if ($accounts->count() > 0) {
|
||||
$query->whereIn('transactions.account_id', $accounts->pluck('id')->toArray());
|
||||
}
|
||||
if (null !== $notBefore) {
|
||||
if ($notBefore instanceof Carbon) {
|
||||
$notBefore->startOfDay();
|
||||
$query->where('transaction_journals.date', '>=', $notBefore);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ class AccountBalanceCalculator
|
||||
|
||||
private function getLatestBalance(int $accountId, int $currencyId, ?Carbon $notBefore): string
|
||||
{
|
||||
if (null === $notBefore) {
|
||||
if (!$notBefore instanceof Carbon) {
|
||||
return '0';
|
||||
}
|
||||
Log::debug(sprintf('getLatestBalance: notBefore date is "%s", calculating', $notBefore->format('Y-m-d')));
|
||||
|
||||
@@ -83,7 +83,7 @@ class BillDateCalculator
|
||||
// AND date is after last paid date
|
||||
if (
|
||||
$nextExpectedMatch->gte($earliest) // date is after "earliest possible date"
|
||||
&& (null === $lastPaid || $nextExpectedMatch->gt($lastPaid)) // date is after last paid date, if that date is not NULL
|
||||
&& (!$lastPaid instanceof Carbon || $nextExpectedMatch->gt($lastPaid)) // date is after last paid date, if that date is not NULL
|
||||
) {
|
||||
Log::debug('Add date to set, because it is after earliest possible date and after last paid date.');
|
||||
$set->push(clone $nextExpectedMatch);
|
||||
|
||||
Reference in New Issue
Block a user