Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix https://github.com/firefly-iii/firefly-iii/issues/9416
James Cole4b27ab38f870
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.phpindex 83f3d47df8..9ef2581695 100644--- a/app/Models/TransactionJournal.php+++ b/app/Models/TransactionJournal.php@@ -37,6 +37,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;use Illuminate\Database\Eloquent\Relations\HasMany;use Illuminate\Database\Eloquent\Relations\MorphMany;use Illuminate\Database\Eloquent\SoftDeletes;+use Illuminate\Support\Facades\Log;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**@@ -167,12 +168,14 @@ class TransactionJournal extends Modelpublic function scopeAfter(EloquentBuilder $query, Carbon $date): EloquentBuilder{- return $query->where('transaction_journals.date', '>=', $date->format('Y-m-d 00:00:00'));+ Log::debug(sprintf('scopeAfter("%s")', $date->format('Y-m-d H:i:s')));+ return $query->where('transaction_journals.date', '>=', $date->format('Y-m-d H:i:s'));}public function scopeBefore(EloquentBuilder $query, Carbon $date): EloquentBuilder{- return $query->where('transaction_journals.date', '<=', $date->format('Y-m-d 00:00:00'));+ Log::debug(sprintf('scopeBefore("%s")', $date->format('Y-m-d H:i:s')));+ return $query->where('transaction_journals.date', '<=', $date->format('Y-m-d H:i:s'));}public function scopeTransactionTypes(EloquentBuilder $query, array $types): voiddiff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.phpindex cba752dd33..d0fa449775 100644--- a/app/Repositories/Bill/BillRepository.php+++ b/app/Repositories/Bill/BillRepository.php@@ -306,6 +306,8 @@ class BillRepository implements BillRepositoryInterface{// app('log')->debug('Now in getPaidDatesInRange()');+ Log::debug(sprintf('Search for linked journals between %s and %s', $start->toW3cString(), $end->toW3cString()));+return $bill->transactionJournals()->before($end)->after($start)->get([diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.phpindex b2e471bdff..85a9741091 100644--- a/app/Transformers/BillTransformer.php+++ b/app/Transformers/BillTransformer.php@@ -194,11 +194,19 @@ class BillTransformer extends AbstractTransformer$searchStart = clone $start;$start->subDay();- app('log')->debug(sprintf('Parameters are start: %s end: %s', $start->format('Y-m-d'), $this->parameters->get('end')->format('Y-m-d')));+ /** @var Carbon $end */+ $end = clone $this->parameters->get('end');+ $searchEnd = clone $end;++ // move the search dates to the start of the day.+ $searchStart->startOfDay();+ $searchEnd->endOfDay();++ app('log')->debug(sprintf('Parameters are start: %s end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));app('log')->debug(sprintf('Search parameters are: start: %s', $searchStart->format('Y-m-d')));// Get from database when bill was paid.- $set = $this->repository->getPaidDatesInRange($bill, $searchStart, $this->parameters->get('end'));+ $set = $this->repository->getPaidDatesInRange($bill, $searchStart, $searchEnd);app('log')->debug(sprintf('Count %d entries in getPaidDatesInRange()', $set->count()));// Grab from array the most recent payment. If none exist, fall back to the start date and pretend *that* was the last paid date.