mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-14 09:54:09 +00:00
Compare commits
7 Commits
develop-20
...
develop-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c1b550c2c | ||
|
|
94a25d3137 | ||
|
|
be87a24b8f | ||
|
|
f6032d5502 | ||
|
|
7dcfb68fca | ||
|
|
419c796eac | ||
|
|
1d5733adba |
91
app/Console/Commands/Explain/ExplainAvailableBudget.php
Normal file
91
app/Console/Commands/Explain/ExplainAvailableBudget.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* ExplainAvailableBudget.php
|
||||
* Copyright (c) 2026 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Console\Commands\Explain;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use FireflyIII\Console\Commands\VerifiesAccessToken;
|
||||
use FireflyIII\Support\Facades\Navigation;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ExplainAvailableBudget extends Command
|
||||
{
|
||||
use VerifiesAccessToken;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'explain:available-budget
|
||||
{--date=now : A date formatted YYYY-MM-DD or the word "now"}
|
||||
{--user=1 : The user ID.}
|
||||
{--token= : The user\'s access token.}
|
||||
';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Explains why the available budget amount is what it is.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$date = $this->getDate((string) $this->option('date'));
|
||||
$range = Preferences::getForUser($this->getUser(), 'viewRange', '1M')->data ?? '1M';
|
||||
$title = Navigation::periodShow($date, $range);
|
||||
$this->line('This command explains why the "available" budget bar at the top of your /budget bar means.');
|
||||
$this->line(sprintf(
|
||||
'You submitted date %s and your settings show a %s period, so this explanation concerns the period "%s".',
|
||||
$date->format('Y-m-d'),
|
||||
$range,
|
||||
$title
|
||||
));
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
private function getDate(string $param): Carbon
|
||||
{
|
||||
if ('now' === $param) {
|
||||
return today();
|
||||
}
|
||||
|
||||
try {
|
||||
$date = Carbon::parse($param);
|
||||
} catch (InvalidFormatException) {
|
||||
$this->warn('Invalid date given. Fall back to today\'s date.');
|
||||
|
||||
return today();
|
||||
}
|
||||
|
||||
return $date;
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class AvailableBudget extends Model
|
||||
protected function endDate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: Carbon::parse(...),
|
||||
get: static fn (string $value): Carbon => Carbon::parse($value),
|
||||
set: static fn (Carbon $value): string => $value->format('Y-m-d'),
|
||||
);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ class AvailableBudget extends Model
|
||||
protected function startDate(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: Carbon::parse(...),
|
||||
get: static fn (string $value): Carbon => Carbon::parse($value),
|
||||
set: static fn (Carbon $value): string => $value->format('Y-m-d'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ return [
|
||||
'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used.
|
||||
// see cer.php for exchange rates feature flag.
|
||||
],
|
||||
'version' => 'develop/2026-01-13',
|
||||
'build_time' => 1768333193,
|
||||
'version' => 'develop/2026-01-14',
|
||||
'build_time' => 1768366713,
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 28, // field is no longer used.
|
||||
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -3834,9 +3834,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/alpinejs": {
|
||||
"version": "3.15.3",
|
||||
"resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.15.3.tgz",
|
||||
"integrity": "sha512-fSI6F5213FdpMC4IWaup92KhuH3jBX0VVqajRJ6cOTCy1cL6888KyXdGO+seAAkn+g6fnrxBqQEx6gRpQ5EZoQ==",
|
||||
"version": "3.15.4",
|
||||
"resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.15.4.tgz",
|
||||
"integrity": "sha512-lDpOdoVo0bhFjgl310k1qw3kbpUYwM/v0WByvAchsO93bl3o1rrgr0P/ssx3CimwEtNfXbmwKbtHbqTRCTTH9g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "~3.1.1"
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
"submission_options": "Op\u0163iuni de depunere",
|
||||
"apply_rules_checkbox": "Aplic\u0103 regulile",
|
||||
"fire_webhooks_checkbox": "Webhook-uri de incendiu",
|
||||
"no_budget_pointer": "Se pare c\u0103 nu ave\u021bi \u00eenc\u0103 bugete. Ar trebui s\u0103 crea\u021bi c\u00e2teva pe pagina <a href=\"\/budgets\">bugete<\/a>. Bugetele v\u0103 pot ajuta s\u0103 \u021bine\u021bi eviden\u021ba cheltuielilor.",
|
||||
"no_bill_pointer": "You seem to have no subscription yet. You should create some on the <a href=\"subscriptions\">subscription<\/a>-page. Subscriptions can help you keep track of expenses.",
|
||||
"no_budget_pointer": "Se pare c\u0103 nu ai \u00eenc\u0103 bugete. Creeaz\u0103-le pe pagina <a href=\"budgets\">bugete<\/a>. Bugetele te ajut\u0103 s\u0103 \u021bii eviden\u021ba cheltuielilor.",
|
||||
"no_bill_pointer": "Se pare c\u0103 nu ai \u00eenc\u0103 abonamente. Creeaz\u0103-le pe pagina <a href=\"subscriptions\">abonamente<\/a>. Abonamentele te ajut\u0103 s\u0103 \u021bii eviden\u021ba cheltuielilor.",
|
||||
"source_account": "Contul surs\u0103",
|
||||
"hidden_fields_preferences": "Pute\u021bi activa mai multe op\u021biuni de tranzac\u021bie \u00een <a href=\"preferences\">preferin\u021bele<\/a> dvs.",
|
||||
"destination_account": "Contul de destina\u021bie",
|
||||
@@ -189,6 +189,6 @@
|
||||
},
|
||||
"config": {
|
||||
"html_language": "ro",
|
||||
"date_time_fns": "MMMM do yyy @ HH:mm:ss"
|
||||
"date_time_fns": "MMMM do yyyy @ HH:mm:ss"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user