mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 09:22:33 +00:00
Add options to set ranges.
This commit is contained in:
@@ -154,7 +154,7 @@ class IndexController extends Controller
|
||||
private function getSums(array $bills): array
|
||||
{
|
||||
$sums = [];
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(false);
|
||||
|
||||
/** @var array $group */
|
||||
foreach ($bills as $groupOrder => $group) {
|
||||
|
@@ -104,8 +104,8 @@ class IndexController extends Controller
|
||||
Log::debug('Start of IndexController::index()');
|
||||
|
||||
// collect some basic vars:
|
||||
$range = (string)app('preferences')->get('viewRange', '1M')->data;
|
||||
$start = $start ?? session('start', Carbon::now()->startOfMonth());
|
||||
$range = app('navigation')->getViewRange(true);
|
||||
$start = $start ?? session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end = $end ?? app('navigation')->endOfPeriod($start, $range);
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
$currencies = $this->currencyRepository->get();
|
||||
|
@@ -89,7 +89,7 @@ class CategoryController extends Controller
|
||||
/** @var CategoryRepositoryInterface $repository */
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
$start = $repository->firstUseDate($category) ?? $this->getDate();
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(false);
|
||||
$start = app('navigation')->startOfPeriod($start, $range);
|
||||
$end = $this->getDate();
|
||||
|
||||
@@ -118,8 +118,8 @@ class CategoryController extends Controller
|
||||
*/
|
||||
public function frontPage(): JsonResponse
|
||||
{
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
$start = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
@@ -293,7 +293,7 @@ class CategoryController extends Controller
|
||||
*/
|
||||
public function specificPeriod(Category $category, Carbon $date): JsonResponse
|
||||
{
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(false);
|
||||
$start = app('navigation')->startOfPeriod($date, $range);
|
||||
$end = session()->get('end');
|
||||
if ($end < $start) {
|
||||
|
@@ -96,7 +96,7 @@ class PreferencesController extends Controller
|
||||
ksort($groupedAccounts);
|
||||
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$viewRangePref = app('preferences')->get('viewRange', '1M');
|
||||
$viewRangePref = app('navigation')->getViewRange(false);
|
||||
|
||||
$viewRange = $viewRangePref->data;
|
||||
$frontPageAccounts = app('preferences')->get('frontPageAccounts', $accountIds);
|
||||
|
@@ -106,7 +106,7 @@ class Range
|
||||
setlocale(LC_TIME, $localeArray);
|
||||
$moneyResult = setlocale(LC_MONETARY, $localeArray);
|
||||
|
||||
// send error to view if could not set money format
|
||||
// send error to view, if could not set money format
|
||||
if (false === $moneyResult) {
|
||||
Log::error('Could not set locale. The following array doesnt work: ', $localeArray);
|
||||
app('view')->share('invalidMonetaryLocale', true);
|
||||
|
Reference in New Issue
Block a user