mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-01 02:21:45 +00:00
32
.ci/php-cs-fixer/composer.lock
generated
32
.ci/php-cs-fixer/composer.lock
generated
@@ -379,16 +379,16 @@
|
||||
},
|
||||
{
|
||||
"name": "friendsofphp/php-cs-fixer",
|
||||
"version": "v3.14.3",
|
||||
"version": "v3.14.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
||||
"reference": "b418036b95b4936a33fe906245d3044395935e73"
|
||||
"reference": "1b3d9dba63d93b8a202c31e824748218781eae6b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/b418036b95b4936a33fe906245d3044395935e73",
|
||||
"reference": "b418036b95b4936a33fe906245d3044395935e73",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/1b3d9dba63d93b8a202c31e824748218781eae6b",
|
||||
"reference": "1b3d9dba63d93b8a202c31e824748218781eae6b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -399,7 +399,7 @@
|
||||
"ext-json": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"php": "^7.4 || ^8.0",
|
||||
"sebastian/diff": "^4.0",
|
||||
"sebastian/diff": "^4.0 || ^5.0",
|
||||
"symfony/console": "^5.4 || ^6.0",
|
||||
"symfony/event-dispatcher": "^5.4 || ^6.0",
|
||||
"symfony/filesystem": "^5.4 || ^6.0",
|
||||
@@ -457,7 +457,7 @@
|
||||
"description": "A tool to automatically fix PHP code style",
|
||||
"support": {
|
||||
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.14.3"
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.14.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -465,7 +465,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-01-30T00:24:29+00:00"
|
||||
"time": "2023-02-09T21:49:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/cache",
|
||||
@@ -671,29 +671,29 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "4.0.4",
|
||||
"version": "5.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d"
|
||||
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d",
|
||||
"reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/70dd1b20bc198da394ad542e988381b44e64e39f",
|
||||
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.3"
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.3",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"symfony/process": "^4.2 || ^5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.0-dev"
|
||||
"dev-main": "5.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -725,7 +725,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/4.0.4"
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -733,7 +733,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-26T13:10:38+00:00"
|
||||
"time": "2023-02-03T07:00:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
|
||||
@@ -350,11 +350,11 @@ class BasicController extends Controller
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$date = Carbon::now()->startOfDay();
|
||||
$date = today(config('app.timezone'))->startOfDay();
|
||||
// start and end in the future? use $end
|
||||
if ($this->notInDateRange($date, $start, $end)) {
|
||||
/** @var Carbon $date */
|
||||
$date = session('end', Carbon::now()->endOfMonth());
|
||||
$date = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
}
|
||||
|
||||
/** @var NetWorthInterface $netWorthHelper */
|
||||
|
||||
@@ -42,8 +42,8 @@ class ExportRequest extends FormRequest
|
||||
public function getAll(): array
|
||||
{
|
||||
$result = [
|
||||
'start' => $this->getCarbonDate('start') ?? Carbon::now()->subYear(),
|
||||
'end' => $this->getCarbonDate('end') ?? Carbon::now(),
|
||||
'start' => $this->getCarbonDate('start') ?? today(config('app.timezone'))->subYear(),
|
||||
'end' => $this->getCarbonDate('end') ?? today(config('app.timezone')),
|
||||
'type' => $this->convertString('type'),
|
||||
];
|
||||
$parts = explode(',', $this->convertString('accounts'));
|
||||
|
||||
@@ -56,7 +56,7 @@ class CronRequest extends FormRequest
|
||||
{
|
||||
$data = [
|
||||
'force' => false,
|
||||
'date' => Carbon::now(),
|
||||
'date' => today(config('app.timezone')),
|
||||
];
|
||||
if ($this->has('force')) {
|
||||
$data['force'] = $this->boolean('force');
|
||||
|
||||
@@ -191,7 +191,7 @@ class ExportData extends Command
|
||||
*/
|
||||
private function getDateParameter(string $field): Carbon
|
||||
{
|
||||
$date = Carbon::now()->subYear();
|
||||
$date = today(config('app.timezone'))->subYear();
|
||||
$error = false;
|
||||
if (null !== $this->option($field)) {
|
||||
try {
|
||||
@@ -209,7 +209,7 @@ class ExportData extends Command
|
||||
|
||||
if (true === $error && 'start' === $field) {
|
||||
$journal = $this->journalRepository->firstNull();
|
||||
$date = null === $journal ? Carbon::now()->subYear() : $journal->date;
|
||||
$date = null === $journal ? today(config('app.timezone'))->subYear() : $journal->date;
|
||||
$date->startOfDay();
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ class ApplyRules extends Command
|
||||
private function verifyInputDates(): void
|
||||
{
|
||||
// parse start date.
|
||||
$inputStart = Carbon::now()->startOfMonth();
|
||||
$inputStart = today(config('app.timezone'))->startOfMonth();
|
||||
$startString = $this->option('start_date');
|
||||
if (null === $startString) {
|
||||
/** @var JournalRepositoryInterface $repository */
|
||||
@@ -298,7 +298,7 @@ class ApplyRules extends Command
|
||||
}
|
||||
|
||||
// parse end date
|
||||
$inputEnd = Carbon::now();
|
||||
$inputEnd = today(config('app.timezone'));
|
||||
$endString = $this->option('end_date');
|
||||
if (null !== $endString && '' !== $endString) {
|
||||
$inputEnd = Carbon::createFromFormat('Y-m-d', $endString);
|
||||
|
||||
@@ -45,7 +45,7 @@ class PiggyBankEventHandler
|
||||
if (null !== $event->transactionGroup) {
|
||||
$journal = $event->transactionGroup->transactionJournals()->first();
|
||||
}
|
||||
$date = $journal?->date ?? Carbon::now();
|
||||
$date = $journal?->date ?? today(config('app.timezone'));
|
||||
|
||||
// sanity check: event must not already exist for this journal and piggy bank.
|
||||
if (null !== $journal) {
|
||||
|
||||
@@ -123,7 +123,7 @@ class ReportHelper implements ReportHelperInterface
|
||||
$fiscalHelper = app(FiscalHelperInterface::class);
|
||||
$start = clone $date;
|
||||
$start->startOfMonth();
|
||||
$end = Carbon::now();
|
||||
$end = today(config('app.timezone'));
|
||||
$end->endOfMonth();
|
||||
$months = [];
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ class IndexController extends Controller
|
||||
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
||||
unset($collection);
|
||||
/** @var Carbon $start */
|
||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = clone session('end', Carbon::now()->endOfMonth());
|
||||
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$start->subDay();
|
||||
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
@@ -156,9 +156,9 @@ class IndexController extends Controller
|
||||
|
||||
unset($collection);
|
||||
/** @var Carbon $start */
|
||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = clone session('end', Carbon::now()->endOfMonth());
|
||||
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$start->subDay();
|
||||
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
|
||||
@@ -100,7 +100,7 @@ class ReconcileController extends Controller
|
||||
$currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
|
||||
// no start or end:
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(false);
|
||||
|
||||
// get start and end
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ class ShowController extends Controller
|
||||
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
|
||||
$end = today(config('app.timezone'));
|
||||
$today = today(config('app.timezone'));
|
||||
$start = $this->repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||
$start = $this->repository->oldestJournalDate($account) ?? today(config('app.timezone'))->startOfMonth();
|
||||
$subTitleIcon = config('firefly.subIconsByIdentifier.'.$account->accountType->type);
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -159,7 +159,7 @@ class ShowController extends Controller
|
||||
public function show(Request $request, Budget $budget)
|
||||
{
|
||||
/** @var Carbon $allStart */
|
||||
$allStart = session('first', Carbon::now()->startOfYear());
|
||||
$allStart = session('first', today(config('app.timezone'))->startOfYear());
|
||||
$allEnd = today();
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
@@ -221,7 +221,7 @@ class ShowController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('budgets.show', [$budget->id, $budgetLimit->id]));
|
||||
/** @var Carbon $start */
|
||||
$start = session('first', Carbon::now()->startOfYear());
|
||||
$start = session('first', today(config('app.timezone'))->startOfYear());
|
||||
$end = today(config('app.timezone'));
|
||||
$attachments = $this->repository->getAttachments($budget);
|
||||
$limits = $this->getLimits($budget, $start, $end);
|
||||
|
||||
@@ -88,14 +88,14 @@ class ShowController extends Controller
|
||||
public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start', Carbon::now()->startOfMonth());
|
||||
$start = $start ?? session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = $end ?? session('end', Carbon::now()->endOfMonth());
|
||||
$end = $end ?? session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$subTitleIcon = 'fa-bookmark';
|
||||
$page = (int)$request->get('page');
|
||||
$attachments = $this->repository->getAttachments($category);
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$oldest = $this->repository->firstUseDate($category) ?? Carbon::now()->startOfYear();
|
||||
$oldest = $this->repository->firstUseDate($category) ?? today(config('app.timezone'))->startOfYear();
|
||||
$periods = $this->getCategoryPeriodOverview($category, $oldest, $end);
|
||||
$path = route('categories.show', [$category->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
|
||||
$subTitle = trans(
|
||||
|
||||
@@ -90,9 +90,9 @@ class AccountController extends Controller
|
||||
public function expenseAccounts(): JsonResponse
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = clone session('end', Carbon::now()->endOfMonth());
|
||||
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
@@ -184,8 +184,8 @@ class AccountController extends Controller
|
||||
*/
|
||||
public function expenseBudgetAll(AccountRepositoryInterface $repository, Account $account): JsonResponse
|
||||
{
|
||||
$start = $repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||
$end = Carbon::now();
|
||||
$start = $repository->oldestJournalDate($account) ?? today(config('app.timezone'))->startOfMonth();
|
||||
$end = today(config('app.timezone'));
|
||||
|
||||
return $this->expenseBudget($account, $start, $end);
|
||||
}
|
||||
@@ -259,8 +259,8 @@ class AccountController extends Controller
|
||||
*/
|
||||
public function expenseCategoryAll(AccountRepositoryInterface $repository, Account $account): JsonResponse
|
||||
{
|
||||
$start = $repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||
$end = Carbon::now();
|
||||
$start = $repository->oldestJournalDate($account) ?? today(config('app.timezone'))->startOfMonth();
|
||||
$end = today(config('app.timezone'));
|
||||
|
||||
return $this->expenseCategory($account, $start, $end);
|
||||
}
|
||||
@@ -334,8 +334,8 @@ class AccountController extends Controller
|
||||
*/
|
||||
public function frontpage(AccountRepositoryInterface $repository): JsonResponse
|
||||
{
|
||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||
$end = clone session('end', Carbon::now()->endOfMonth());
|
||||
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$defaultSet = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray();
|
||||
Log::debug('Default set is ', $defaultSet);
|
||||
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
|
||||
@@ -360,8 +360,8 @@ class AccountController extends Controller
|
||||
*/
|
||||
public function incomeCategoryAll(AccountRepositoryInterface $repository, Account $account): JsonResponse
|
||||
{
|
||||
$start = $repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||
$end = Carbon::now();
|
||||
$start = $repository->oldestJournalDate($account) ?? today(config('app.timezone'))->startOfMonth();
|
||||
$end = today(config('app.timezone'));
|
||||
|
||||
return $this->incomeCategory($account, $start, $end);
|
||||
}
|
||||
@@ -540,9 +540,9 @@ class AccountController extends Controller
|
||||
public function revenueAccounts(): JsonResponse
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = clone session('end', Carbon::now()->endOfMonth());
|
||||
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
|
||||
@@ -62,8 +62,8 @@ class BillController extends Controller
|
||||
*/
|
||||
public function frontpage(BillRepositoryInterface $repository): 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());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
|
||||
@@ -214,7 +214,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($budget->id);
|
||||
$cache->addProperty($budgetLimitId);
|
||||
$cache->addProperty('chart.budget.expense-asset');
|
||||
$start = session('first', Carbon::now()->startOfYear());
|
||||
$start = session('first', today(config('app.timezone'))->startOfYear());
|
||||
$end = today();
|
||||
|
||||
if (null !== $budgetLimit) {
|
||||
@@ -282,7 +282,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($budget->id);
|
||||
$cache->addProperty($budgetLimitId);
|
||||
$cache->addProperty('chart.budget.expense-category');
|
||||
$start = session('first', Carbon::now()->startOfYear());
|
||||
$start = session('first', today(config('app.timezone'))->startOfYear());
|
||||
$end = today();
|
||||
if (null !== $budgetLimit) {
|
||||
$start = $budgetLimit->start_date;
|
||||
@@ -346,7 +346,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($budget->id);
|
||||
$cache->addProperty($budgetLimitId);
|
||||
$cache->addProperty('chart.budget.expense-expense');
|
||||
$start = session('first', Carbon::now()->startOfYear());
|
||||
$start = session('first', today(config('app.timezone'))->startOfYear());
|
||||
$end = today();
|
||||
if (null !== $budgetLimit) {
|
||||
$start = $budgetLimit->start_date;
|
||||
@@ -402,8 +402,8 @@ class BudgetController 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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -120,7 +120,7 @@ class DebugController extends Controller
|
||||
public function index(Request $request)
|
||||
{
|
||||
// basic scope information:
|
||||
$now = Carbon::now()->format('Y-m-d H:i:s e');
|
||||
$now = today(config('app.timezone'))->format('Y-m-d H:i:s e');
|
||||
$buildNr = '(unknown)';
|
||||
$buildDate = '(unknown)';
|
||||
$expectedDBversion = config('firefly.db_version');
|
||||
|
||||
@@ -119,9 +119,9 @@ class HomeController extends Controller
|
||||
$transactions = [];
|
||||
$frontPage = app('preferences')->getFresh('frontPageAccounts', $repository->getAccountsByType([AccountType::ASSET])->pluck('id')->toArray());
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
$start = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$accounts = $repository->getAccountsById($frontPage->data);
|
||||
$today = today(config('app.timezone'));
|
||||
|
||||
|
||||
@@ -157,9 +157,9 @@ class JavascriptController extends Controller
|
||||
public function variablesV2(Request $request): Response
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = clone session('end', Carbon::now()->endOfMonth());
|
||||
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
|
||||
$data = [
|
||||
'start' => $start->format('Y-m-d'),
|
||||
|
||||
@@ -60,9 +60,9 @@ class BoxController extends Controller
|
||||
/** @var AvailableBudgetRepositoryInterface $abRepository */
|
||||
$abRepository = app(AvailableBudgetRepositoryInterface::class);
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
$start = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$today = today(config('app.timezone'));
|
||||
$display = 2; // see method docs.
|
||||
$boxTitle = (string)trans('firefly.spent');
|
||||
@@ -135,9 +135,9 @@ class BoxController extends Controller
|
||||
{
|
||||
// Cache result, return cache if present.
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
$start = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
@@ -216,12 +216,12 @@ class BoxController extends Controller
|
||||
*/
|
||||
public function netWorth(): JsonResponse
|
||||
{
|
||||
$date = Carbon::now()->endOfDay();
|
||||
$date = today(config('app.timezone'))->endOfDay();
|
||||
|
||||
// start and end in the future? use $end
|
||||
if ($this->notInSessionRange($date)) {
|
||||
/** @var Carbon $date */
|
||||
$date = session('end', Carbon::now()->endOfMonth());
|
||||
$date = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
}
|
||||
|
||||
/** @var NetWorthInterface $netWorthHelper */
|
||||
|
||||
@@ -152,7 +152,7 @@ class RecurrenceController extends Controller
|
||||
{
|
||||
$request->validate(['date' => ['required', 'date'],]);
|
||||
$string = $request->get('date') ?? date('Y-m-d');
|
||||
$today = Carbon::now()->startOfDay();
|
||||
$today = today(config('app.timezone'))->startOfDay();
|
||||
$date = Carbon::createFromFormat('Y-m-d', $string)->startOfDay();
|
||||
$preSelected = (string)$request->get('pre_select');
|
||||
$locale = app('steam')->getLocale();
|
||||
|
||||
@@ -87,7 +87,7 @@ class IndexController extends Controller
|
||||
$collection = $this->piggyRepos->getPiggyBanks();
|
||||
$accounts = [];
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
|
||||
// transform piggies using the transformer:
|
||||
$parameters = new ParameterBag();
|
||||
|
||||
@@ -71,7 +71,7 @@ class ShowController extends Controller
|
||||
public function show(PiggyBank $piggyBank)
|
||||
{
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
// transform piggies using the transformer:
|
||||
$parameters = new ParameterBag();
|
||||
$parameters->set('end', $end);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -68,7 +68,7 @@ class TriggerController extends Controller
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($group->transactionJournals as $journal) {
|
||||
Log::debug(sprintf('Set date of journal #%d to today!', $journal->id));
|
||||
$journal->date = Carbon::today();
|
||||
$journal->date = today(config('app.timezone'));
|
||||
$journal->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,8 +118,8 @@ class SelectController extends Controller
|
||||
return redirect(route('rules.index'));
|
||||
}
|
||||
// does the user have shared accounts?
|
||||
$first = session('first', Carbon::now()->subYear())->format('Y-m-d');
|
||||
$today = Carbon::now()->format('Y-m-d');
|
||||
$first = session('first', today(config('app.timezone'))->subYear())->format('Y-m-d');
|
||||
$today = today(config('app.timezone'))->format('Y-m-d');
|
||||
$subTitle = (string)trans('firefly.apply_rule_selection', ['title' => $rule->title]);
|
||||
|
||||
return view('rules.rule.select-transactions', compact('first', 'today', 'rule', 'subTitle'));
|
||||
|
||||
@@ -110,7 +110,7 @@ class ExecutionController extends Controller
|
||||
public function selectTransactions(RuleGroup $ruleGroup)
|
||||
{
|
||||
$first = session('first')->format('Y-m-d');
|
||||
$today = Carbon::now()->format('Y-m-d');
|
||||
$today = today(config('app.timezone'))->format('Y-m-d');
|
||||
$subTitle = (string)trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);
|
||||
|
||||
return view('rules.rule-group.select-transactions', compact('first', 'today', 'ruleGroup', 'subTitle'));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -194,7 +194,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
$today = today(config('app.timezone'));
|
||||
$tomorrow = Carbon::now()->addDay();
|
||||
$tomorrow = today(config('app.timezone'))->addDay();
|
||||
$rules = [
|
||||
// mandatory info for recurrence.
|
||||
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
||||
|
||||
@@ -47,7 +47,7 @@ class SelectTransactionsRequest extends FormRequest
|
||||
/** @var Carbon $sessionFirst */
|
||||
$sessionFirst = clone session('first');
|
||||
$first = $sessionFirst->subDay()->format('Y-m-d');
|
||||
$today = Carbon::now()->addDay()->format('Y-m-d');
|
||||
$today = today(config('app.timezone'))->addDay()->format('Y-m-d');
|
||||
|
||||
return [
|
||||
'start' => 'required|date|after:'.$first,
|
||||
|
||||
@@ -357,7 +357,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
return $savePerMonth;
|
||||
}
|
||||
if (null !== $piggyBank->targetdate && $repetition->currentamount < $piggyBank->targetamount) {
|
||||
$now = Carbon::now();
|
||||
$now = today(config('app.timezone'));
|
||||
$startDate = null !== $piggyBank->startdate && $piggyBank->startdate->gte($now) ? $piggyBank->startdate : $now;
|
||||
$diffInMonths = $startDate->diffInMonths($piggyBank->targetdate, false);
|
||||
$remainingAmount = bcsub($piggyBank->targetamount, $repetition->currentamount);
|
||||
|
||||
@@ -534,7 +534,7 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
}
|
||||
if ('yearly' === $repetition->repetition_type) {
|
||||
//
|
||||
$today = Carbon::now()->endOfYear();
|
||||
$today = today(config('app.timezone'))->endOfYear();
|
||||
$repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
|
||||
$diffInYears = $today->diffInYears($repDate);
|
||||
$repDate->addYears($diffInYears); // technically not necessary.
|
||||
|
||||
@@ -282,7 +282,7 @@ class UserRepository implements UserRepositoryInterface
|
||||
*/
|
||||
public function inviteUser(User $user, string $email): InvitedUser
|
||||
{
|
||||
$now = Carbon::now();
|
||||
$now = today(config('app.timezone'));
|
||||
$now->addDays(2);
|
||||
$invitee = new InvitedUser();
|
||||
$invitee->user()->associate($user);
|
||||
@@ -463,7 +463,7 @@ class UserRepository implements UserRepositoryInterface
|
||||
*/
|
||||
public function validateInviteCode(string $code): bool
|
||||
{
|
||||
$now = Carbon::now();
|
||||
$now = today(config('app.timezone'));
|
||||
$invitee = InvitedUser::where('invite_code', $code)->where('expires', '>', $now->format('Y-m-d H:i:s'))->where('redeemed', 0)->first();
|
||||
return null !== $invitee;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
// always fall back to current version:
|
||||
$return = [
|
||||
'version' => config('firefly.version'),
|
||||
'date' => Carbon::today()->startOfDay(),
|
||||
'date' => today(config('app.timezone'))->startOfDay(),
|
||||
'level' => 'error',
|
||||
'message' => (string)trans('firefly.unknown_error'),
|
||||
];
|
||||
@@ -171,7 +171,7 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
// a newer version is available!
|
||||
/** @var Carbon $released */
|
||||
$released = $information['date'];
|
||||
$today = Carbon::today()->startOfDay();
|
||||
$today = today(config('app.timezone'))->startOfDay();
|
||||
$diff = $today->diffInDays($released);
|
||||
$expectedDiff = config('firefly.update_minimum_age') ?? 6;
|
||||
// it's still very fresh, and user wants a stable release:
|
||||
|
||||
@@ -65,7 +65,7 @@ class GroupCloneService
|
||||
{
|
||||
$newJournal = $journal->replicate();
|
||||
$newJournal->transaction_group_id = $newGroup->id;
|
||||
$newJournal->date = Carbon::now();
|
||||
$newJournal->date = today(config('app.timezone'));
|
||||
$newJournal->save();
|
||||
|
||||
foreach ($journal->transactions as $transaction) {
|
||||
|
||||
@@ -48,20 +48,20 @@ class Date implements BinderInterface
|
||||
$fiscalHelper = app(FiscalHelperInterface::class);
|
||||
|
||||
$magicWords = [
|
||||
'currentMonthStart' => Carbon::now()->startOfMonth(),
|
||||
'currentMonthEnd' => Carbon::now()->endOfMonth(),
|
||||
'currentYearStart' => Carbon::now()->startOfYear(),
|
||||
'currentYearEnd' => Carbon::now()->endOfYear(),
|
||||
'currentMonthStart' => today(config('app.timezone'))->startOfMonth(),
|
||||
'currentMonthEnd' => today(config('app.timezone'))->endOfMonth(),
|
||||
'currentYearStart' => today(config('app.timezone'))->startOfYear(),
|
||||
'currentYearEnd' => today(config('app.timezone'))->endOfYear(),
|
||||
|
||||
'previousMonthStart' => Carbon::now()->startOfMonth()->subDay()->startOfMonth(),
|
||||
'previousMonthEnd' => Carbon::now()->startOfMonth()->subDay()->endOfMonth(),
|
||||
'previousYearStart' => Carbon::now()->startOfYear()->subDay()->startOfYear(),
|
||||
'previousYearEnd' => Carbon::now()->startOfYear()->subDay()->endOfYear(),
|
||||
'previousMonthStart' => today(config('app.timezone'))->startOfMonth()->subDay()->startOfMonth(),
|
||||
'previousMonthEnd' => today(config('app.timezone'))->startOfMonth()->subDay()->endOfMonth(),
|
||||
'previousYearStart' => today(config('app.timezone'))->startOfYear()->subDay()->startOfYear(),
|
||||
'previousYearEnd' => today(config('app.timezone'))->startOfYear()->subDay()->endOfYear(),
|
||||
|
||||
'currentFiscalYearStart' => $fiscalHelper->startOfFiscalYear(Carbon::now()),
|
||||
'currentFiscalYearEnd' => $fiscalHelper->endOfFiscalYear(Carbon::now()),
|
||||
'previousFiscalYearStart' => $fiscalHelper->startOfFiscalYear(Carbon::now())->subYear(),
|
||||
'previousFiscalYearEnd' => $fiscalHelper->endOfFiscalYear(Carbon::now())->subYear(),
|
||||
'currentFiscalYearStart' => $fiscalHelper->startOfFiscalYear(today(config('app.timezone'))),
|
||||
'currentFiscalYearEnd' => $fiscalHelper->endOfFiscalYear(today(config('app.timezone'))),
|
||||
'previousFiscalYearStart' => $fiscalHelper->startOfFiscalYear(today(config('app.timezone')))->subYear(),
|
||||
'previousFiscalYearEnd' => $fiscalHelper->endOfFiscalYear(today(config('app.timezone')))->subYear(),
|
||||
];
|
||||
if (array_key_exists($value, $magicWords)) {
|
||||
$return = $magicWords[$value];
|
||||
|
||||
@@ -43,7 +43,7 @@ class AutoBudgetCronjob extends AbstractCronjob
|
||||
$config = app('fireflyconfig')->get('last_ab_job', 0);
|
||||
$lastTime = (int)$config->data;
|
||||
$diff = time() - $lastTime;
|
||||
$diffForHumans = Carbon::now()->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true);
|
||||
$diffForHumans = today(config('app.timezone'))->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true);
|
||||
if (0 === $lastTime) {
|
||||
Log::info('Auto budget cron-job has never fired before.');
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class BillWarningCronjob extends AbstractCronjob
|
||||
$config = app('fireflyconfig')->get('last_bw_job', 0);
|
||||
$lastTime = (int)$config->data;
|
||||
$diff = time() - $lastTime;
|
||||
$diffForHumans = Carbon::now()->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true);
|
||||
$diffForHumans = today(config('app.timezone'))->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true);
|
||||
|
||||
if (0 === $lastTime) {
|
||||
Log::info('The bill warning cron-job has never fired before.');
|
||||
|
||||
@@ -43,7 +43,7 @@ class ExchangeRatesCronjob extends AbstractCronjob
|
||||
$config = app('fireflyconfig')->get('last_cer_job', 0);
|
||||
$lastTime = (int)$config->data;
|
||||
$diff = time() - $lastTime;
|
||||
$diffForHumans = Carbon::now()->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true);
|
||||
$diffForHumans = today(config('app.timezone'))->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true);
|
||||
if (0 === $lastTime) {
|
||||
Log::info('Exchange rates cron-job has never fired before.');
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class RecurringCronjob extends AbstractCronjob
|
||||
$config = app('fireflyconfig')->get('last_rt_job', 0);
|
||||
$lastTime = (int)$config->data;
|
||||
$diff = time() - $lastTime;
|
||||
$diffForHumans = Carbon::now()->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true);
|
||||
$diffForHumans = today(config('app.timezone'))->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true);
|
||||
|
||||
if (0 === $lastTime) {
|
||||
Log::info('Recurring transactions cron-job has never fired before.');
|
||||
|
||||
@@ -158,7 +158,7 @@ trait ConvertsExchangeRates
|
||||
private function convertAmount(string $amount, TransactionCurrency $from, TransactionCurrency $to, ?Carbon $date = null): string
|
||||
{
|
||||
Log::debug(sprintf('Converting %s from %s to %s', $amount, $from->code, $to->code));
|
||||
$date = $date ?? Carbon::now();
|
||||
$date = $date ?? today(config('app.timezone'));
|
||||
$rate = $this->getRate($from, $to, $date);
|
||||
|
||||
return bcmul($amount, $rate);
|
||||
|
||||
@@ -45,7 +45,7 @@ trait DateCalculation
|
||||
public function activeDaysLeft(Carbon $start, Carbon $end): int
|
||||
{
|
||||
$difference = $start->diffInDays($end) + 1;
|
||||
$today = Carbon::now()->startOfDay();
|
||||
$today = today(config('app.timezone'))->startOfDay();
|
||||
|
||||
if ($start->lte($today) && $end->gte($today)) {
|
||||
$difference = $today->diffInDays($end);
|
||||
@@ -67,7 +67,7 @@ trait DateCalculation
|
||||
protected function activeDaysPassed(Carbon $start, Carbon $end): int
|
||||
{
|
||||
$difference = $start->diffInDays($end) + 1;
|
||||
$today = Carbon::now()->startOfDay();
|
||||
$today = today(config('app.timezone'))->startOfDay();
|
||||
|
||||
if ($start->lte($today) && $end->gte($today)) {
|
||||
$difference = $start->diffInDays($today) + 1;
|
||||
|
||||
@@ -95,7 +95,7 @@ trait GetConfigurationData
|
||||
*/
|
||||
protected function getDateRangeConfig(): array // get configuration + get preferences.
|
||||
{
|
||||
$viewRange = (string)app('preferences')->get('viewRange', '1M')->data;
|
||||
$viewRange = app('navigation')->getViewRange(false);
|
||||
/** @var Carbon $start */
|
||||
$start = session('start');
|
||||
/** @var Carbon $end */
|
||||
@@ -117,18 +117,20 @@ trait GetConfigurationData
|
||||
$customPeriodEnd = app('navigation')->endOfPeriod($customPeriodStart, $viewRange);
|
||||
$ranges[$index] = [$customPeriodStart, $customPeriodEnd];
|
||||
}
|
||||
// then add previous range and next range
|
||||
$previousDate = app('navigation')->subtractPeriod($start, $viewRange);
|
||||
$index = app('navigation')->periodShow($previousDate, $viewRange);
|
||||
$previousStart = app('navigation')->startOfPeriod($previousDate, $viewRange);
|
||||
$previousEnd = app('navigation')->endOfPeriod($previousStart, $viewRange);
|
||||
$ranges[$index] = [$previousStart, $previousEnd];
|
||||
// then add previous range and next range, but skip this for the lastX and YTD stuff.
|
||||
if (!in_array($viewRange, config('firefly.dynamic_date_ranges', []), true)) {
|
||||
$previousDate = app('navigation')->subtractPeriod($start, $viewRange);
|
||||
$index = app('navigation')->periodShow($previousDate, $viewRange);
|
||||
$previousStart = app('navigation')->startOfPeriod($previousDate, $viewRange);
|
||||
$previousEnd = app('navigation')->endOfPeriod($previousStart, $viewRange);
|
||||
$ranges[$index] = [$previousStart, $previousEnd];
|
||||
|
||||
$nextDate = app('navigation')->addPeriod($start, $viewRange, 0);
|
||||
$index = app('navigation')->periodShow($nextDate, $viewRange);
|
||||
$nextStart = app('navigation')->startOfPeriod($nextDate, $viewRange);
|
||||
$nextEnd = app('navigation')->endOfPeriod($nextStart, $viewRange);
|
||||
$ranges[$index] = [$nextStart, $nextEnd];
|
||||
$nextDate = app('navigation')->addPeriod($start, $viewRange, 0);
|
||||
$index = app('navigation')->periodShow($nextDate, $viewRange);
|
||||
$nextStart = app('navigation')->startOfPeriod($nextDate, $viewRange);
|
||||
$nextEnd = app('navigation')->endOfPeriod($nextStart, $viewRange);
|
||||
$ranges[$index] = [$nextStart, $nextEnd];
|
||||
}
|
||||
|
||||
// today:
|
||||
/** @var Carbon $todayStart */
|
||||
@@ -140,22 +142,22 @@ trait GetConfigurationData
|
||||
}
|
||||
|
||||
// last seven days:
|
||||
$seven = Carbon::now()->subDays(7);
|
||||
$seven = today(config('app.timezone'))->subDays(7);
|
||||
$index = (string)trans('firefly.last_seven_days');
|
||||
$ranges[$index] = [$seven, new Carbon()];
|
||||
|
||||
// last 30 days:
|
||||
$thirty = Carbon::now()->subDays(30);
|
||||
$thirty = today(config('app.timezone'))->subDays(30);
|
||||
$index = (string)trans('firefly.last_thirty_days');
|
||||
$ranges[$index] = [$thirty, new Carbon()];
|
||||
|
||||
// month to date:
|
||||
$monthBegin = Carbon::now()->startOfMonth();
|
||||
$monthBegin = today(config('app.timezone'))->startOfMonth();
|
||||
$index = (string)trans('firefly.month_to_date');
|
||||
$ranges[$index] = [$monthBegin, new Carbon()];
|
||||
|
||||
// year to date:
|
||||
$yearBegin = Carbon::now()->startOfYear();
|
||||
$yearBegin = today(config('app.timezone'))->startOfYear();
|
||||
$index = (string)trans('firefly.year_to_date');
|
||||
$ranges[$index] = [$yearBegin, new Carbon()];
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ trait PeriodOverview
|
||||
*/
|
||||
protected function getAccountPeriodOverview(Account $account, Carbon $start, Carbon $end): array
|
||||
{
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(true);
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
|
||||
// properties for cache
|
||||
@@ -95,7 +95,7 @@ trait PeriodOverview
|
||||
$cache->addProperty('account-show-period-entries');
|
||||
$cache->addProperty($account->id);
|
||||
if ($cache->has()) {
|
||||
// return $cache->get();
|
||||
return $cache->get();
|
||||
}
|
||||
/** @var array $dates */
|
||||
$dates = app('navigation')->blockPeriods($start, $end, $range);
|
||||
@@ -276,7 +276,7 @@ trait PeriodOverview
|
||||
*/
|
||||
protected function getCategoryPeriodOverview(Category $category, Carbon $start, Carbon $end): array
|
||||
{
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(true);
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
|
||||
// properties for entries with their amounts.
|
||||
@@ -356,7 +356,7 @@ trait PeriodOverview
|
||||
*/
|
||||
protected function getNoBudgetPeriodOverview(Carbon $start, Carbon $end): array
|
||||
{
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(true);
|
||||
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
|
||||
@@ -412,7 +412,7 @@ trait PeriodOverview
|
||||
protected function getNoCategoryPeriodOverview(Carbon $theDate): array
|
||||
{
|
||||
Log::debug(sprintf('Now in getNoCategoryPeriodOverview(%s)', $theDate->format('Y-m-d')));
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(true);
|
||||
$first = $this->journalRepos->firstNull();
|
||||
$start = null === $first ? new Carbon() : $first->date;
|
||||
$end = clone $theDate;
|
||||
@@ -483,7 +483,7 @@ trait PeriodOverview
|
||||
*/
|
||||
protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags.
|
||||
{
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(true);
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
|
||||
// properties for cache
|
||||
@@ -558,7 +558,7 @@ trait PeriodOverview
|
||||
*/
|
||||
protected function getTransactionPeriodOverview(string $transactionType, Carbon $start, Carbon $end): array
|
||||
{
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
$range = app('navigation')->getViewRange(true);
|
||||
$types = config(sprintf('firefly.transactionTypesByType.%s', $transactionType));
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
|
||||
|
||||
@@ -145,9 +145,9 @@ trait RequestInformation
|
||||
final protected function notInSessionRange(Carbon $date): bool // Validate a preference
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$start = session('start', Carbon::now()->startOfMonth());
|
||||
$start = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', Carbon::now()->endOfMonth());
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$result = false;
|
||||
if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) {
|
||||
$result = true;
|
||||
@@ -175,7 +175,7 @@ trait RequestInformation
|
||||
$attributes['startDate'] = Carbon::createFromFormat('Ymd', $attributes['startDate'])->startOfDay();
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
|
||||
$date = Carbon::now()->startOfMonth();
|
||||
$date = today(config('app.timezone'))->startOfMonth();
|
||||
$attributes['startDate'] = $date;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ trait RequestInformation
|
||||
$attributes['endDate'] = Carbon::createFromFormat('Ymd', $attributes['endDate'])->endOfDay();
|
||||
} catch (InvalidArgumentException $e) {
|
||||
Log::debug(sprintf('Not important error message: %s', $e->getMessage()));
|
||||
$date = Carbon::now()->startOfMonth();
|
||||
$date = today(config('app.timezone'))->startOfMonth();
|
||||
$attributes['endDate'] = $date;
|
||||
}
|
||||
|
||||
|
||||
@@ -255,9 +255,9 @@ class Navigation
|
||||
// and end added to $theCurrentEnd
|
||||
if ('custom' === $repeatFreq) {
|
||||
/** @var Carbon $tStart */
|
||||
$tStart = session('start', Carbon::now()->startOfMonth());
|
||||
$tStart = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $tEnd */
|
||||
$tEnd = session('end', Carbon::now()->endOfMonth());
|
||||
$tEnd = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$diffInDays = $tStart->diffInDays($tEnd);
|
||||
$currentEnd->addDays($diffInDays);
|
||||
|
||||
@@ -428,6 +428,35 @@ class Navigation
|
||||
return $date->format('Y-m-d');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user's view range and if necessary, corrects the dynamic view
|
||||
* range to a normal range.
|
||||
* @param bool $correct
|
||||
* @return string
|
||||
*/
|
||||
public function getViewRange(bool $correct): string
|
||||
{
|
||||
$range = (string)app('preferences')->get('viewRange', '1M')?->data ?? '1M';
|
||||
if (!$correct) {
|
||||
return $range;
|
||||
}
|
||||
switch ($range) {
|
||||
default:
|
||||
return $range;
|
||||
case 'last7':
|
||||
return '1W';
|
||||
case 'last30':
|
||||
case 'MTD':
|
||||
return '1M';
|
||||
case 'last90':
|
||||
case 'QTD':
|
||||
return '3M';
|
||||
case 'last365':
|
||||
case 'YTD':
|
||||
return '1Y';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the date difference between start and end is less than a month, method returns trans(config.month_and_day). If the difference is less than a year,
|
||||
* method returns "config.month". If the date difference is larger, method returns "config.year".
|
||||
@@ -573,9 +602,9 @@ class Navigation
|
||||
// this is then subtracted from $theDate (* $subtract).
|
||||
if ('custom' === $repeatFreq) {
|
||||
/** @var Carbon $tStart */
|
||||
$tStart = session('start', Carbon::now()->startOfMonth());
|
||||
$tStart = session('start', today(config('app.timezone'))->startOfMonth());
|
||||
/** @var Carbon $tEnd */
|
||||
$tEnd = session('end', Carbon::now()->endOfMonth());
|
||||
$tEnd = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$diffInDays = $tStart->diffInDays($tEnd);
|
||||
$date->subDays($diffInDays * $subtract);
|
||||
|
||||
@@ -621,6 +650,7 @@ class Navigation
|
||||
*/
|
||||
public function updateEndDate(string $range, Carbon $start): Carbon
|
||||
{
|
||||
Log::debug(sprintf('updateEndDate("%s", "%s")', $range, $start->format('Y-m-d')));
|
||||
$functionMap = [
|
||||
'1D' => 'endOfDay',
|
||||
'1W' => 'endOfWeek',
|
||||
@@ -664,6 +694,9 @@ class Navigation
|
||||
'MTD',
|
||||
];
|
||||
if (in_array($range, $list, true)) {
|
||||
$end = today(config('app.timezone'));
|
||||
$end->endOfDay();
|
||||
Log::debug(sprintf('updateEndDate returns "%s"', $end->format('Y-m-d')));
|
||||
return $end;
|
||||
}
|
||||
|
||||
@@ -680,6 +713,7 @@ class Navigation
|
||||
*/
|
||||
public function updateStartDate(string $range, Carbon $start): Carbon
|
||||
{
|
||||
Log::debug(sprintf('updateStartDate("%s", "%s")', $range, $start->format('Y-m-d')));
|
||||
$functionMap = [
|
||||
'1D' => 'startOfDay',
|
||||
'1W' => 'startOfWeek',
|
||||
|
||||
@@ -128,7 +128,7 @@ class ParseDateString
|
||||
*/
|
||||
protected function parseKeyword(string $keyword): Carbon
|
||||
{
|
||||
$today = Carbon::today()->startOfDay();
|
||||
$today = today(config('app.timezone'))->startOfDay();
|
||||
|
||||
return match ($keyword) {
|
||||
default => $today,
|
||||
@@ -164,7 +164,7 @@ class ParseDateString
|
||||
{
|
||||
Log::debug(sprintf('Now in parseRelativeDate("%s")', $date));
|
||||
$parts = explode(' ', $date);
|
||||
$today = Carbon::today()->startOfDay();
|
||||
$today = today(config('app.timezone'))->startOfDay();
|
||||
$functions = [
|
||||
[
|
||||
'd' => 'subDays',
|
||||
|
||||
@@ -67,7 +67,7 @@ class General extends AbstractExtension
|
||||
return '0';
|
||||
}
|
||||
/** @var Carbon $date */
|
||||
$date = session('end', Carbon::now()->endOfMonth());
|
||||
$date = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
|
||||
return app('steam')->balance($account, $date);
|
||||
}
|
||||
|
||||
@@ -878,6 +878,9 @@ return [
|
||||
'valid_cc_fields' => ['account_role', 'cc_monthly_payment_date', 'cc_type', 'account_number', 'currency_id', 'BIC', 'include_net_worth'],
|
||||
'valid_account_fields' => ['account_number', 'currency_id', 'BIC', 'interest', 'interest_period', 'include_net_worth', 'liability_direction'],
|
||||
|
||||
// dynamic date ranges are as follows:
|
||||
'dynamic_date_ranges' => ['last7', 'last30', 'last90', 'last365', 'MTD', 'QTD', 'YTD'],
|
||||
|
||||
// only used in v1
|
||||
'allowed_sort_parameters' => ['order', 'name', 'iban'],
|
||||
];
|
||||
|
||||
@@ -193,6 +193,14 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="viewRange"
|
||||
value="last7" {% if viewRange == 'last7' %} checked {% endif %}>
|
||||
{{ 'pref_last7'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="viewRange"
|
||||
@@ -200,6 +208,20 @@
|
||||
{{ 'pref_1M'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="viewRange"
|
||||
value="last30" {% if viewRange == 'last30' %} checked {% endif %}>
|
||||
{{ 'pref_last30'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="viewRange"
|
||||
value="MTD" {% if viewRange == 'MTD' %} checked {% endif %}>
|
||||
{{ 'pref_MTD'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
@@ -208,6 +230,20 @@
|
||||
{{ 'pref_3M'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="viewRange"
|
||||
value="last90" {% if viewRange == 'last90' %} checked {% endif %}>
|
||||
{{ 'pref_last90'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="viewRange"
|
||||
value="QTD" {% if viewRange == 'QTD' %} checked {% endif %}>
|
||||
{{ 'pref_QTD'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="radio">
|
||||
<label>
|
||||
@@ -223,6 +259,20 @@
|
||||
{{ 'pref_1Y'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="viewRange"
|
||||
value="YTD" {% if viewRange == 'YTD' %} checked {% endif %}>
|
||||
{{ 'pref_YTD'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="viewRange"
|
||||
value="last365" {% if viewRange == 'last365' %} checked {% endif %}>
|
||||
{{ 'pref_last365'|_ }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user