mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-16 22:58:09 +00:00
Go to end of month for #11191
This commit is contained in:
@@ -69,7 +69,7 @@ class HomeController extends Controller
|
|||||||
$stringStart = e((string) $request->get('start'));
|
$stringStart = e((string) $request->get('start'));
|
||||||
$start = Carbon::createFromFormat('Y-m-d', $stringStart);
|
$start = Carbon::createFromFormat('Y-m-d', $stringStart);
|
||||||
} catch (InvalidFormatException) {
|
} catch (InvalidFormatException) {
|
||||||
app('log')->error(sprintf('Start: could not parse date string "%s" so ignore it.', $stringStart));
|
Log::error(sprintf('Start: could not parse date string "%s" so ignore it.', $stringStart));
|
||||||
$start = Carbon::now()->startOfMonth();
|
$start = Carbon::now()->startOfMonth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class HomeController extends Controller
|
|||||||
$stringEnd = e((string) $request->get('end'));
|
$stringEnd = e((string) $request->get('end'));
|
||||||
$end = Carbon::createFromFormat('Y-m-d', $stringEnd);
|
$end = Carbon::createFromFormat('Y-m-d', $stringEnd);
|
||||||
} catch (InvalidFormatException) {
|
} catch (InvalidFormatException) {
|
||||||
app('log')->error(sprintf('End could not parse date string "%s" so ignore it.', $stringEnd));
|
Log::error(sprintf('End could not parse date string "%s" so ignore it.', $stringEnd));
|
||||||
$end = Carbon::now()->endOfMonth();
|
$end = Carbon::now()->endOfMonth();
|
||||||
}
|
}
|
||||||
if (null === $start) {
|
if (null === $start) {
|
||||||
@@ -90,12 +90,12 @@ class HomeController extends Controller
|
|||||||
$label = $request->get('label');
|
$label = $request->get('label');
|
||||||
$isCustomRange = false;
|
$isCustomRange = false;
|
||||||
|
|
||||||
app('log')->debug('dateRange: Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
|
Log::debug('dateRange: Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
|
||||||
// check if the label is "everything" or "Custom range" which will betray
|
// check if the label is "everything" or "Custom range" which will betray
|
||||||
// a possible problem with the budgets.
|
// a possible problem with the budgets.
|
||||||
if ($label === (string) trans('firefly.everything') || $label === (string) trans('firefly.customRange')) {
|
if ($label === (string) trans('firefly.everything') || $label === (string) trans('firefly.customRange')) {
|
||||||
$isCustomRange = true;
|
$isCustomRange = true;
|
||||||
app('log')->debug('Range is now marked as "custom".');
|
Log::debug('Range is now marked as "custom".');
|
||||||
}
|
}
|
||||||
|
|
||||||
$diff = $start->diffInDays($end, true) + 1;
|
$diff = $start->diffInDays($end, true) + 1;
|
||||||
@@ -105,11 +105,11 @@ class HomeController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$request->session()->put('is_custom_range', $isCustomRange);
|
$request->session()->put('is_custom_range', $isCustomRange);
|
||||||
app('log')->debug(sprintf('Set is_custom_range to %s', var_export($isCustomRange, true)));
|
Log::debug(sprintf('Set is_custom_range to %s', var_export($isCustomRange, true)));
|
||||||
$request->session()->put('start', $start);
|
$request->session()->put('start', $start);
|
||||||
app('log')->debug(sprintf('Set start to %s', $start->format('Y-m-d H:i:s')));
|
Log::debug(sprintf('Set start to %s', $start->format('Y-m-d H:i:s')));
|
||||||
$request->session()->put('end', $end);
|
$request->session()->put('end', $end);
|
||||||
app('log')->debug(sprintf('Set end to %s', $end->format('Y-m-d H:i:s')));
|
Log::debug(sprintf('Set end to %s', $end->format('Y-m-d H:i:s')));
|
||||||
|
|
||||||
return response()->json(['ok' => 'ok']);
|
return response()->json(['ok' => 'ok']);
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ class HomeController extends Controller
|
|||||||
$today = today(config('app.timezone'));
|
$today = today(config('app.timezone'));
|
||||||
$accounts = $accounts->sortBy('order'); // sort frontpage accounts by order
|
$accounts = $accounts->sortBy('order'); // sort frontpage accounts by order
|
||||||
|
|
||||||
app('log')->debug('Frontpage accounts are ', $frontpageArray);
|
Log::debug('Frontpage accounts are ', $frontpageArray);
|
||||||
|
|
||||||
/** @var BillRepositoryInterface $billRepository */
|
/** @var BillRepositoryInterface $billRepository */
|
||||||
$billRepository = app(BillRepositoryInterface::class);
|
$billRepository = app(BillRepositoryInterface::class);
|
||||||
|
|||||||
@@ -157,6 +157,14 @@ class General extends AbstractExtension
|
|||||||
|
|
||||||
/** @var Carbon $date */
|
/** @var Carbon $date */
|
||||||
$date = now();
|
$date = now();
|
||||||
|
|
||||||
|
// get the date from the current session. If it's in the future, keep `now()`.
|
||||||
|
/** @var Carbon $session */
|
||||||
|
$session = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||||
|
if($session->lt($date)) {
|
||||||
|
$date = $session->copy();
|
||||||
|
$date->endOfDay();
|
||||||
|
}
|
||||||
Log::debug(sprintf('twig balance: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
|
Log::debug(sprintf('twig balance: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
|
||||||
|
|
||||||
// 2025-10-08 replace finalAccountBalance with accountsBalancesOptimized.
|
// 2025-10-08 replace finalAccountBalance with accountsBalancesOptimized.
|
||||||
|
|||||||
Reference in New Issue
Block a user