mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-20 13:29:17 +00:00
Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
340540bd5a | ||
|
|
c63f4a941b | ||
|
|
7491cb5f58 | ||
|
|
31c1e28c76 | ||
|
|
0ece35feca | ||
|
|
3b8caba37c | ||
|
|
8e729d6bbf | ||
|
|
0f0cdb8e96 | ||
|
|
b0cc5f3a46 | ||
|
|
71c5bdb198 | ||
|
|
be9078fe99 | ||
|
|
d235e32c34 | ||
|
|
e34b89da08 | ||
|
|
f5428595d5 | ||
|
|
87cb1e1a2b | ||
|
|
22448a825b | ||
|
|
476a9ac6e4 | ||
|
|
0acd07405b | ||
|
|
1daacb80b1 | ||
|
|
2bf841627a | ||
|
|
012df6bb24 | ||
|
|
486e0d5ed5 | ||
|
|
e8fe9db181 | ||
|
|
05f0cb26f8 | ||
|
|
bdaed65207 | ||
|
|
62a9195acc | ||
|
|
40d1e36ba8 | ||
|
|
61a8525d26 | ||
|
|
ef01fbe5f4 | ||
|
|
9413f49c84 | ||
|
|
d9ae99b5fe | ||
|
|
45d2d86bba | ||
|
|
e21d5e5d01 | ||
|
|
8781e2a870 | ||
|
|
9e4bfd9d1a | ||
|
|
d61d6aa2e2 | ||
|
|
230a3a0180 | ||
|
|
002454b995 | ||
|
|
e6d9c2e218 | ||
|
|
eaa5054b00 | ||
|
|
4e9e63ed08 | ||
|
|
76ea5b6e34 | ||
|
|
2f788f7397 | ||
|
|
29766aa9b7 | ||
|
|
cc30376297 | ||
|
|
5b007fbe01 | ||
|
|
e1f8ea3b1a | ||
|
|
6f019f0bb4 | ||
|
|
f475947776 | ||
|
|
ee6901eb92 | ||
|
|
84d7523d6c | ||
|
|
6900dc7dae | ||
|
|
6247e516c6 | ||
|
|
cdf970a88c | ||
|
|
a447c387f9 | ||
|
|
ce2c94efed | ||
|
|
205ea4270b | ||
|
|
dcbb2428f2 | ||
|
|
319916fc8f | ||
|
|
088b0e2f30 |
13
.ci/php-cs-fixer/composer.lock
generated
13
.ci/php-cs-fixer/composer.lock
generated
@@ -402,16 +402,16 @@
|
||||
},
|
||||
{
|
||||
"name": "friendsofphp/php-cs-fixer",
|
||||
"version": "v3.92.0",
|
||||
"version": "v3.92.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
||||
"reference": "5646c2cd99b7cb4b658ff681fe27069ba86c7280"
|
||||
"reference": "2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/5646c2cd99b7cb4b658ff681fe27069ba86c7280",
|
||||
"reference": "5646c2cd99b7cb4b658ff681fe27069ba86c7280",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8",
|
||||
"reference": "2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -451,6 +451,7 @@
|
||||
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6",
|
||||
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6",
|
||||
"phpunit/phpunit": "^9.6.25 || ^10.5.53 || ^11.5.34",
|
||||
"symfony/polyfill-php85": "^1.33",
|
||||
"symfony/var-dumper": "^5.4.48 || ^6.4.24 || ^7.3.2 || ^8.0",
|
||||
"symfony/yaml": "^5.4.45 || ^6.4.24 || ^7.3.2 || ^8.0"
|
||||
},
|
||||
@@ -493,7 +494,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.0"
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -501,7 +502,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-12-12T10:29:19+00:00"
|
||||
"time": "2025-12-18T10:45:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
|
||||
56
.env.example
56
.env.example
@@ -188,39 +188,11 @@ MAILERSEND_API_KEY=
|
||||
# Firefly III can send you the following messages.
|
||||
SEND_ERROR_MESSAGE=true
|
||||
|
||||
# These messages contain (sensitive) transaction information:
|
||||
SEND_REPORT_JOURNALS=true
|
||||
|
||||
# Set this value to true if you want to set the location of certain things, like transactions.
|
||||
# Since this involves an external service, it's optional and disabled by default.
|
||||
ENABLE_EXTERNAL_MAP=false
|
||||
|
||||
#
|
||||
# Enable or disable exchange rate conversion.
|
||||
#
|
||||
ENABLE_EXCHANGE_RATES=false
|
||||
|
||||
# Set this value to true if you want Firefly III to download currency exchange rates
|
||||
# from the internet. These rates are hosted by the creator of Firefly III inside
|
||||
# an Azure Storage Container.
|
||||
# Not all currencies may be available. Rates may be wrong.
|
||||
ENABLE_EXTERNAL_RATES=false
|
||||
|
||||
# The map will default to this location:
|
||||
MAP_DEFAULT_LAT=51.983333
|
||||
MAP_DEFAULT_LONG=5.916667
|
||||
MAP_DEFAULT_ZOOM=6
|
||||
|
||||
#
|
||||
# Some objects have room for an URL, like transactions and webhooks.
|
||||
# By default, the following protocols are allowed:
|
||||
# http, https, ftp, ftps, mailto
|
||||
#
|
||||
# To change this, set your preferred comma separated set below.
|
||||
# Be sure to include http, https and other default ones if you need to.
|
||||
#
|
||||
VALID_URL_PROTOCOLS=
|
||||
|
||||
#
|
||||
# Firefly III authentication settings
|
||||
#
|
||||
@@ -275,21 +247,6 @@ DISABLE_CSP_HEADER=false
|
||||
TRACKER_SITE_ID=
|
||||
TRACKER_URL=
|
||||
|
||||
#
|
||||
# You can automatically submit errors to the Firefly III developer using sentry.io
|
||||
#
|
||||
# This is entirely optional of course. If you run into errors, I will gladly accept GitHub
|
||||
# issues or a forwared email message.
|
||||
#
|
||||
# If you set this to true, your installation will try to contact sentry.io when it runs into errors.
|
||||
#
|
||||
REPORT_ERRORS_ONLINE=false
|
||||
|
||||
#
|
||||
# Firefly III supports webhooks. These are security sensitive and must be enabled manually first.
|
||||
#
|
||||
ALLOW_WEBHOOKS=false
|
||||
|
||||
#
|
||||
# The static cron job token can be useful when you use Docker and wish to manage cron jobs.
|
||||
# 1. Set this token to any 32-character value (this is important!).
|
||||
@@ -323,25 +280,12 @@ PUSHER_ID=
|
||||
DEMO_USERNAME=
|
||||
DEMO_PASSWORD=
|
||||
|
||||
#
|
||||
# Disable or enable the running balance column data.
|
||||
# If you enable this, please also run "php artisan firefly-iii:correct-database"
|
||||
# This will take some time the first run.
|
||||
#
|
||||
USE_RUNNING_BALANCE=false
|
||||
|
||||
#
|
||||
# The v2 layout is very experimental. If it breaks you get to keep both parts.
|
||||
# Be wary of data loss.
|
||||
#
|
||||
FIREFLY_III_LAYOUT=v1
|
||||
|
||||
#
|
||||
# Which Query Parser implementation to use for the search engine and rules
|
||||
# 'new' is experimental, 'legacy' is the classic one
|
||||
#
|
||||
QUERY_PARSER_IMPLEMENTATION=new
|
||||
|
||||
#
|
||||
# Please make sure this URL matches the external URL of your Firefly III installation.
|
||||
# It is used to validate specific requests and to generate URLs in emails.
|
||||
|
||||
2
.github/workflows/label-actions.yml
vendored
2
.github/workflows/label-actions.yml
vendored
@@ -18,4 +18,4 @@ jobs:
|
||||
action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/label-actions@v4
|
||||
- uses: dessant/label-actions@v5
|
||||
|
||||
@@ -42,6 +42,7 @@ use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class BudgetController
|
||||
@@ -286,7 +287,7 @@ class BudgetController extends Controller
|
||||
}
|
||||
if (null !== $limit && $this->convertToPrimary) {
|
||||
// convert and add all amounts.
|
||||
$limit->amount = app('steam')->positive($amount);
|
||||
$limit->amount = Steam::positive($amount);
|
||||
Log::debug(sprintf('Final amount in limit with converted amount %s', $limit->amount));
|
||||
}
|
||||
|
||||
|
||||
@@ -486,7 +486,7 @@ class BasicController extends Controller
|
||||
'currency_decimal_places' => $currencies[$currencyId]->decimal_places,
|
||||
'value_parsed' => Amount::formatFlat($currencies[$currencyId]->symbol, $currencies[$currencyId]->decimal_places, $availableBudget, false),
|
||||
'local_icon' => 'money',
|
||||
'sub_title' => Amount::formatFlat($currencies[$currencyId]->symbol, $currencies[$currencyId]->decimal_places, $availableBudget, false),
|
||||
'sub_title' => Amount::formatFlat($currencies[$currencyId]->symbol, $currencies[$currencyId]->decimal_places, bcdiv($availableBudget, (string)$days), false),
|
||||
];
|
||||
}
|
||||
foreach ($spent as $row) {
|
||||
|
||||
@@ -29,6 +29,7 @@ use FireflyIII\Api\V1\Requests\System\CronRequest;
|
||||
use FireflyIII\Support\Http\Controllers\CronRunner;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class CronController
|
||||
@@ -50,7 +51,7 @@ class CronController extends Controller
|
||||
$return = [];
|
||||
$return['recurring_transactions'] = $this->runRecurring($config['force'], $config['date']);
|
||||
$return['auto_budgets'] = $this->runAutoBudget($config['force'], $config['date']);
|
||||
if (true === config('cer.download_enabled')) {
|
||||
if (true === FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data) {
|
||||
$return['exchange_rates'] = $this->exchangeRatesCronJob($config['force'], $config['date']);
|
||||
}
|
||||
$return['bill_notifications'] = $this->billWarningCronJob($config['force'], $config['date']);
|
||||
|
||||
@@ -38,6 +38,7 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use League\Fractal\Resource\Collection as FractalCollection;
|
||||
use League\Fractal\Resource\Item;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class AttemptController
|
||||
@@ -71,7 +72,7 @@ class AttemptController extends Controller
|
||||
if ($message->webhook_id !== $webhook->id) {
|
||||
throw new FireflyException('200040: Webhook and webhook message are no match');
|
||||
}
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->warning(sprintf('User lists webhook attempts of webhook #%d and message #%d, but webhooks are DISABLED.', $webhook->id, $message->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
@@ -115,7 +116,7 @@ class AttemptController extends Controller
|
||||
throw new FireflyException('200041: Webhook message and webhook attempt are no match');
|
||||
}
|
||||
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->warning(sprintf('User views single webhook attempt #%d of webhook #%d and message #%d, but webhooks are DISABLED', $attempt->id, $webhook->id, $message->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
|
||||
@@ -34,6 +34,7 @@ use FireflyIII\Support\Facades\Preferences;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class DestroyController
|
||||
@@ -63,7 +64,7 @@ class DestroyController extends Controller
|
||||
*/
|
||||
public function destroy(Webhook $webhook): JsonResponse
|
||||
{
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
@@ -93,7 +94,7 @@ class DestroyController extends Controller
|
||||
throw new FireflyException('200041: Webhook message and webhook attempt are no match');
|
||||
}
|
||||
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, attempt #%d, but webhooks are DISABLED.', $webhook->id, $message->id, $attempt->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
@@ -121,7 +122,7 @@ class DestroyController extends Controller
|
||||
throw new FireflyException('200040: Webhook and webhook message are no match');
|
||||
}
|
||||
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, but webhooks are DISABLED.', $webhook->id, $message->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
|
||||
@@ -37,6 +37,7 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use League\Fractal\Resource\Collection as FractalCollection;
|
||||
use League\Fractal\Resource\Item;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class MessageController
|
||||
@@ -65,7 +66,7 @@ class MessageController extends Controller
|
||||
*/
|
||||
public function index(Webhook $webhook): JsonResponse
|
||||
{
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->warning(sprintf('User tries to view messages of webhook #%d, but webhooks are DISABLED.', $webhook->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
@@ -105,7 +106,7 @@ class MessageController extends Controller
|
||||
if ($message->webhook_id !== $webhook->id) {
|
||||
throw new FireflyException('200040: Webhook and webhook message are no match');
|
||||
}
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->warning(sprintf('User tries to view message #%d of webhook #%d, but webhooks are DISABLED.', $message->id, $webhook->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
|
||||
@@ -42,6 +42,7 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
use League\Fractal\Resource\Collection as FractalCollection;
|
||||
use League\Fractal\Resource\Item;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class ShowController
|
||||
@@ -72,7 +73,7 @@ class ShowController extends Controller
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->info('User tries to view all webhooks, but webhooks are DISABLED.');
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
@@ -114,7 +115,7 @@ class ShowController extends Controller
|
||||
*/
|
||||
public function show(Webhook $webhook): JsonResponse
|
||||
{
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->info(sprintf('User tries to view webhook #%d, but webhooks are DISABLED.', $webhook->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
@@ -146,7 +147,7 @@ class ShowController extends Controller
|
||||
*/
|
||||
public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse
|
||||
{
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->info(sprintf('User tries to trigger webhook #%d on transaction group #%d, but webhooks are DISABLED.', $webhook->id, $group->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
|
||||
@@ -34,6 +34,7 @@ use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use League\Fractal\Resource\Item;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class StoreController
|
||||
@@ -63,7 +64,7 @@ class StoreController extends Controller
|
||||
public function store(CreateRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->info('User tries to store new webhook, but webhooks are DISABLED.', $data);
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
|
||||
@@ -31,6 +31,7 @@ use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class SubmitController
|
||||
@@ -58,7 +59,7 @@ class SubmitController extends Controller
|
||||
*/
|
||||
public function submit(Webhook $webhook): JsonResponse
|
||||
{
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->info(sprintf('User tries to submit webhook #%d, but webhooks are DISABLED.', $webhook->id));
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
|
||||
@@ -35,6 +35,7 @@ use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use League\Fractal\Resource\Item;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class UpdateController
|
||||
@@ -63,7 +64,7 @@ class UpdateController extends Controller
|
||||
public function update(Webhook $webhook, UpdateRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
if (false === config('firefly.allow_webhooks')) {
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::channel('audit')->info(sprintf('User tries to update webhook #%d, but webhooks are DISABLED.', $webhook->id), $data);
|
||||
|
||||
throw new NotFoundHttpException('Webhooks are not enabled.');
|
||||
|
||||
@@ -40,6 +40,7 @@ use FireflyIII\Validation\GroupValidation;
|
||||
use FireflyIII\Validation\TransactionValidation;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class StoreRequest
|
||||
@@ -176,7 +177,7 @@ class StoreRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
Log::debug('Collect rules of TransactionStoreRequest');
|
||||
$validProtocols = config('firefly.valid_url_protocols');
|
||||
$validProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data;
|
||||
$locationRules = Location::requestRules([]);
|
||||
|
||||
return [
|
||||
|
||||
@@ -38,6 +38,7 @@ use FireflyIII\Validation\GroupValidation;
|
||||
use FireflyIII\Validation\TransactionValidation;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
@@ -248,7 +249,7 @@ class UpdateRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
$validProtocols = config('firefly.valid_url_protocols');
|
||||
$validProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data;
|
||||
|
||||
return [
|
||||
// basic fields for group:
|
||||
|
||||
@@ -31,6 +31,7 @@ use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\Support\Request\ValidatesWebhooks;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class CreateRequest
|
||||
@@ -73,7 +74,7 @@ class CreateRequest extends FormRequest
|
||||
$triggers = implode(',', array_values(Webhook::getTriggers()));
|
||||
$responses = implode(',', array_values(Webhook::getResponses()));
|
||||
$deliveries = implode(',', array_values(Webhook::getDeliveries()));
|
||||
$validProtocols = config('firefly.valid_url_protocols');
|
||||
$validProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data;
|
||||
|
||||
return [
|
||||
'title' => 'required|min:1|max:255|uniqueObjectForUser:webhooks,title',
|
||||
|
||||
@@ -31,6 +31,7 @@ use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\Support\Request\ValidatesWebhooks;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
@@ -73,7 +74,7 @@ class UpdateRequest extends FormRequest
|
||||
$triggers = implode(',', array_values(Webhook::getTriggers()));
|
||||
$responses = implode(',', array_values(Webhook::getResponses()));
|
||||
$deliveries = implode(',', array_values(Webhook::getDeliveries()));
|
||||
$validProtocols = config('firefly.valid_url_protocols');
|
||||
$validProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data;
|
||||
|
||||
/** @var Webhook $webhook */
|
||||
$webhook = $this->route()->parameter('webhook');
|
||||
|
||||
@@ -39,6 +39,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -78,6 +79,8 @@ class CorrectsAmounts extends Command
|
||||
|
||||
private function correctTransfers(): void
|
||||
{
|
||||
Log::debug('Will now correct transfers.');
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$type = TransactionType::where('type', TransactionTypeEnum::TRANSFER->value)->first();
|
||||
@@ -88,24 +91,21 @@ class CorrectsAmounts extends Command
|
||||
$repository->setUser($journal->user);
|
||||
$primary = Amount::getPrimaryCurrencyByUserGroup($journal->userGroup);
|
||||
|
||||
/** @var null|Transaction $source */
|
||||
$source = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
$valid = $this->validateJournal($journal);
|
||||
if (false === $valid) {
|
||||
Log::debug(sprintf('Journal #%d does not need to be fixed or is invalid (see previous messages)', $journal->id));
|
||||
|
||||
/** @var null|Transaction $destination */
|
||||
$destination = $journal->transactions()->where('amount', '>', 0)->first();
|
||||
if (null === $source || null === $destination) {
|
||||
continue;
|
||||
}
|
||||
if (null === $source->foreign_currency_id || null === $destination->foreign_currency_id) {
|
||||
continue;
|
||||
}
|
||||
Log::debug(sprintf('Journal #%d is ready to be corrected (if necessary).', $journal->id));
|
||||
$source = $journal->transactions()->where('amount', '<', '0')->first();
|
||||
$destination = $journal->transactions()->where('amount', '>', '0')->first();
|
||||
$sourceAccount = $source->account;
|
||||
$destAccount = $destination->account;
|
||||
if (null === $sourceAccount || null === $destAccount) {
|
||||
continue;
|
||||
}
|
||||
$sourceCurrency = $repository->getAccountCurrency($sourceAccount) ?? $primary;
|
||||
$destCurrency = $repository->getAccountCurrency($destAccount) ?? $primary;
|
||||
Log::debug(sprintf('Currency of source account #%d "%s" is %s', $sourceAccount->id, $sourceAccount->name, $sourceCurrency->code));
|
||||
Log::debug(sprintf('Currency of destination account #%d "%s" is %s', $destAccount->id, $destAccount->name, $destCurrency->code));
|
||||
|
||||
if ($sourceCurrency->id === $destCurrency->id) {
|
||||
Log::debug('Both accounts have the same currency. Removing foreign currency info.');
|
||||
@@ -119,22 +119,40 @@ class CorrectsAmounts extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
// validate source
|
||||
// validate source transaction
|
||||
if ($destCurrency->id !== $source->foreign_currency_id) {
|
||||
Log::debug(sprintf('Journal #%d: Transaction #%d refers to "%s" but should refer to "%s".', $journal->id, $source->id, $source->foreignCurrency->code, $destCurrency->code));
|
||||
Log::debug(sprintf('[a] Journal #%d: transaction #%d refers to foreign currency "%s" but should refer to "%s".', $journal->id, $source->id, $source->foreignCurrency->code, $destCurrency->code));
|
||||
$source->foreign_currency_id = $destCurrency->id;
|
||||
$source->save();
|
||||
}
|
||||
if ($sourceCurrency->id !== $source->transaction_currency_id) {
|
||||
Log::debug(sprintf('[b] Journal #%d: transaction #%d refers to currency "%s" but should refer to "%s".', $journal->id, $source->id, $source->transactionCurrency->code, $sourceCurrency->code));
|
||||
$source->transaction_currency_id = $sourceCurrency->id;
|
||||
$source->save();
|
||||
}
|
||||
|
||||
// validate destination:
|
||||
if ($sourceCurrency->id !== $destination->foreign_currency_id) {
|
||||
Log::debug(sprintf('Journal #%d: Transaction #%d refers to "%s" but should refer to "%s".', $journal->id, $destination->id, $destination->foreignCurrency->code, $sourceCurrency->code));
|
||||
Log::debug(sprintf('[c] Journal #%d: transaction #%d refers to foreign currency "%s" but should refer to "%s".', $journal->id, $destination->id, $destination->foreignCurrency->code, $sourceCurrency->code));
|
||||
$destination->foreign_currency_id = $sourceCurrency->id;
|
||||
$destination->save();
|
||||
}
|
||||
|
||||
if ($destCurrency->id !== $destination->transaction_currency_id) {
|
||||
Log::debug(sprintf('[d] Journal #%d: transaction #%d refers to currency "%s" but should refer to "%s".', $journal->id, $destination->id, $destination->transactionCurrency->code, $destCurrency->code));
|
||||
$destination->transaction_currency_id = $destCurrency->id;
|
||||
$destination->save();
|
||||
}
|
||||
Log::debug(sprintf('Done with journal #%d.', $journal->id));
|
||||
}
|
||||
}
|
||||
|
||||
private function deleteJournal(TransactionJournal $journal): void
|
||||
{
|
||||
$journal->transactionGroup?->delete();
|
||||
$journal->delete();
|
||||
}
|
||||
|
||||
private function fixAutoBudgets(): void
|
||||
{
|
||||
$count = AutoBudget::where('amount', '<', 0)->update(['amount' => DB::raw('amount * -1')]);
|
||||
@@ -234,7 +252,7 @@ class CorrectsAmounts extends Command
|
||||
private function fixRuleTrigger(RuleTrigger $item): bool
|
||||
{
|
||||
try {
|
||||
$check = bccomp((string) $item->trigger_value, '0');
|
||||
$check = bccomp((string)$item->trigger_value, '0');
|
||||
} catch (ValueError) {
|
||||
$this->friendlyError(sprintf('Rule #%d contained invalid %s-trigger "%s". The trigger has been removed, and the rule is disabled.', $item->rule_id, $item->trigger_type, $item->trigger_value));
|
||||
$item->rule->active = false;
|
||||
@@ -244,7 +262,7 @@ class CorrectsAmounts extends Command
|
||||
return false;
|
||||
}
|
||||
if (-1 === $check) {
|
||||
$item->trigger_value = app('steam')->positive($item->trigger_value);
|
||||
$item->trigger_value = Steam::positive($item->trigger_value);
|
||||
$item->save();
|
||||
|
||||
return true;
|
||||
@@ -252,4 +270,57 @@ class CorrectsAmounts extends Command
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function validateJournal(TransactionJournal $journal): bool
|
||||
{
|
||||
$countSource = $journal->transactions()->where('amount', '<', 0)->count();
|
||||
$countDest = $journal->transactions()->where('amount', '>', 0)->count();
|
||||
|
||||
if (1 !== $countSource || 1 !== $countDest) {
|
||||
$this->friendlyError(sprintf('Transaction journal #%d has bad transaction information. Will delete.', $journal->id));
|
||||
$this->deleteJournal($journal);
|
||||
Log::error(sprintf('Transaction journal #%d has bad transaction information. Will delete.', $journal->id));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var null|Transaction $source */
|
||||
$source = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
|
||||
/** @var null|Transaction $destination */
|
||||
$destination = $journal->transactions()->where('amount', '>', 0)->first();
|
||||
|
||||
if (null === $source || null === $destination) {
|
||||
$this->friendlyError(sprintf('Could not find source OR destination for journal #%d .', $journal->id));
|
||||
Log::error(sprintf('Could not find source OR destination for journal #%d .', $journal->id));
|
||||
$this->deleteJournal($journal);
|
||||
|
||||
return false;
|
||||
}
|
||||
if (null === $source->foreign_currency_id || null === $destination->foreign_currency_id) {
|
||||
Log::debug('No foreign currency information is present, can safely continue with other transactions.');
|
||||
|
||||
return false;
|
||||
}
|
||||
if (null === $source->foreign_amount || null === $destination->foreign_amount) {
|
||||
$this->friendlyError(sprintf('Transactions of journal #%d have no foreign amount, but have foreign currency info. Will reset this.', $journal->id));
|
||||
$source->foreign_currency_id = null;
|
||||
$source->save();
|
||||
$destination->foreign_currency_id = null;
|
||||
$source->save();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$sourceAccount = $source->account;
|
||||
$destAccount = $destination->account;
|
||||
if (null === $sourceAccount || null === $destAccount) {
|
||||
$this->friendlyError(sprintf('Could not find accounts for journal #%d,', $journal->id));
|
||||
$this->deleteJournal($journal);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class CorrectsCurrencies extends Command
|
||||
$repos = app(CurrencyRepositoryInterface::class);
|
||||
|
||||
// first check if the user has any default currency (not necessarily the case, so can be forced).
|
||||
$primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($userGroup);
|
||||
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($userGroup);
|
||||
|
||||
Log::debug(sprintf('Now correcting currencies for user group #%d', $userGroup->id));
|
||||
$found = [$primaryCurrency->id];
|
||||
|
||||
@@ -29,6 +29,7 @@ use FireflyIII\Enums\AccountTypeEnum;
|
||||
use FireflyIII\Models\Account;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
class CorrectsIbans extends Command
|
||||
{
|
||||
@@ -55,7 +56,7 @@ class CorrectsIbans extends Command
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$iban = (string) $account->iban;
|
||||
$newIban = app('steam')->filterSpaces($iban);
|
||||
$newIban = Steam::filterSpaces($iban);
|
||||
if ('' !== $iban && $iban !== $newIban) {
|
||||
$account->iban = $newIban;
|
||||
$account->save();
|
||||
@@ -66,7 +67,7 @@ class CorrectsIbans extends Command
|
||||
$accountNumber = $account->accountMeta->where('name', 'account_number')->first();
|
||||
if (null !== $accountNumber) {
|
||||
$number = (string) $accountNumber->value;
|
||||
$newNumber = app('steam')->filterSpaces($number);
|
||||
$newNumber = Steam::filterSpaces($number);
|
||||
if ('' !== $number && $number !== $newNumber) {
|
||||
$accountNumber->value = $newNumber;
|
||||
$accountNumber->save();
|
||||
|
||||
@@ -133,6 +133,6 @@ class CorrectsOpeningBalanceCurrencies extends Command
|
||||
$repos = app(AccountRepositoryInterface::class);
|
||||
$repos->setUser($account->user);
|
||||
|
||||
return $repos->getAccountCurrency($account) ?? app('amount')->getPrimaryCurrencyByUserGroup($account->userGroup);
|
||||
return $repos->getAccountCurrency($account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->userGroup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Query\Builder as DatabaseBuilder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class CorrectsPrimaryCurrencyAmounts extends Command
|
||||
{
|
||||
@@ -62,7 +63,7 @@ class CorrectsPrimaryCurrencyAmounts extends Command
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
if (false === config('cer.enabled')) {
|
||||
if (false === FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) {
|
||||
$this->friendlyInfo('This command will not run because currency exchange rates are disabled.');
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -30,6 +30,7 @@ use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use FireflyIII\Support\Models\AccountBalanceCalculator;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -60,7 +61,7 @@ class CorrectsUnevenAmount extends Command
|
||||
|
||||
$this->fixUnevenAmounts();
|
||||
$this->matchCurrencies();
|
||||
if (true === config('firefly.feature_flags.running_balance_column')) {
|
||||
if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) {
|
||||
$this->friendlyInfo('Will recalculate transaction running balance columns. This may take a LONG time. Please be patient.');
|
||||
AccountBalanceCalculator::recalculateAll(false);
|
||||
$this->friendlyInfo('Done recalculating transaction running balance columns.');
|
||||
@@ -112,9 +113,9 @@ class CorrectsUnevenAmount extends Command
|
||||
if ($source->transaction_currency_id === $destination->transaction_currency_id) {
|
||||
Log::debug('Ready to swap data between transactions.');
|
||||
$destination->foreign_currency_id = $source->transaction_currency_id;
|
||||
$destination->foreign_amount = app('steam')->positive($source->amount);
|
||||
$destination->foreign_amount = Steam::positive($source->amount);
|
||||
$destination->transaction_currency_id = $source->foreign_currency_id;
|
||||
$destination->amount = app('steam')->positive($source->foreign_amount);
|
||||
$destination->amount = Steam::positive($source->foreign_amount);
|
||||
$destination->balance_dirty = true;
|
||||
$source->balance_dirty = true;
|
||||
$destination->save();
|
||||
@@ -132,11 +133,7 @@ class CorrectsUnevenAmount extends Command
|
||||
private function fixUnevenAmounts(): void
|
||||
{
|
||||
Log::debug('fixUnevenAmounts()');
|
||||
$journals = DB::table('transactions')
|
||||
->groupBy('transaction_journal_id')
|
||||
->whereNull('deleted_at')
|
||||
->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')])
|
||||
;
|
||||
$journals = DB::table('transactions')->groupBy('transaction_journal_id')->whereNull('deleted_at')->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]);
|
||||
|
||||
/** @var stdClass $entry */
|
||||
foreach ($journals as $entry) {
|
||||
@@ -146,11 +143,7 @@ class CorrectsUnevenAmount extends Command
|
||||
|| '' === $sum // @phpstan-ignore-line
|
||||
|| str_contains($sum, 'e')
|
||||
|| str_contains($sum, ',')) {
|
||||
$message = sprintf(
|
||||
'Journal #%d has an invalid sum ("%s"). No sure what to do.',
|
||||
$entry->transaction_journal_id,
|
||||
$entry->the_sum
|
||||
);
|
||||
$message = sprintf('Journal #%d has an invalid sum ("%s"). No sure what to do.', $entry->transaction_journal_id, $entry->the_sum);
|
||||
$this->friendlyWarning($message);
|
||||
Log::warning($message);
|
||||
++$this->count;
|
||||
@@ -184,13 +177,7 @@ class CorrectsUnevenAmount extends Command
|
||||
$source = $journal->transactions()->where('amount', '<', 0)->first();
|
||||
|
||||
if (null === $source) {
|
||||
$this->friendlyError(
|
||||
sprintf(
|
||||
'Journal #%d ("%s") has no source transaction. It will be deleted to maintain database consistency.',
|
||||
$journal->id ?? 0,
|
||||
$journal->description ?? ''
|
||||
)
|
||||
);
|
||||
$this->friendlyError(sprintf('Journal #%d ("%s") has no source transaction. It will be deleted to maintain database consistency.', $journal->id ?? 0, $journal->description ?? ''));
|
||||
Transaction::where('transaction_journal_id', $journal->id ?? 0)->forceDelete();
|
||||
TransactionJournal::where('id', $journal->id ?? 0)->forceDelete();
|
||||
++$this->count;
|
||||
@@ -205,13 +192,7 @@ class CorrectsUnevenAmount extends Command
|
||||
$destination = $journal->transactions()->where('amount', '>', 0)->first();
|
||||
|
||||
if (null === $destination) {
|
||||
$this->friendlyError(
|
||||
sprintf(
|
||||
'Journal #%d ("%s") has no destination transaction. It will be deleted to maintain database consistency.',
|
||||
$journal->id ?? 0,
|
||||
$journal->description ?? ''
|
||||
)
|
||||
);
|
||||
$this->friendlyError(sprintf('Journal #%d ("%s") has no destination transaction. It will be deleted to maintain database consistency.', $journal->id ?? 0, $journal->description ?? ''));
|
||||
|
||||
Transaction::where('transaction_journal_id', $journal->id ?? 0)->forceDelete();
|
||||
TransactionJournal::where('id', $journal->id ?? 0)->forceDelete();
|
||||
@@ -257,8 +238,8 @@ class CorrectsUnevenAmount extends Command
|
||||
// source currency = dest foreign currency
|
||||
// dest amount = source foreign currency
|
||||
// dest currency = source foreign currency
|
||||
// Log::debug(sprintf('[a] %s', bccomp(app('steam')->positive($source->amount), app('steam')->positive($destination->foreign_amount))));
|
||||
// Log::debug(sprintf('[b] %s', bccomp(app('steam')->positive($destination->amount), app('steam')->positive($source->foreign_amount))));
|
||||
// Log::debug(sprintf('[a] %s', bccomp(\FireflyIII\Support\Facades\Steam::positive($source->amount), \FireflyIII\Support\Facades\Steam::positive($destination->foreign_amount))));
|
||||
// Log::debug(sprintf('[b] %s', bccomp(\FireflyIII\Support\Facades\Steam::positive($destination->amount), \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount))));
|
||||
// Log::debug(sprintf('[c] %s', var_export($source->transaction_currency_id === $destination->foreign_currency_id,true)));
|
||||
// Log::debug(sprintf('[d] %s', var_export((int) $destination->transaction_currency_id ===(int) $source->foreign_currency_id, true)));
|
||||
return 0 === bccomp(Steam::positive($source->amount), Steam::positive($destination->foreign_amount))
|
||||
@@ -428,9 +409,9 @@ class CorrectsUnevenAmount extends Command
|
||||
|
||||
// // only fix the destination transaction
|
||||
// $destination->foreign_currency_id = $source->transaction_currency_id;
|
||||
// $destination->foreign_amount = app('steam')->positive($source->amount);
|
||||
// $destination->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->amount);
|
||||
// $destination->transaction_currency_id = $source->foreign_currency_id;
|
||||
// $destination->amount = app('steam')->positive($source->foreign_amount);
|
||||
// $destination->amount = \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount);
|
||||
// $destination->balance_dirty = true;
|
||||
// $source->balance_dirty = true;
|
||||
// $destination->save();
|
||||
|
||||
@@ -55,13 +55,13 @@ class ValidatesFilePermissions extends Command
|
||||
/** @var string $directory */
|
||||
foreach ($directories as $directory) {
|
||||
if (!is_dir($directory)) {
|
||||
$this->friendlyError(sprintf('Directory "%s" cannot found. It is necessary to allow files to be uploaded.', $uploadDir));
|
||||
$this->friendlyError(sprintf('Directory "%s" cannot found. It is necessary to allow files to be uploaded.', $directory));
|
||||
$errors = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
if (!is_writable($directory)) {
|
||||
$this->friendlyError(sprintf('Directory "%s" is not writeable. Uploading attachments may fail silently.', $uploadDir));
|
||||
$this->friendlyError(sprintf('Directory "%s" is not writeable. Uploading attachments may fail silently.', $directory));
|
||||
$errors = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace FireflyIII\Console\Commands\System;
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Support\Models\AccountBalanceCalculator;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class RecalculatesRunningBalance extends Command
|
||||
{
|
||||
@@ -52,7 +53,7 @@ class RecalculatesRunningBalance extends Command
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
if (true === config('firefly.feature_flags.running_balance_column')) {
|
||||
if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) {
|
||||
$this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.');
|
||||
$this->correctBalanceAmounts($this->option('force'));
|
||||
$this->friendlyInfo('Done recalculating account balances.');
|
||||
|
||||
@@ -31,6 +31,7 @@ use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use League\Flysystem\FilesystemException;
|
||||
use Safe\Exceptions\JsonException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
use function Safe\json_decode;
|
||||
|
||||
@@ -107,8 +108,8 @@ class VerifySecurityAlerts extends Command
|
||||
private function removeOldAdvisory(): void
|
||||
{
|
||||
try {
|
||||
app('fireflyconfig')->delete('upgrade_security_message');
|
||||
app('fireflyconfig')->delete('upgrade_security_level');
|
||||
FireflyConfig::delete('upgrade_security_message');
|
||||
FireflyConfig::delete('upgrade_security_level');
|
||||
} catch (QueryException $e) {
|
||||
Log::debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage()));
|
||||
}
|
||||
@@ -117,8 +118,8 @@ class VerifySecurityAlerts extends Command
|
||||
private function saveSecurityAdvisory(array $array): void
|
||||
{
|
||||
try {
|
||||
app('fireflyconfig')->set('upgrade_security_message', $array['message']);
|
||||
app('fireflyconfig')->set('upgrade_security_level', $array['level']);
|
||||
FireflyConfig::set('upgrade_security_message', $array['message']);
|
||||
FireflyConfig::set('upgrade_security_level', $array['level']);
|
||||
} catch (QueryException $e) {
|
||||
Log::debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ use FireflyIII\Support\Cronjobs\WebhookCronjob;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use InvalidArgumentException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class Cron extends Command
|
||||
{
|
||||
@@ -72,7 +73,7 @@ class Cron extends Command
|
||||
$force = (bool) $this->option('force'); // @phpstan-ignore-line
|
||||
|
||||
// Fire exchange rates cron job.
|
||||
if (true === config('cer.download_enabled') && ($doAll || $this->option('download-cer'))) {
|
||||
if (true === FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data && ($doAll || $this->option('download-cer'))) {
|
||||
try {
|
||||
$this->exchangeRatesCronJob($force, $date);
|
||||
} catch (FireflyException $e) {
|
||||
|
||||
@@ -32,6 +32,7 @@ use Illuminate\Console\Command;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class AddsTransactionIdentifiers extends Command
|
||||
{
|
||||
@@ -97,7 +98,7 @@ class AddsTransactionIdentifiers extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -157,6 +158,6 @@ class AddsTransactionIdentifiers extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use JsonException;
|
||||
use stdClass;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
use function Safe\json_decode;
|
||||
|
||||
@@ -86,7 +87,7 @@ class RemovesDatabaseDecryption extends Command
|
||||
$this->friendlyPositive(sprintf('Decrypted the data in table "%s".', $table));
|
||||
// mark as decrypted:
|
||||
$configName = sprintf('is_decrypted_%s', $table);
|
||||
app('fireflyconfig')->set($configName, true);
|
||||
FireflyConfig::set($configName, true);
|
||||
}
|
||||
|
||||
private function isDecrypted(string $table): bool
|
||||
@@ -95,7 +96,7 @@ class RemovesDatabaseDecryption extends Command
|
||||
$configVar = null;
|
||||
|
||||
try {
|
||||
$configVar = app('fireflyconfig')->get($configName, false);
|
||||
$configVar = FireflyConfig::get($configName, false);
|
||||
} catch (FireflyException $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
@@ -120,7 +121,7 @@ class RemovesDatabaseDecryption extends Command
|
||||
if (null === $original) {
|
||||
return;
|
||||
}
|
||||
$id = (int) $row->id;
|
||||
$id = (int)$row->id;
|
||||
$value = '';
|
||||
|
||||
try {
|
||||
@@ -133,7 +134,7 @@ class RemovesDatabaseDecryption extends Command
|
||||
}
|
||||
|
||||
// A separate routine for preferences table:
|
||||
if ('preferences' === $table) {
|
||||
if ('preferences' === $table && is_string($value)) {
|
||||
$this->decryptPreferencesRow($id, $value);
|
||||
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* CorrectAccountBalance.php
|
||||
* RepairsAccountBalances.php
|
||||
* Copyright (c) 2024 james@firefly-iii.org.
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
@@ -27,6 +27,7 @@ namespace FireflyIII\Console\Commands\Upgrade;
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Support\Models\AccountBalanceCalculator;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class RepairsAccountBalances extends Command
|
||||
{
|
||||
@@ -43,7 +44,7 @@ class RepairsAccountBalances extends Command
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (true === config('firefly.feature_flags.running_balance_column')) {
|
||||
if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) {
|
||||
$this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.');
|
||||
$this->markAsExecuted();
|
||||
$this->correctBalanceAmounts();
|
||||
@@ -58,14 +59,14 @@ class RepairsAccountBalances extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool) $configVar?->data;
|
||||
}
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
|
||||
private function correctBalanceAmounts(): void
|
||||
|
||||
@@ -41,7 +41,7 @@ class UpgradeSkeleton extends Command
|
||||
*/
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
if (null !== $configVar) {
|
||||
return (bool)$configVar->data;
|
||||
}
|
||||
@@ -55,6 +55,6 @@ class UpgradeSkeleton extends Command
|
||||
*/
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
\FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesAccountCurrencies extends Command
|
||||
{
|
||||
@@ -85,7 +86,7 @@ class UpgradesAccountCurrencies extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool) $configVar?->data;
|
||||
}
|
||||
@@ -104,7 +105,7 @@ class UpgradesAccountCurrencies extends Command
|
||||
$accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value]);
|
||||
|
||||
// get user's currency preference:
|
||||
$primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($user->userGroup);
|
||||
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup);
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
@@ -155,6 +156,6 @@ class UpgradesAccountCurrencies extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\AccountMeta;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesAccountMetaData extends Command
|
||||
{
|
||||
@@ -82,7 +83,7 @@ class UpgradesAccountMetaData extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -90,6 +91,6 @@ class UpgradesAccountMetaData extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Note;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesAttachments extends Command
|
||||
{
|
||||
@@ -92,7 +93,7 @@ class UpgradesAttachments extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -100,6 +101,6 @@ class UpgradesAttachments extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesBillsToRules extends Command
|
||||
{
|
||||
@@ -99,7 +100,7 @@ class UpgradesBillsToRules extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -206,6 +207,6 @@ class UpgradesBillsToRules extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesBudgetLimitPeriods extends Command
|
||||
{
|
||||
@@ -58,7 +59,7 @@ class UpgradesBudgetLimitPeriods extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool) $configVar->data;
|
||||
}
|
||||
@@ -152,6 +153,6 @@ class UpgradesBudgetLimitPeriods extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesBudgetLimits extends Command
|
||||
{
|
||||
@@ -66,7 +67,7 @@ class UpgradesBudgetLimits extends Command
|
||||
/** @var null|User $user */
|
||||
$user = $budget->user;
|
||||
if (null !== $user) {
|
||||
$currency = app('amount')->getPrimaryCurrencyByUserGroup($user->userGroup);
|
||||
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup);
|
||||
$budgetLimit->transaction_currency_id = $currency->id;
|
||||
$budgetLimit->save();
|
||||
$this->friendlyInfo(
|
||||
@@ -84,7 +85,7 @@ class UpgradesBudgetLimits extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -92,6 +93,6 @@ class UpgradesBudgetLimits extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesCreditCardLiabilities extends Command
|
||||
{
|
||||
@@ -80,13 +81,13 @@ class UpgradesCreditCardLiabilities extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool) $configVar?->data;
|
||||
}
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesCurrencyPreferences extends Command
|
||||
{
|
||||
@@ -65,7 +66,7 @@ class UpgradesCurrencyPreferences extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -144,6 +145,6 @@ class UpgradesCurrencyPreferences extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesJournalMetaData extends Command
|
||||
{
|
||||
@@ -69,14 +70,14 @@ class UpgradesJournalMetaData extends Command
|
||||
|
||||
private function isMigrated(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(UpgradesToGroups::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(UpgradesToGroups::CONFIG_NAME, false);
|
||||
|
||||
return (bool) $configVar->data;
|
||||
}
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool) $configVar->data;
|
||||
}
|
||||
@@ -218,6 +219,6 @@ class UpgradesJournalMetaData extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\TransactionJournalMeta;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesJournalNotes extends Command
|
||||
{
|
||||
@@ -86,7 +87,7 @@ class UpgradesJournalNotes extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -94,6 +95,6 @@ class UpgradesJournalNotes extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Services\Internal\Support\CreditRecalculateService;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesLiabilities extends Command
|
||||
{
|
||||
@@ -61,7 +62,7 @@ class UpgradesLiabilities extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -148,6 +149,6 @@ class UpgradesLiabilities extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ use FireflyIII\Services\Internal\Support\CreditRecalculateService;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesLiabilitiesEight extends Command
|
||||
{
|
||||
@@ -63,7 +64,7 @@ class UpgradesLiabilitiesEight extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -137,7 +138,7 @@ class UpgradesLiabilitiesEight extends Command
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) $openingJournal->date->isSameDay($liabilityJournal->date);
|
||||
return (bool)$openingJournal->date->isSameDay($liabilityJournal->date);
|
||||
}
|
||||
|
||||
private function deleteCreditTransaction(Account $account): void
|
||||
@@ -148,7 +149,7 @@ class UpgradesLiabilitiesEight extends Command
|
||||
->where('transaction_journals.transaction_type_id', $liabilityType->id)
|
||||
->first(['transaction_journals.*'])
|
||||
;
|
||||
if (null !== $liabilityJournal) {
|
||||
if (null !== $liabilityJournal && null !== $liabilityJournal->transactionGroup) {
|
||||
$group = $liabilityJournal->transactionGroup;
|
||||
$service = new TransactionGroupDestroyService();
|
||||
$service->destroy($group);
|
||||
@@ -192,11 +193,14 @@ class UpgradesLiabilitiesEight extends Command
|
||||
->where('transactions.account_id', $account->id)->get(['transaction_journals.*'])
|
||||
;
|
||||
|
||||
$service = app(TransactionGroupDestroyService::class);
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$service = app(TransactionGroupDestroyService::class);
|
||||
$service->destroy($journal->transactionGroup);
|
||||
++$count;
|
||||
if (null !== $journal->transactionGroup) {
|
||||
$service->destroy($journal->transactionGroup);
|
||||
++$count;
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
@@ -204,6 +208,6 @@ class UpgradesLiabilitiesEight extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesMultiPiggyBanks extends Command
|
||||
{
|
||||
@@ -64,7 +65,7 @@ class UpgradesMultiPiggyBanks extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -94,7 +95,7 @@ class UpgradesMultiPiggyBanks extends Command
|
||||
$this->repository->setUser($piggyBank->account->user);
|
||||
$this->accountRepository->setUser($piggyBank->account->user);
|
||||
$repetition = $this->repository->getRepetition($piggyBank, true);
|
||||
$currency = $this->accountRepository->getAccountCurrency($piggyBank->account) ?? app('amount')->getPrimaryCurrencyByUserGroup($piggyBank->account->user->userGroup);
|
||||
$currency = $this->accountRepository->getAccountCurrency($piggyBank->account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($piggyBank->account->user->userGroup);
|
||||
|
||||
// update piggy bank to have a currency.
|
||||
$piggyBank->transaction_currency_id = $currency->id;
|
||||
@@ -112,6 +113,6 @@ class UpgradesMultiPiggyBanks extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace FireflyIII\Console\Commands\Upgrade;
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesPrimaryCurrencyAmounts extends Command
|
||||
{
|
||||
@@ -60,7 +61,7 @@ class UpgradesPrimaryCurrencyAmounts extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -68,6 +69,6 @@ class UpgradesPrimaryCurrencyAmounts extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Models\RecurrenceMeta;
|
||||
use FireflyIII\Models\RecurrenceTransactionMeta;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
use function Safe\json_encode;
|
||||
|
||||
@@ -65,7 +66,7 @@ class UpgradesRecurrenceMetaData extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -117,6 +118,6 @@ class UpgradesRecurrenceMetaData extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace FireflyIII\Console\Commands\Upgrade;
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesRuleActions extends Command
|
||||
{
|
||||
@@ -63,7 +64,7 @@ class UpgradesRuleActions extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -183,6 +184,6 @@ class UpgradesRuleActions extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Models\Location;
|
||||
use FireflyIII\Models\Tag;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesTagLocations extends Command
|
||||
{
|
||||
@@ -57,7 +58,7 @@ class UpgradesTagLocations extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -97,6 +98,6 @@ class UpgradesTagLocations extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesToGroups extends Command
|
||||
{
|
||||
@@ -97,7 +98,7 @@ class UpgradesToGroups extends Command
|
||||
|
||||
private function isMigrated(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -379,6 +380,6 @@ class UpgradesToGroups extends Command
|
||||
|
||||
private function markAsMigrated(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesTransferCurrencies extends Command
|
||||
{
|
||||
@@ -105,7 +106,7 @@ class UpgradesTransferCurrencies extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -480,6 +481,6 @@ class UpgradesTransferCurrencies extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesVariousCurrencyInformation extends Command
|
||||
{
|
||||
@@ -86,7 +87,7 @@ class UpgradesVariousCurrencyInformation extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -246,6 +247,6 @@ class UpgradesVariousCurrencyInformation extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ use FireflyIII\Models\WebhookDelivery as WebhookDeliveryModel;
|
||||
use FireflyIII\Models\WebhookResponse as WebhookResponseModel;
|
||||
use FireflyIII\Models\WebhookTrigger as WebhookTriggerModel;
|
||||
use Illuminate\Console\Command;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class UpgradesWebhooks extends Command
|
||||
{
|
||||
@@ -63,7 +64,7 @@ class UpgradesWebhooks extends Command
|
||||
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
$configVar = FireflyConfig::get(self::CONFIG_NAME, false);
|
||||
|
||||
return (bool)$configVar?->data;
|
||||
|
||||
@@ -109,6 +110,6 @@ class UpgradesWebhooks extends Command
|
||||
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
FireflyConfig::set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ use Illuminate\Validation\ValidationException as LaravelValidationException;
|
||||
use Laravel\Passport\Exceptions\OAuthServerException as LaravelOAuthException;
|
||||
use League\OAuth2\Server\Exception\OAuthServerException;
|
||||
use Override;
|
||||
use Sentry\Laravel\Integration;
|
||||
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
@@ -50,6 +49,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Throwable;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
use function Safe\json_encode;
|
||||
use function Safe\parse_url;
|
||||
@@ -83,14 +83,7 @@ class Handler extends ExceptionHandler
|
||||
* Register the exception handling callbacks for the application.
|
||||
*/
|
||||
#[Override]
|
||||
public function register(): void
|
||||
{
|
||||
if (true === config('firefly.report_errors_online')) {
|
||||
$this->reportable(function (Throwable $e): void {
|
||||
Integration::captureUnhandledException($e);
|
||||
});
|
||||
}
|
||||
}
|
||||
public function register(): void {}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response. It's complex but lucky for us, we never use it because
|
||||
@@ -287,7 +280,7 @@ class Handler extends ExceptionHandler
|
||||
protected function invalid($request, LaravelValidationException $exception): \Illuminate\Http\Response|JsonResponse|RedirectResponse
|
||||
{
|
||||
// protect against open redirect when submitting invalid forms.
|
||||
$previous = app('steam')->getSafePreviousUrl();
|
||||
$previous = Steam::getSafePreviousUrl();
|
||||
$redirect = $this->getRedirectUrl($exception);
|
||||
|
||||
return redirect($redirect ?? $previous)
|
||||
|
||||
@@ -51,7 +51,7 @@ class BillFactory
|
||||
Log::debug(sprintf('Now in %s', __METHOD__), $data);
|
||||
$factory = app(TransactionCurrencyFactory::class);
|
||||
$currency = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null))
|
||||
?? app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
|
||||
try {
|
||||
$skip = array_key_exists('skip', $data) ? $data['skip'] : 0;
|
||||
|
||||
@@ -126,7 +126,7 @@ class PiggyBankFactory
|
||||
private function getCurrency(array $data): TransactionCurrency
|
||||
{
|
||||
// currency:
|
||||
$primaryCurrency = app('amount')->getPrimaryCurrency();
|
||||
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency();
|
||||
$currency = null;
|
||||
if (array_key_exists('transaction_currency_code', $data)) {
|
||||
$currency = $this->currencyRepository->findByCode((string)($data['transaction_currency_code'] ?? ''));
|
||||
|
||||
@@ -34,6 +34,7 @@ use FireflyIII\Services\Internal\Update\AccountUpdateService;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class TransactionFactory
|
||||
@@ -58,10 +59,10 @@ class TransactionFactory
|
||||
$foreignAmount = null;
|
||||
}
|
||||
if (null !== $foreignAmount) {
|
||||
$foreignAmount = app('steam')->negative($foreignAmount);
|
||||
$foreignAmount = Steam::negative($foreignAmount);
|
||||
}
|
||||
|
||||
return $this->create(app('steam')->negative($amount), $foreignAmount);
|
||||
return $this->create(Steam::negative($amount), $foreignAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,10 +171,10 @@ class TransactionFactory
|
||||
$foreignAmount = null;
|
||||
}
|
||||
if (null !== $foreignAmount) {
|
||||
$foreignAmount = app('steam')->positive($foreignAmount);
|
||||
$foreignAmount = Steam::positive($foreignAmount);
|
||||
}
|
||||
|
||||
return $this->create(app('steam')->positive($amount), $foreignAmount);
|
||||
return $this->create(Steam::positive($amount), $foreignAmount);
|
||||
}
|
||||
|
||||
public function setAccount(Account $account): void
|
||||
|
||||
@@ -251,7 +251,7 @@ class TransactionJournalFactory
|
||||
$foreignCurrency = $this->getForeignByAccount($type->type, $foreignCurrency, $destinationAccount);
|
||||
$description = $this->getDescription($description);
|
||||
|
||||
Log::debug(sprintf('Currency is #%d "%s", foreign currency is #%d "%s"', $currency->id, $currency->code, $foreignCurrency?->id, $foreignCurrency));
|
||||
Log::debug(sprintf('Currency is #%d "%s", foreign currency is #%d "%s"', $currency->id, $currency->code, $foreignCurrency?->id, $foreignCurrency?->code));
|
||||
Log::debug(sprintf('Date: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()->getName()));
|
||||
|
||||
/** Create a basic journal. */
|
||||
@@ -502,7 +502,7 @@ class TransactionJournalFactory
|
||||
$preference = $this->accountRepository->getAccountCurrency($account);
|
||||
if (null === $preference && !$currency instanceof TransactionCurrency) {
|
||||
// return user's default:
|
||||
return app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
return \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
|
||||
}
|
||||
$result = $preference ?? $currency;
|
||||
Log::debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name));
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Generator\Chart\Basic;
|
||||
|
||||
use FireflyIII\Support\ChartColour;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class ChartJsGenerator.
|
||||
@@ -56,7 +57,7 @@ class ChartJsGenerator implements GeneratorInterface
|
||||
$index = 0;
|
||||
foreach ($data as $key => $valueArray) {
|
||||
// make larger than 0
|
||||
$chartData['datasets'][0]['data'][] = app('steam')->positive((string) $valueArray['amount']);
|
||||
$chartData['datasets'][0]['data'][] = Steam::positive((string) $valueArray['amount']);
|
||||
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
||||
$chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol'];
|
||||
$chartData['labels'][] = $key;
|
||||
@@ -163,7 +164,7 @@ class ChartJsGenerator implements GeneratorInterface
|
||||
$index = 0;
|
||||
foreach ($data as $key => $value) {
|
||||
// make larger than 0
|
||||
$chartData['datasets'][0]['data'][] = app('steam')->positive((string) $value);
|
||||
$chartData['datasets'][0]['data'][] = Steam::positive((string) $value);
|
||||
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
|
||||
|
||||
$chartData['labels'][] = $key;
|
||||
|
||||
@@ -144,7 +144,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$dayBeforeBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id];
|
||||
|
||||
$startBalance = $dayBeforeBalance['balance'];
|
||||
$primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($account->user->userGroup);
|
||||
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
|
||||
$currency = $accountRepository->getAccountCurrency($account) ?? $primaryCurrency;
|
||||
|
||||
foreach ($journals as $index => $journal) {
|
||||
@@ -153,13 +153,13 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
// make sure amount is in the right "direction".
|
||||
if ($account->id === $journal['destination_account_id']) {
|
||||
$transactionAmount = app('steam')->positive($journal['amount']);
|
||||
$transactionAmount = Steam::positive($journal['amount']);
|
||||
}
|
||||
|
||||
if ($currency->id === $journal['foreign_currency_id']) {
|
||||
$transactionAmount = $journal['foreign_amount'];
|
||||
if ($account->id === $journal['destination_account_id']) {
|
||||
$transactionAmount = app('steam')->positive($journal['foreign_amount']);
|
||||
$transactionAmount = Steam::positive($journal['foreign_amount']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date');
|
||||
$journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date');
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
$locale = Steam::getLocale();
|
||||
// call is correct.
|
||||
Log::debug(sprintf('getAuditReport end: Call finalAccountBalance with date/time "%s"', $this->end->toIso8601String()));
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ use FireflyIII\Notifications\Test\OwnerTestNotificationPushover;
|
||||
use FireflyIII\Notifications\Test\OwnerTestNotificationSlack;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class AdminEventHandler.
|
||||
@@ -45,7 +46,7 @@ class AdminEventHandler
|
||||
{
|
||||
public function sendInvitationNotification(InvitationCreated $event): void
|
||||
{
|
||||
$sendMail = app('fireflyconfig')->get('notification_invite_created', true)->data;
|
||||
$sendMail = FireflyConfig::get('notification_invite_created', true)->data;
|
||||
if (false === $sendMail) {
|
||||
return;
|
||||
}
|
||||
@@ -96,7 +97,7 @@ class AdminEventHandler
|
||||
*/
|
||||
public function sendNewVersion(NewVersionAvailable $event): void
|
||||
{
|
||||
$sendMail = app('fireflyconfig')->get('notification_new_version', true)->data;
|
||||
$sendMail = FireflyConfig::get('notification_new_version', true)->data;
|
||||
if (false === $sendMail) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ use Illuminate\Auth\Events\Login;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class UserEventHandler.
|
||||
@@ -224,7 +225,7 @@ class UserEventHandler
|
||||
|
||||
public function sendAdminRegistrationNotification(RegisteredUser $event): void
|
||||
{
|
||||
$sendMail = (bool)app('fireflyconfig')->get('notification_admin_new_reg', true)->data;
|
||||
$sendMail = (bool)FireflyConfig::get('notification_admin_new_reg', true)->data;
|
||||
if ($sendMail) {
|
||||
$owner = $event->owner;
|
||||
|
||||
@@ -367,7 +368,7 @@ class UserEventHandler
|
||||
*/
|
||||
public function sendRegistrationMail(RegisteredUser $event): void
|
||||
{
|
||||
$sendMail = (bool)app('fireflyconfig')->get('notification_user_new_reg', true)->data;
|
||||
$sendMail = (bool)FireflyConfig::get('notification_user_new_reg', true)->data;
|
||||
if ($sendMail) {
|
||||
try {
|
||||
Notification::send($event->user, new UserRegistrationNotification());
|
||||
|
||||
@@ -33,6 +33,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class VersionCheckEventHandler
|
||||
@@ -54,7 +55,7 @@ class VersionCheckEventHandler
|
||||
Log::debug('Now in checkForUpdates()');
|
||||
|
||||
// should not check for updates:
|
||||
$permission = app('fireflyconfig')->get('permission_update_check', -1);
|
||||
$permission = FireflyConfig::get('permission_update_check', -1);
|
||||
$value = (int) $permission->data;
|
||||
if (1 !== $value) {
|
||||
Log::debug('Update check is not enabled.');
|
||||
@@ -73,7 +74,7 @@ class VersionCheckEventHandler
|
||||
}
|
||||
|
||||
/** @var Configuration $lastCheckTime */
|
||||
$lastCheckTime = app('fireflyconfig')->get('last_update_check', Carbon::now()->getTimestamp());
|
||||
$lastCheckTime = FireflyConfig::get('last_update_check', Carbon::now()->getTimestamp());
|
||||
$now = Carbon::now()->getTimestamp();
|
||||
$diff = $now - $lastCheckTime->data;
|
||||
Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
|
||||
@@ -87,7 +88,7 @@ class VersionCheckEventHandler
|
||||
$release = $this->getLatestRelease();
|
||||
|
||||
session()->flash($release['level'], $release['message']);
|
||||
app('fireflyconfig')->set('last_update_check', Carbon::now()->getTimestamp());
|
||||
FireflyConfig::set('last_update_check', Carbon::now()->getTimestamp());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +108,7 @@ class VersionCheckEventHandler
|
||||
}
|
||||
|
||||
/** @var Configuration $lastCheckTime */
|
||||
$lastCheckTime = app('fireflyconfig')->get('last_update_warning', Carbon::now()->getTimestamp());
|
||||
$lastCheckTime = FireflyConfig::get('last_update_warning', Carbon::now()->getTimestamp());
|
||||
$now = Carbon::now()->getTimestamp();
|
||||
$diff = $now - $lastCheckTime->data;
|
||||
Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
|
||||
@@ -120,6 +121,6 @@ class VersionCheckEventHandler
|
||||
Log::debug('Have warned about a new version in four weeks!');
|
||||
|
||||
session()->flash('info', (string) trans('firefly.disabled_but_check'));
|
||||
app('fireflyconfig')->set('last_update_warning', Carbon::now()->getTimestamp());
|
||||
FireflyConfig::set('last_update_warning', Carbon::now()->getTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace FireflyIII\Handlers\Events;
|
||||
use FireflyIII\Jobs\SendWebhookMessage;
|
||||
use FireflyIII\Models\WebhookMessage;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class WebhookEventHandler
|
||||
@@ -39,7 +40,7 @@ class WebhookEventHandler
|
||||
public function sendWebhookMessages(): void
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
if (false === config('firefly.feature_flags.webhooks') || false === config('firefly.allow_webhooks')) {
|
||||
if (false === config('firefly.feature_flags.webhooks') || false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
Log::debug('Webhook event handler is disabled, do not run sendWebhookMessages().');
|
||||
|
||||
return;
|
||||
|
||||
@@ -52,7 +52,7 @@ class AccountObserver
|
||||
if (!Amount::convertToPrimary($account->user)) {
|
||||
return;
|
||||
}
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($account->user->userGroup);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$currency = $repository->getAccountCurrency($account);
|
||||
if (null !== $currency && $currency->id !== $userCurrency->id && '' !== (string) $account->virtual_balance && 0 !== bccomp($account->virtual_balance, '0')) {
|
||||
|
||||
@@ -42,7 +42,7 @@ class AutoBudgetObserver
|
||||
if (!Amount::convertToPrimary($autoBudget->budget->user)) {
|
||||
return;
|
||||
}
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($autoBudget->budget->user->userGroup);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($autoBudget->budget->user->userGroup);
|
||||
$autoBudget->native_amount = null;
|
||||
if ($autoBudget->transactionCurrency->id !== $userCurrency->id) {
|
||||
$converter = new ExchangeRateConverter();
|
||||
|
||||
@@ -44,7 +44,7 @@ class AvailableBudgetObserver
|
||||
|
||||
return;
|
||||
}
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($availableBudget->user->userGroup);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($availableBudget->user->userGroup);
|
||||
$availableBudget->native_amount = null;
|
||||
if ($availableBudget->transactionCurrency->id !== $userCurrency->id) {
|
||||
$converter = new ExchangeRateConverter();
|
||||
|
||||
@@ -46,7 +46,7 @@ class BillObserver
|
||||
if (!Amount::convertToPrimary($bill->user)) {
|
||||
return;
|
||||
}
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($bill->user->userGroup);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup);
|
||||
$bill->native_amount_min = null;
|
||||
$bill->native_amount_max = null;
|
||||
if ($bill->transactionCurrency->id !== $userCurrency->id) {
|
||||
|
||||
@@ -72,7 +72,7 @@ class BudgetLimitObserver
|
||||
|
||||
return;
|
||||
}
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($budgetLimit->budget->user->userGroup);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($budgetLimit->budget->user->userGroup);
|
||||
$budgetLimit->native_amount = null;
|
||||
if ($budgetLimit->transactionCurrency->id !== $userCurrency->id) {
|
||||
$converter = new ExchangeRateConverter();
|
||||
|
||||
@@ -48,7 +48,7 @@ class PiggyBankEventObserver
|
||||
if (!Amount::convertToPrimary($user)) {
|
||||
return;
|
||||
}
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($event->piggyBank->accounts()->first()->user->userGroup);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($event->piggyBank->accounts()->first()->user->userGroup);
|
||||
$event->native_amount = null;
|
||||
if ($event->piggyBank->transactionCurrency->id !== $userCurrency->id) {
|
||||
$converter = new ExchangeRateConverter();
|
||||
|
||||
@@ -49,7 +49,7 @@ class PiggyBankObserver
|
||||
|
||||
return;
|
||||
}
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($group);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($group);
|
||||
$piggyBank->native_target_amount = null;
|
||||
if ($piggyBank->transactionCurrency->id !== $userCurrency->id) {
|
||||
$converter = new ExchangeRateConverter();
|
||||
|
||||
@@ -28,6 +28,7 @@ use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
|
||||
use FireflyIII\Support\Models\AccountBalanceCalculator;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class TransactionObserver
|
||||
@@ -39,7 +40,7 @@ class TransactionObserver
|
||||
public function created(Transaction $transaction): void
|
||||
{
|
||||
Log::debug('Observe "created" of a transaction.');
|
||||
if (true === config('firefly.feature_flags.running_balance_column') && (1 === bccomp($transaction->amount, '0') && self::$recalculate)) {
|
||||
if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && (1 === bccomp($transaction->amount, '0') && self::$recalculate)) {
|
||||
Log::debug('Trigger recalculateForJournal');
|
||||
AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal);
|
||||
}
|
||||
@@ -51,7 +52,7 @@ class TransactionObserver
|
||||
if (!Amount::convertToPrimary($transaction->transactionJournal->user)) {
|
||||
return;
|
||||
}
|
||||
$userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($transaction->transactionJournal->user->userGroup);
|
||||
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($transaction->transactionJournal->user->userGroup);
|
||||
$transaction->native_amount = null;
|
||||
$transaction->native_foreign_amount = null;
|
||||
// first normal amount
|
||||
@@ -82,7 +83,7 @@ class TransactionObserver
|
||||
public function updated(Transaction $transaction): void
|
||||
{
|
||||
// Log::debug('Observe "updated" of a transaction.');
|
||||
if (true === config('firefly.feature_flags.running_balance_column') && self::$recalculate && 1 === bccomp($transaction->amount, '0')) {
|
||||
if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && self::$recalculate && 1 === bccomp($transaction->amount, '0')) {
|
||||
Log::debug('Trigger recalculateForJournal');
|
||||
AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace FireflyIII\Helpers\Collector\Extensions;
|
||||
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Trait AmountCollection
|
||||
@@ -39,7 +40,7 @@ trait AmountCollection
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->where('source.amount', app('steam')->negative($amount));
|
||||
$q->where('source.amount', Steam::negative($amount));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -50,7 +51,7 @@ trait AmountCollection
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->where('source.amount', '!=', app('steam')->negative($amount));
|
||||
$q->where('source.amount', '!=', Steam::negative($amount));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -64,7 +65,7 @@ trait AmountCollection
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->where('destination.amount', '<=', app('steam')->positive($amount));
|
||||
$q->where('destination.amount', '<=', Steam::positive($amount));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -78,7 +79,7 @@ trait AmountCollection
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->where('destination.amount', '>=', app('steam')->positive($amount));
|
||||
$q->where('destination.amount', '>=', Steam::positive($amount));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -93,7 +94,7 @@ trait AmountCollection
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->whereNotNull('source.foreign_amount');
|
||||
$q->where('source.foreign_amount', app('steam')->negative($amount));
|
||||
$q->where('source.foreign_amount', Steam::negative($amount));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -108,7 +109,7 @@ trait AmountCollection
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->whereNull('source.foreign_amount');
|
||||
$q->orWhere('source.foreign_amount', '!=', app('steam')->negative($amount));
|
||||
$q->orWhere('source.foreign_amount', '!=', Steam::negative($amount));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -123,7 +124,7 @@ trait AmountCollection
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->whereNotNull('destination.foreign_amount');
|
||||
$q->where('destination.foreign_amount', '<=', app('steam')->positive($amount));
|
||||
$q->where('destination.foreign_amount', '<=', Steam::positive($amount));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -138,7 +139,7 @@ trait AmountCollection
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$q->whereNotNull('destination.foreign_amount');
|
||||
$q->where('destination.foreign_amount', '>=', app('steam')->positive($amount));
|
||||
$q->where('destination.foreign_amount', '>=', Steam::positive($amount));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace FireflyIII\Helpers\Update;
|
||||
|
||||
use FireflyIII\Services\FireflyIIIOrg\Update\UpdateRequestInterface;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Trait UpdateTrait
|
||||
@@ -43,7 +44,7 @@ trait UpdateTrait
|
||||
|
||||
/** @var UpdateRequestInterface $checker */
|
||||
$checker = app(UpdateRequestInterface::class);
|
||||
$channelConfig = app('fireflyconfig')->get('update_channel', 'stable');
|
||||
$channelConfig = FireflyConfig::get('update_channel', 'stable');
|
||||
$channel = (string) $channelConfig->data;
|
||||
|
||||
return $checker->getUpdateInformation($channel);
|
||||
|
||||
@@ -38,6 +38,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class EditController
|
||||
@@ -148,9 +149,9 @@ class EditController extends Controller
|
||||
'BIC' => $repository->getMetaValue($account, 'BIC'),
|
||||
'opening_balance_date' => substr((string) $openingBalanceDate, 0, 10),
|
||||
'liability_type_id' => $account->account_type_id,
|
||||
'opening_balance' => app('steam')->bcround($openingBalanceAmount, $currency->decimal_places),
|
||||
'opening_balance' => Steam::bcround($openingBalanceAmount, $currency->decimal_places),
|
||||
'liability_direction' => $this->repository->getMetaValue($account, 'liability_direction'),
|
||||
'virtual_balance' => app('steam')->bcround($virtualBalance, $currency->decimal_places),
|
||||
'virtual_balance' => Steam::bcround($virtualBalance, $currency->decimal_places),
|
||||
'currency_id' => $currency->id,
|
||||
'include_net_worth' => $hasOldInput ? (bool) $request->old('include_net_worth') : $includeNetWorth,
|
||||
'interest' => $repository->getMetaValue($account, 'interest'),
|
||||
|
||||
@@ -23,11 +23,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Admin;
|
||||
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Middleware\IsDemoUser;
|
||||
use FireflyIII\Http\Requests\ConfigurationRequest;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -47,7 +47,7 @@ class ConfigurationController extends Controller
|
||||
|
||||
$this->middleware(
|
||||
static function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.system_settings'));
|
||||
app('view')->share('title', (string)trans('firefly.system_settings'));
|
||||
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
|
||||
|
||||
return $next($request);
|
||||
@@ -63,20 +63,39 @@ class ConfigurationController extends Controller
|
||||
*/
|
||||
public function index(): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$subTitle = (string) trans('firefly.instance_configuration');
|
||||
$subTitleIcon = 'fa-wrench';
|
||||
$subTitle = (string)trans('firefly.instance_configuration');
|
||||
$subTitleIcon = 'fa-wrench';
|
||||
|
||||
Log::channel('audit')->info('User visits admin config index.');
|
||||
|
||||
// all available configuration and their default value in case
|
||||
// they don't exist yet.
|
||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$siteOwner = config('firefly.site_owner');
|
||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$siteOwner = config('firefly.site_owner');
|
||||
|
||||
$enableExchangeRates = FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data;
|
||||
$useRunningBalance = FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data;
|
||||
$enableExternalMap = FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data;
|
||||
$enableExternalRates = FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data;
|
||||
$allowWebhooks = FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data;
|
||||
$validUrlProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data;
|
||||
|
||||
return view(
|
||||
'settings.configuration.index',
|
||||
['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'singleUserMode' => $singleUserMode, 'isDemoSite' => $isDemoSite, 'siteOwner' => $siteOwner]
|
||||
[
|
||||
'subTitle' => $subTitle,
|
||||
'subTitleIcon' => $subTitleIcon,
|
||||
'singleUserMode' => $singleUserMode,
|
||||
'isDemoSite' => $isDemoSite,
|
||||
'siteOwner' => $siteOwner,
|
||||
'enableExchangeRates' => $enableExchangeRates,
|
||||
'useRunningBalance' => $useRunningBalance,
|
||||
'enableExternalMap' => $enableExternalMap,
|
||||
'enableExternalRates' => $enableExternalRates,
|
||||
'allowWebhooks' => $allowWebhooks,
|
||||
'validUrlProtocols' => $validUrlProtocols,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -92,10 +111,19 @@ class ConfigurationController extends Controller
|
||||
|
||||
// store config values
|
||||
FireflyConfig::set('single_user_mode', $data['single_user_mode']);
|
||||
|
||||
FireflyConfig::set('enable_exchange_rates', $data['enable_exchange_rates']);
|
||||
FireflyConfig::set('use_running_balance', $data['use_running_balance']);
|
||||
|
||||
FireflyConfig::set('enable_external_map', $data['enable_external_map']);
|
||||
FireflyConfig::set('enable_external_rates', $data['enable_external_rates']);
|
||||
FireflyConfig::set('allow_webhooks', $data['allow_webhooks']);
|
||||
|
||||
FireflyConfig::set('valid_url_protocols', $data['valid_url_protocols']);
|
||||
FireflyConfig::set('is_demo_site', $data['is_demo_site']);
|
||||
|
||||
// flash message
|
||||
session()->flash('success', (string) trans('firefly.configuration_updated'));
|
||||
session()->flash('success', (string)trans('firefly.configuration_updated'));
|
||||
Preferences::mark();
|
||||
|
||||
return redirect()->route('settings.configuration.index');
|
||||
|
||||
@@ -42,6 +42,7 @@ use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class UserController.
|
||||
@@ -164,7 +165,7 @@ class UserController extends Controller
|
||||
$subTitle = (string) trans('firefly.user_administration');
|
||||
$subTitleIcon = 'fa-users';
|
||||
$users = $this->repository->all();
|
||||
$singleUserMode = (bool) app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$singleUserMode = (bool) FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$allowInvites = false;
|
||||
if (!$this->externalIdentity && $singleUserMode) {
|
||||
// also registration enabled.
|
||||
|
||||
@@ -36,6 +36,7 @@ use Illuminate\View\View;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Safe\Exceptions\UrlException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
use function Safe\parse_url;
|
||||
|
||||
@@ -142,7 +143,7 @@ class ForgotPasswordController extends Controller
|
||||
}
|
||||
|
||||
// is allowed to?
|
||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$userCount = User::count();
|
||||
$allowRegistration = true;
|
||||
$pageTitle = (string) trans('firefly.forgot_pw_page_title');
|
||||
|
||||
@@ -31,6 +31,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Providers\RouteServiceProvider;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
@@ -49,6 +50,7 @@ use Illuminate\Validation\ValidationException;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Symfony\Component\HttpFoundation\Response as ResponseAlias;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class LoginController
|
||||
@@ -132,7 +134,7 @@ class LoginController extends Controller
|
||||
return $this->sendLoginResponse($request);
|
||||
}
|
||||
Log::warning('Login attempt failed.');
|
||||
$username = (string) $request->get($this->username());
|
||||
$username = (string)$request->get($this->username());
|
||||
$user = $this->repository->findByEmail($username);
|
||||
if (!$user instanceof User) {
|
||||
// send event to owner.
|
||||
@@ -228,14 +230,14 @@ class LoginController extends Controller
|
||||
|
||||
$count = DB::table('users')->count();
|
||||
$guard = config('auth.defaults.guard');
|
||||
$title = (string) trans('firefly.login_page_title');
|
||||
$title = (string)trans('firefly.login_page_title');
|
||||
|
||||
if (0 === $count && 'web' === $guard) {
|
||||
return redirect(route('register'));
|
||||
}
|
||||
|
||||
// is allowed to register, etc.
|
||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$allowRegistration = true;
|
||||
$allowReset = true;
|
||||
if (true === $singleUserMode && $count > 0) {
|
||||
@@ -260,4 +262,23 @@ class LoginController extends Controller
|
||||
|
||||
return view('auth.login', ['allowRegistration' => $allowRegistration, 'email' => $email, 'remember' => $remember, 'allowReset' => $allowReset, 'title' => $title, 'usernameField' => $usernameField]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the response after the user was authenticated.
|
||||
*
|
||||
* @return JsonResponse|RedirectResponse
|
||||
*/
|
||||
protected function sendLoginResponse(Request $request)
|
||||
{
|
||||
$request->session()->regenerate();
|
||||
$this->clearLoginAttempts($request);
|
||||
|
||||
if ($response = $this->authenticated($request, $this->guard()->user())) {
|
||||
return $response;
|
||||
}
|
||||
$path = Steam::getSafeUrl(session()->pull('url.intended', route('index')), route('index'));
|
||||
Log::debug(sprintf('SafeURL is %s', $path));
|
||||
|
||||
return $request->wantsJson() ? new JsonResponse([], 204) : redirect()->to($path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\View\View;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class RegisterController
|
||||
@@ -121,7 +122,7 @@ class RegisterController extends Controller
|
||||
$allowRegistration = true;
|
||||
|
||||
try {
|
||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
} catch (ContainerExceptionInterface|NotFoundExceptionInterface) {
|
||||
$singleUserMode = true;
|
||||
}
|
||||
@@ -148,7 +149,7 @@ class RegisterController extends Controller
|
||||
*/
|
||||
public function showInviteForm(Request $request, string $code): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$pageTitle = (string) trans('firefly.register_page_title');
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$allowRegistration = $this->allowedToRegister();
|
||||
@@ -182,7 +183,7 @@ class RegisterController extends Controller
|
||||
*/
|
||||
public function showRegistrationForm(?Request $request = null): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$pageTitle = (string) trans('firefly.register_page_title');
|
||||
$allowRegistration = $this->allowedToRegister();
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\View\View;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
/**
|
||||
* Class ResetPasswordController
|
||||
@@ -131,7 +132,7 @@ class ResetPasswordController extends Controller
|
||||
}
|
||||
|
||||
// is allowed to register?
|
||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||
$userCount = User::count();
|
||||
$allowRegistration = true;
|
||||
$pageTitle = (string) trans('firefly.reset_pw_page_title');
|
||||
|
||||
@@ -35,6 +35,7 @@ use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class EditController
|
||||
@@ -84,8 +85,8 @@ class EditController extends Controller
|
||||
$this->rememberPreviousUrl('bills.edit.url');
|
||||
}
|
||||
|
||||
$bill->amount_min = app('steam')->bcround($bill->amount_min, $bill->transactionCurrency->decimal_places);
|
||||
$bill->amount_max = app('steam')->bcround($bill->amount_max, $bill->transactionCurrency->decimal_places);
|
||||
$bill->amount_min = Steam::bcround($bill->amount_min, $bill->transactionCurrency->decimal_places);
|
||||
$bill->amount_max = Steam::bcround($bill->amount_max, $bill->transactionCurrency->decimal_places);
|
||||
$rules = $this->repository->getRulesForBill($bill);
|
||||
|
||||
// code to handle active-checkboxes
|
||||
|
||||
@@ -44,6 +44,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\View\View;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class BudgetLimitController
|
||||
@@ -204,14 +205,14 @@ class BudgetLimitController extends Controller
|
||||
// add some extra metadata:
|
||||
$spentArr = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection()->push($budget), $currency);
|
||||
$array['spent'] = $spentArr[$currency->id]['sum'] ?? '0';
|
||||
$array['left_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
|
||||
$array['amount_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $limit['amount']);
|
||||
$array['left_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
|
||||
$array['amount_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
|
||||
$array['days_left'] = (string) $this->activeDaysLeft($start, $end);
|
||||
// left per day:
|
||||
$array['left_per_day'] = 0 === bccomp('0', $array['days_left']) ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']);
|
||||
|
||||
// left per day formatted.
|
||||
$array['left_per_day_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']);
|
||||
$array['left_per_day_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']);
|
||||
|
||||
// notes:
|
||||
$array['notes'] = $this->blRepository->getNoteText($limit);
|
||||
@@ -238,8 +239,8 @@ class BudgetLimitController extends Controller
|
||||
$this->blRepository->destroyBudgetLimit($budgetLimit);
|
||||
$array = [
|
||||
'budget_id' => $budgetId,
|
||||
'left_formatted' => app('amount')->formatAnything($currency, '0'),
|
||||
'left_per_day_formatted' => app('amount')->formatAnything($currency, '0'),
|
||||
'left_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'),
|
||||
'left_per_day_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'),
|
||||
'transaction_currency_id' => $currency->id,
|
||||
];
|
||||
|
||||
@@ -268,14 +269,14 @@ class BudgetLimitController extends Controller
|
||||
);
|
||||
$daysLeft = $this->activeDaysLeft($limit->start_date, $limit->end_date);
|
||||
$array['spent'] = $spentArr[$budgetLimit->transactionCurrency->id]['sum'] ?? '0';
|
||||
$array['left_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
|
||||
$array['amount_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $limit['amount']);
|
||||
$array['left_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
|
||||
$array['amount_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
|
||||
$array['days_left'] = (string) $daysLeft;
|
||||
$array['left_per_day'] = 0 === $daysLeft ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']);
|
||||
|
||||
// left per day formatted.
|
||||
$array['amount'] = app('steam')->bcround($limit['amount'], $limit->transactionCurrency->decimal_places);
|
||||
$array['left_per_day_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']);
|
||||
$array['amount'] = Steam::bcround($limit['amount'], $limit->transactionCurrency->decimal_places);
|
||||
$array['left_per_day_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']);
|
||||
if ('true' === $request->get('redirect')) {
|
||||
return redirect(route('budgets.index'));
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class EditController
|
||||
@@ -104,7 +105,7 @@ class EditController extends Controller
|
||||
$amount = '0';
|
||||
}
|
||||
$amount = (string) $amount;
|
||||
$preFilled['auto_budget_amount'] = app('steam')->bcround($amount, $autoBudget->transactionCurrency->decimal_places);
|
||||
$preFilled['auto_budget_amount'] = Steam::bcround($amount, $autoBudget->transactionCurrency->decimal_places);
|
||||
}
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
|
||||
@@ -46,6 +46,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class IndexController
|
||||
@@ -203,7 +204,7 @@ class IndexController extends Controller
|
||||
foreach ($budgetLimits as $limit) {
|
||||
Log::debug(sprintf('Working on budget limit #%d', $limit->id));
|
||||
$currency = $limit->transactionCurrency ?? $primaryCurrency;
|
||||
$amount = app('steam')->bcround($limit->amount, $currency->decimal_places);
|
||||
$amount = Steam::bcround($limit->amount, $currency->decimal_places);
|
||||
$array['budgeted'][] = [
|
||||
'id' => $limit->id,
|
||||
'amount' => $amount,
|
||||
|
||||
@@ -31,6 +31,7 @@ use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class BillController.
|
||||
@@ -113,7 +114,7 @@ class BillController extends Controller
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
$locale = Steam::getLocale();
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
|
||||
@@ -44,6 +44,7 @@ use FireflyIII\Support\Http\Controllers\DateCalculation;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class BudgetController.
|
||||
@@ -166,7 +167,7 @@ class BudgetController extends Controller
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
$locale = Steam::getLocale();
|
||||
$entries = [];
|
||||
$amount = $budgetLimit->amount ?? '0';
|
||||
$budgetCollection = new Collection()->push($budget);
|
||||
@@ -531,13 +532,13 @@ class BudgetController extends Controller
|
||||
// get budget limit in this period for this currency.
|
||||
$limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd);
|
||||
if ($limit instanceof BudgetLimit) {
|
||||
$chartData[1]['entries'][$title] = app('steam')->bcround($limit->amount, $currency->decimal_places);
|
||||
$chartData[1]['entries'][$title] = Steam::bcround($limit->amount, $currency->decimal_places);
|
||||
}
|
||||
|
||||
// get spent amount in this period for this currency.
|
||||
$sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection()->push($budget), $currency);
|
||||
$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0');
|
||||
$chartData[0]['entries'][$title] = app('steam')->bcround($amount, $currency->decimal_places);
|
||||
$amount = Steam::positive($sum[$currency->id]['sum'] ?? '0');
|
||||
$chartData[0]['entries'][$title] = Steam::bcround($amount, $currency->decimal_places);
|
||||
|
||||
$currentStart = clone $currentEnd;
|
||||
$currentStart->addDay()->startOfDay();
|
||||
@@ -574,8 +575,8 @@ class BudgetController extends Controller
|
||||
$currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange);
|
||||
$title = $currentStart->isoFormat($titleFormat);
|
||||
$sum = $this->nbRepository->sumExpenses($currentStart, $currentEnd, $accounts, $currency);
|
||||
$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0');
|
||||
$chartData[$title] = app('steam')->bcround($amount, $currency->decimal_places);
|
||||
$amount = Steam::positive($sum[$currency->id]['sum'] ?? '0');
|
||||
$chartData[$title] = Steam::bcround($amount, $currency->decimal_places);
|
||||
$currentStart = Navigation::addPeriod($currentStart, $preferredRange, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use FireflyIII\Support\Http\Controllers\DateCalculation;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class PiggyBankController.
|
||||
@@ -70,7 +71,7 @@ class PiggyBankController extends Controller
|
||||
}
|
||||
$set = $repository->getEvents($piggyBank);
|
||||
$set = $set->reverse();
|
||||
$locale = app('steam')->getLocale();
|
||||
$locale = Steam::getLocale();
|
||||
|
||||
// get first event or start date of piggy bank or today
|
||||
$startDate = $piggyBank->start_date ?? today(config('app.timezone'));
|
||||
|
||||
@@ -38,6 +38,7 @@ use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
use function Safe\ini_get;
|
||||
use function Safe\realpath;
|
||||
@@ -71,7 +72,7 @@ abstract class Controller extends BaseController
|
||||
public function __construct()
|
||||
{
|
||||
// is site a demo site?
|
||||
$isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false));
|
||||
$isDemoSiteConfig = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site', false));
|
||||
$isDemoSite = (bool) $isDemoSiteConfig->data;
|
||||
View::share('IS_DEMO_SITE', $isDemoSite);
|
||||
View::share('DEMO_USERNAME', config('firefly.demo_username'));
|
||||
@@ -80,7 +81,7 @@ abstract class Controller extends BaseController
|
||||
View::share('FF_BUILD_TIME', config('firefly.build_time'));
|
||||
|
||||
// is webhooks enabled?
|
||||
View::share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === config('firefly.allow_webhooks'));
|
||||
View::share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data);
|
||||
|
||||
// share custom auth guard info.
|
||||
$authGuard = config('firefly.authentication_guard');
|
||||
|
||||
@@ -51,6 +51,7 @@ use Illuminate\View\View;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use Safe\Exceptions\FilesystemException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
use function Safe\file_get_contents;
|
||||
use function Safe\ini_get;
|
||||
@@ -241,7 +242,7 @@ class DebugController extends Controller
|
||||
{
|
||||
$userGuard = config('auth.defaults.guard');
|
||||
|
||||
$config = app('fireflyconfig')->get('last_rt_job', 0);
|
||||
$config = FireflyConfig::get('last_rt_job', 0);
|
||||
$lastTime = (int) $config->data;
|
||||
$lastCronjob = 'never';
|
||||
$lastCronjobAgo = 'never';
|
||||
|
||||
@@ -28,6 +28,7 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use Illuminate\View\View;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
class IndexController extends Controller
|
||||
{
|
||||
@@ -47,7 +48,7 @@ class IndexController extends Controller
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
if (false === config('cer.enabled')) {
|
||||
if (false === FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) {
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,8 +105,8 @@ class JavascriptController extends Controller
|
||||
if ($account instanceof Account) {
|
||||
$currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency;
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
$accounting = app('amount')->getJsConfig();
|
||||
$locale = Steam::getLocale();
|
||||
$accounting = \FireflyIII\Support\Facades\Amount::getJsConfig();
|
||||
$accounting['frac_digits'] = $currency->decimal_places;
|
||||
$pref = Preferences::get('language', config('firefly.default_language', 'en_US'));
|
||||
$lang = $pref->data;
|
||||
|
||||
@@ -121,15 +121,15 @@ class BoxController extends Controller
|
||||
$keys = array_keys($sums);
|
||||
foreach ($keys as $currencyId) {
|
||||
$currency = $repository->find($currencyId);
|
||||
$sums[$currencyId] = app('amount')->formatAnything($currency, $sums[$currencyId], false);
|
||||
$incomes[$currencyId] = app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false);
|
||||
$expenses[$currencyId] = app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false);
|
||||
$sums[$currencyId] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $sums[$currencyId], false);
|
||||
$incomes[$currencyId] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $incomes[$currencyId] ?? '0', false);
|
||||
$expenses[$currencyId] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $expenses[$currencyId] ?? '0', false);
|
||||
}
|
||||
if (0 === count($sums)) {
|
||||
$currency = $this->primaryCurrency;
|
||||
$sums[$this->primaryCurrency->id] = app('amount')->formatAnything($this->primaryCurrency, '0', false);
|
||||
$incomes[$this->primaryCurrency->id] = app('amount')->formatAnything($this->primaryCurrency, '0', false);
|
||||
$expenses[$this->primaryCurrency->id] = app('amount')->formatAnything($this->primaryCurrency, '0', false);
|
||||
$sums[$this->primaryCurrency->id] = \FireflyIII\Support\Facades\Amount::formatAnything($this->primaryCurrency, '0', false);
|
||||
$incomes[$this->primaryCurrency->id] = \FireflyIII\Support\Facades\Amount::formatAnything($this->primaryCurrency, '0', false);
|
||||
$expenses[$this->primaryCurrency->id] = \FireflyIII\Support\Facades\Amount::formatAnything($this->primaryCurrency, '0', false);
|
||||
}
|
||||
|
||||
$response = [
|
||||
@@ -187,7 +187,7 @@ class BoxController extends Controller
|
||||
if ('primary' === $key) {
|
||||
continue;
|
||||
}
|
||||
$return[$data['currency_id']] = app('amount')->formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false);
|
||||
$return[$data['currency_id']] = \FireflyIII\Support\Facades\Amount::formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false);
|
||||
}
|
||||
$return = [
|
||||
'net_worths' => array_values($return),
|
||||
|
||||
@@ -84,9 +84,9 @@ class BudgetController extends Controller
|
||||
return response()->json(
|
||||
[
|
||||
'budgeted' => $budgeted,
|
||||
'budgeted_formatted' => app('amount')->formatAnything($currency, $budgeted, true),
|
||||
'budgeted_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, $budgeted, true),
|
||||
'available' => $available,
|
||||
'available_formatted' => app('amount')->formatAnything($currency, $available, true),
|
||||
'available_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, $available, true),
|
||||
'percentage' => $percentage,
|
||||
'currency_id' => $currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
|
||||
@@ -278,9 +278,9 @@ class ReconcileController extends Controller
|
||||
}
|
||||
|
||||
if ($inverse) {
|
||||
$journal['amount'] = app('steam')->positive($journal['amount']);
|
||||
$journal['amount'] = Steam::positive($journal['amount']);
|
||||
if (null !== $journal['foreign_amount']) {
|
||||
$journal['foreign_amount'] = app('steam')->positive($journal['foreign_amount']);
|
||||
$journal['foreign_amount'] = Steam::positive($journal['foreign_amount']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ use FireflyIII\Models\RecurrenceRepetition;
|
||||
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class RecurrenceController
|
||||
@@ -167,7 +168,7 @@ class RecurrenceController extends Controller
|
||||
}
|
||||
$date->startOfDay();
|
||||
$preSelected = (string) $request->get('pre_select');
|
||||
$locale = app('steam')->getLocale();
|
||||
$locale = Steam::getLocale();
|
||||
|
||||
Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
|
||||
Log::debug(sprintf('past = true? %s', var_export('true' === (string) $request->get('past'), true)));
|
||||
|
||||
@@ -167,7 +167,7 @@ class AmountController extends Controller
|
||||
$piggyBank->refresh();
|
||||
}
|
||||
if (0 !== bccomp($total, '0')) {
|
||||
session()->flash('success', (string) trans('firefly.added_amount_to_piggy', ['amount' => app('amount')->formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name]));
|
||||
session()->flash('success', (string) trans('firefly.added_amount_to_piggy', ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name]));
|
||||
Preferences::mark();
|
||||
|
||||
return redirect(route('piggy-banks.index'));
|
||||
@@ -177,7 +177,7 @@ class AmountController extends Controller
|
||||
'error',
|
||||
(string) trans(
|
||||
'firefly.cannot_add_amount_piggy',
|
||||
['amount' => app('amount')->formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)]
|
||||
['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)]
|
||||
)
|
||||
);
|
||||
|
||||
@@ -214,7 +214,7 @@ class AmountController extends Controller
|
||||
'success',
|
||||
(string) trans(
|
||||
'firefly.removed_amount_from_piggy',
|
||||
['amount' => app('amount')->formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name]
|
||||
['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name]
|
||||
)
|
||||
);
|
||||
Preferences::mark();
|
||||
@@ -226,7 +226,7 @@ class AmountController extends Controller
|
||||
'error',
|
||||
(string) trans(
|
||||
'firefly.cannot_remove_from_piggy',
|
||||
['amount' => app('amount')->formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)]
|
||||
['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)]
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class EditController
|
||||
@@ -89,7 +90,7 @@ class EditController extends Controller
|
||||
$preFilled = [
|
||||
'name' => $piggyBank->name,
|
||||
'transaction_currency_id' => (int) $piggyBank->transaction_currency_id,
|
||||
'target_amount' => app('steam')->bcround($piggyBank->target_amount, $piggyBank->transactionCurrency->decimal_places),
|
||||
'target_amount' => Steam::bcround($piggyBank->target_amount, $piggyBank->transactionCurrency->decimal_places),
|
||||
'target_date' => $targetDate,
|
||||
'start_date' => $startDate,
|
||||
'accounts' => [],
|
||||
|
||||
@@ -44,6 +44,7 @@ use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
use JsonException;
|
||||
use Safe\Exceptions\FilesystemException;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
use function Safe\file_get_contents;
|
||||
use function Safe\json_decode;
|
||||
@@ -108,7 +109,7 @@ class PreferencesController extends Controller
|
||||
if (!is_array($frontpageAccounts)) {
|
||||
$frontpageAccounts = $accountIds;
|
||||
}
|
||||
$language = app('steam')->getLanguage();
|
||||
$language = Steam::getLanguage();
|
||||
$languages = config('firefly.languages');
|
||||
$locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data;
|
||||
$listPageSize = Preferences::get('listPageSize', 50)->data;
|
||||
|
||||
@@ -38,6 +38,7 @@ use Illuminate\Http\Request;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Safe\Exceptions\UrlException;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
|
||||
use function Safe\parse_url;
|
||||
|
||||
@@ -140,7 +141,7 @@ class CreateController extends Controller
|
||||
];
|
||||
$optionalFields['external_url'] ??= false;
|
||||
$optionalFields['location'] ??= false;
|
||||
$optionalFields['location'] = $optionalFields['location'] && true === config('firefly.enable_external_map');
|
||||
$optionalFields['location'] = $optionalFields['location'] && true === FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data;
|
||||
|
||||
// map info:
|
||||
$longitude = config('firefly.default_location.longitude');
|
||||
|
||||
@@ -38,6 +38,7 @@ use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class DeleteController
|
||||
@@ -83,7 +84,7 @@ class DeleteController extends Controller
|
||||
}
|
||||
$objectType = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
|
||||
$subTitle = (string) trans('firefly.delete_'.$objectType, ['description' => $group->title ?? $journal->description]);
|
||||
$previous = app('steam')->getSafePreviousUrl();
|
||||
$previous = Steam::getSafePreviousUrl();
|
||||
// put previous url in session
|
||||
Log::debug('Will try to remember previous URL');
|
||||
$this->rememberPreviousUrl('transactions.delete.url');
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user