mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 20:25:28 +00:00
Fix some things in recurring transactions.
This commit is contained in:
@@ -111,12 +111,18 @@ class IndexController extends Controller
|
||||
$array['first_date'] = new Carbon($array['first_date']);
|
||||
$array['repeat_until'] = null === $array['repeat_until'] ? null : new Carbon($array['repeat_until']);
|
||||
$array['latest_date'] = null === $array['latest_date'] ? null : new Carbon($array['latest_date']);
|
||||
$array['occurrences'] = [];
|
||||
|
||||
if (0 !== $recurrence->recurrenceRepetitions->count()) {
|
||||
$array['ocurrences'] = array_slice($this->recurring->getOccurrencesInRange($recurrence->recurrenceRepetitions->first(), $today, $year), 0, 1);
|
||||
// make carbon objects out of occurrences
|
||||
foreach ($array['repetitions'] as $repIndex => $repetition) {
|
||||
foreach ($repetition['occurrences'] as $occIndex => $occurrence) {
|
||||
$array['repetitions'][$repIndex]['occurrences'][$occIndex] = new Carbon($occurrence);
|
||||
}
|
||||
}
|
||||
|
||||
//if (0 !== $recurrence->recurrenceRepetitions->count()) {
|
||||
//$array['ocurrences'] = array_slice($this->recurring->getOccurrencesInRange($recurrence->recurrenceRepetitions->first(), $today, $year), 0, 1);
|
||||
//}
|
||||
|
||||
$recurring[] = $array;
|
||||
}
|
||||
$paginator = new LengthAwarePaginator($recurring, $total, $pageSize, $page);
|
||||
|
||||
@@ -82,8 +82,10 @@ class ShowController extends Controller
|
||||
$transformer = app(RecurrenceTransformer::class);
|
||||
$transformer->setParameters(new ParameterBag);
|
||||
|
||||
$array = $transformer->transform($recurrence);
|
||||
$groups = $this->recurring->getTransactions($recurrence);
|
||||
$array = $transformer->transform($recurrence);
|
||||
$groups = $this->recurring->getTransactions($recurrence);
|
||||
$today = new Carbon;
|
||||
$array['repeat_until'] = null !== $array['repeat_until'] ? new Carbon($array['repeat_until']) : null;
|
||||
|
||||
// transform dates back to Carbon objects:
|
||||
foreach ($array['repetitions'] as $index => $repetition) {
|
||||
@@ -94,6 +96,6 @@ class ShowController extends Controller
|
||||
|
||||
$subTitle = (string) trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]);
|
||||
|
||||
return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'groups'));
|
||||
return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'groups','today'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user