mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-14 15:21:20 +00:00
Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4044bb85a9 | ||
|
|
18bb0eecff | ||
|
|
9af95907e3 | ||
|
|
40ecba4b5a | ||
|
|
73312a4ccc | ||
|
|
d747ac237b | ||
|
|
b6c4253d76 | ||
|
|
d74d67633d | ||
|
|
0b00f35101 | ||
|
|
8f81cb8cc4 | ||
|
|
fa665286b5 | ||
|
|
58ae0c1c9b | ||
|
|
7eab4834c8 | ||
|
|
d1332eb592 | ||
|
|
346f2dfaea | ||
|
|
f6037318f4 | ||
|
|
babf9fe96f | ||
|
|
ca3922d00a | ||
|
|
aadb685b57 | ||
|
|
bee62b2115 | ||
|
|
205169a8ad | ||
|
|
5f36bb84a4 | ||
|
|
5b395d870b | ||
|
|
bceb526cb3 | ||
|
|
1f89dddb08 | ||
|
|
a93f2d66af | ||
|
|
551909ea60 | ||
|
|
5667044349 | ||
|
|
6f73e4f2c9 | ||
|
|
1f19f20734 | ||
|
|
91c8f0db80 | ||
|
|
2cdd1aa147 | ||
|
|
5ac51218aa | ||
|
|
80abd277a0 | ||
|
|
b644f28882 | ||
|
|
35a81fd2de | ||
|
|
51e8a1dbe2 | ||
|
|
b799379a0a | ||
|
|
c8edaee848 | ||
|
|
bbe47635d3 | ||
|
|
5c73d238a0 |
50
.ci/php-cs-fixer/composer.lock
generated
50
.ci/php-cs-fixer/composer.lock
generated
@@ -402,16 +402,16 @@
|
||||
},
|
||||
{
|
||||
"name": "friendsofphp/php-cs-fixer",
|
||||
"version": "v3.90.0",
|
||||
"version": "v3.92.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
||||
"reference": "ad732c2e9299c9743f9c55ae53cc0e7642ab1155"
|
||||
"reference": "5646c2cd99b7cb4b658ff681fe27069ba86c7280"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ad732c2e9299c9743f9c55ae53cc0e7642ab1155",
|
||||
"reference": "ad732c2e9299c9743f9c55ae53cc0e7642ab1155",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/5646c2cd99b7cb4b658ff681fe27069ba86c7280",
|
||||
"reference": "5646c2cd99b7cb4b658ff681fe27069ba86c7280",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -467,7 +467,7 @@
|
||||
"PhpCsFixer\\": "src/"
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"src/Fixer/Internal/*"
|
||||
"src/**/Internal/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
@@ -493,7 +493,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.90.0"
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -501,7 +501,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-11-20T15:15:16+00:00"
|
||||
"time": "2025-12-12T10:29:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
@@ -1251,16 +1251,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v8.0.0",
|
||||
"version": "v8.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "307d3cf852f5ead3618ac60ecbedbdd512c348b1"
|
||||
"reference": "fcb73f69d655b48fcb894a262f074218df08bd58"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/307d3cf852f5ead3618ac60ecbedbdd512c348b1",
|
||||
"reference": "307d3cf852f5ead3618ac60ecbedbdd512c348b1",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/fcb73f69d655b48fcb894a262f074218df08bd58",
|
||||
"reference": "fcb73f69d655b48fcb894a262f074218df08bd58",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1317,7 +1317,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v8.0.0"
|
||||
"source": "https://github.com/symfony/console/tree/v8.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1337,7 +1337,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-11-21T13:19:49+00:00"
|
||||
"time": "2025-12-05T15:25:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
@@ -1569,16 +1569,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v8.0.0",
|
||||
"version": "v8.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/filesystem.git",
|
||||
"reference": "7fc96ae83372620eaba3826874f46e26295768ca"
|
||||
"reference": "d937d400b980523dc9ee946bb69972b5e619058d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/7fc96ae83372620eaba3826874f46e26295768ca",
|
||||
"reference": "7fc96ae83372620eaba3826874f46e26295768ca",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/d937d400b980523dc9ee946bb69972b5e619058d",
|
||||
"reference": "d937d400b980523dc9ee946bb69972b5e619058d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1615,7 +1615,7 @@
|
||||
"description": "Provides basic utilities for the filesystem",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/filesystem/tree/v8.0.0"
|
||||
"source": "https://github.com/symfony/filesystem/tree/v8.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1635,7 +1635,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-11-05T14:36:47+00:00"
|
||||
"time": "2025-12-01T09:13:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
@@ -2575,16 +2575,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
"version": "v8.0.0",
|
||||
"version": "v8.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/string.git",
|
||||
"reference": "f929eccf09531078c243df72398560e32fa4cf4f"
|
||||
"reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/f929eccf09531078c243df72398560e32fa4cf4f",
|
||||
"reference": "f929eccf09531078c243df72398560e32fa4cf4f",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/ba65a969ac918ce0cc3edfac6cdde847eba231dc",
|
||||
"reference": "ba65a969ac918ce0cc3edfac6cdde847eba231dc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2641,7 +2641,7 @@
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v8.0.0"
|
||||
"source": "https://github.com/symfony/string/tree/v8.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -2661,7 +2661,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-09-11T14:37:55+00:00"
|
||||
"time": "2025-12-01T09:13:36+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
||||
2
.github/workflows/close-duplicates.yml
vendored
2
.github/workflows/close-duplicates.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
close_duplicates:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: github/command@v2.0.2
|
||||
- uses: github/command@v2.0.3
|
||||
id: command
|
||||
with:
|
||||
allowed_contexts: "issue"
|
||||
|
||||
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Chart;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Chart\ChartRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -32,11 +31,13 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Navigation;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use FireflyIII\Support\Http\Api\ApiSupport;
|
||||
use FireflyIII\Support\Http\Api\CleansChartData;
|
||||
use FireflyIII\Support\Http\Api\CollectsAccountsFromFilter;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
@@ -48,9 +49,9 @@ class AccountController extends Controller
|
||||
use CleansChartData;
|
||||
use CollectsAccountsFromFilter;
|
||||
|
||||
protected array $acceptedRoles = [UserRoleEnum::READ_ONLY];
|
||||
protected array $acceptedRoles = [UserRoleEnum::READ_ONLY];
|
||||
|
||||
private array $chartData = [];
|
||||
private array $chartData = [];
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
@@ -103,7 +104,7 @@ class AccountController extends Controller
|
||||
$currency = $this->repository->getAccountCurrency($account);
|
||||
$currentStart = clone $params['start'];
|
||||
$range = Steam::finalAccountBalanceInRange($account, $params['start'], clone $params['end'], $this->convertToPrimary);
|
||||
|
||||
$period = $params['period'] ?? '1D';
|
||||
|
||||
$previous = array_values($range)[0]['balance'];
|
||||
$pcPrevious = null;
|
||||
@@ -129,7 +130,7 @@ class AccountController extends Controller
|
||||
'end_date' => $params['end']->toAtomString(),
|
||||
'type' => 'line',
|
||||
'yAxisID' => 0,
|
||||
'period' => '1D',
|
||||
'period' => $period,
|
||||
'entries' => [],
|
||||
'pc_entries' => [],
|
||||
];
|
||||
@@ -141,7 +142,7 @@ class AccountController extends Controller
|
||||
$currentSet['primary_currency_decimal_places'] = $this->primaryCurrency->decimal_places;
|
||||
$pcPrevious = array_values($range)[0]['pc_balance'];
|
||||
}
|
||||
|
||||
// create array of values to collect.
|
||||
|
||||
while ($currentStart <= $params['end']) {
|
||||
$format = $currentStart->format('Y-m-d');
|
||||
@@ -158,8 +159,8 @@ class AccountController extends Controller
|
||||
$pcPrevious = $pcBalance;
|
||||
$currentSet['pc_entries'][$label] = $pcBalance;
|
||||
}
|
||||
|
||||
$currentStart->addDay();
|
||||
$currentStart = Navigation::addPeriod($currentStart, $period);
|
||||
// $currentStart->addDay();
|
||||
}
|
||||
$this->chartData[] = $currentSet;
|
||||
}
|
||||
|
||||
@@ -339,6 +339,9 @@ class UpdateRequest extends FormRequest
|
||||
// if more than one, verify that there are journal ID's present.
|
||||
$this->validateJournalIds($validator, $transactionGroup);
|
||||
|
||||
// if more than one split, needs group title
|
||||
$this->validateGroupDescription($validator);
|
||||
|
||||
// all transaction types must be equal:
|
||||
$this->validateTransactionTypesForUpdate($validator);
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/*
|
||||
* ClearsEmptyForeignAmounts.php
|
||||
* Copyright (c) 2025 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Console\Commands\Correction;
|
||||
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ClearsEmptyForeignAmounts extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'correction:clears-empty-foreign-amounts';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Removes references to foreign amounts if there is no amount.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
// transaction: has no amount, but reference to currency.
|
||||
$count = Transaction::whereNull('foreign_amount')->whereNotNull('foreign_currency_id')->count();
|
||||
if ($count > 0) {
|
||||
Transaction::whereNull('foreign_amount')->whereNotNull('foreign_currency_id')->update(['foreign_currency_id' => null]);
|
||||
$this->friendlyInfo(sprintf('Corrected %d invalid foreign amount reference(s)', $count));
|
||||
}
|
||||
// transaction: has amount, but no currency.
|
||||
$count = Transaction::whereNull('foreign_currency_id')->whereNotNull('foreign_amount')->count();
|
||||
if ($count > 0) {
|
||||
Transaction::whereNull('foreign_currency_id')->whereNotNull('foreign_amount')->update(['foreign_amount' => null]);
|
||||
$this->friendlyInfo(sprintf('Corrected %d invalid foreign amount reference(s)', $count));
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,7 @@ class CorrectsDatabase extends Command
|
||||
// 'correction:transaction-types', // resource heavy, disabled.
|
||||
'correction:recalculate-pc-amounts',
|
||||
'correction:remove-links-to-deleted-objects',
|
||||
'correction:clears-empty-foreign-amounts',
|
||||
'firefly-iii:report-integrity',
|
||||
];
|
||||
foreach ($commands as $command) {
|
||||
|
||||
@@ -86,17 +86,27 @@ class RemovesLinksToDeletedObjects extends Command
|
||||
|
||||
private function cleanupJournals(array $journals): void
|
||||
{
|
||||
$count = DB::table('tag_transaction_journal')->whereIn('transaction_journal_id', $journals)->delete();
|
||||
if ($count > 0) {
|
||||
$this->friendlyInfo(sprintf('Removed %d old relationship(s) between tags and transactions.', $count));
|
||||
$countTags = 0;
|
||||
$countBudgets = 0;
|
||||
$countCategories = 0;
|
||||
// #11333
|
||||
foreach (array_chunk($journals, 1337) as $set) {
|
||||
$countTags += DB::table('tag_transaction_journal')->whereIn('transaction_journal_id', $set)->delete();
|
||||
$countBudgets += DB::table('budget_transaction_journal')->whereIn('transaction_journal_id', $set)->delete();
|
||||
$countCategories += DB::table('category_transaction_journal')->whereIn('transaction_journal_id', $set)->delete();
|
||||
}
|
||||
$count = DB::table('budget_transaction_journal')->whereIn('transaction_journal_id', $journals)->delete();
|
||||
if ($count > 0) {
|
||||
$this->friendlyInfo(sprintf('Removed %d old relationship(s) between budgets and transactions.', $count));
|
||||
|
||||
|
||||
|
||||
if ($countTags > 0) {
|
||||
$this->friendlyInfo(sprintf('Removed %d old relationship(s) between tags and transactions.', $countTags));
|
||||
}
|
||||
$count = DB::table('category_transaction_journal')->whereIn('transaction_journal_id', $journals)->delete();
|
||||
if ($count > 0) {
|
||||
$this->friendlyInfo(sprintf('Removed %d old relationship(s) categories and transactions.', $count));
|
||||
|
||||
if ($countBudgets > 0) {
|
||||
$this->friendlyInfo(sprintf('Removed %d old relationship(s) between budgets and transactions.', $countBudgets));
|
||||
}
|
||||
if ($countCategories > 0) {
|
||||
$this->friendlyInfo(sprintf('Removed %d old relationship(s) categories and transactions.', $countCategories));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Console\Commands\Integrity;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ReportSkeleton extends Command
|
||||
{
|
||||
|
||||
protected $description = 'DESCRIPTION HERE';
|
||||
|
||||
protected $signature = 'firefly-iii:INT_COMMAND';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
//
|
||||
$this->warn('Congrats, you found the skeleton command. Boo!');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ class ReportsIntegrity extends Command
|
||||
$commands = [
|
||||
'integrity:empty-objects',
|
||||
'integrity:total-sums',
|
||||
'integrity:file-permissions',
|
||||
];
|
||||
foreach ($commands as $command) {
|
||||
$this->friendlyLine(sprintf('Now executing %s', $command));
|
||||
|
||||
74
app/Console/Commands/Integrity/ValidatesFilePermissions.php
Normal file
74
app/Console/Commands/Integrity/ValidatesFilePermissions.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/*
|
||||
* ValidatesFilePermissions.php
|
||||
* Copyright (c) 2025 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Console\Commands\Integrity;
|
||||
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ValidatesFilePermissions extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'integrity:file-permissions';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$directories = [storage_path('upload')];
|
||||
$errors = false;
|
||||
|
||||
/** @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));
|
||||
$errors = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
if (!is_writable($directory)) {
|
||||
$this->friendlyError(sprintf('Directory "%s" is not writeable. Uploading attachments may fail silently.', $uploadDir));
|
||||
$errors = true;
|
||||
}
|
||||
}
|
||||
if (false === $errors) {
|
||||
$this->friendlyInfo('All necessary file paths seem to exist, and are writeable.');
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/*
|
||||
* TriggeredStoredTransactionGroup.php
|
||||
* Copyright (c) 2025 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Events\Model\TransactionGroup;
|
||||
|
||||
use FireflyIII\Events\Event;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class TriggeredStoredTransactionGroup extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(public TransactionGroup $transactionGroup) {}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Handlers\Events;
|
||||
|
||||
use FireflyIII\Enums\WebhookTrigger;
|
||||
use FireflyIII\Events\Model\TransactionGroup\TriggeredStoredTransactionGroup;
|
||||
use FireflyIII\Events\RequestedSendWebhookMessages;
|
||||
use FireflyIII\Events\StoredTransactionGroup;
|
||||
use FireflyIII\Generator\Webhook\MessageGeneratorInterface;
|
||||
@@ -51,6 +52,12 @@ class StoredGroupEventHandler
|
||||
$this->removePeriodStatistics($event);
|
||||
}
|
||||
|
||||
public function triggerRulesManually(TriggeredStoredTransactionGroup $event): void
|
||||
{
|
||||
$newEvent = new StoredTransactionGroup($event->transactionGroup, true, false);
|
||||
$this->processRules($newEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method grabs all the users rules and processes them.
|
||||
*/
|
||||
|
||||
@@ -122,6 +122,9 @@ class IndexController extends Controller
|
||||
$availableBudgets = $this->getAllAvailableBudgets($start, $end);
|
||||
// get all active budgets:
|
||||
$budgets = $this->getAllBudgets($start, $end, $currencies, $this->primaryCurrency);
|
||||
|
||||
// echo '<pre>';
|
||||
// var_dump($budgets[0]);exit;
|
||||
$sums = $this->getSums($budgets);
|
||||
|
||||
// get budgeted for default currency:
|
||||
|
||||
@@ -113,6 +113,8 @@ class ProfileController extends Controller
|
||||
throw new FireflyException('Invalid token.');
|
||||
}
|
||||
$repository->unblockUser($user);
|
||||
// also remove the "remote_guard_alt_email" preference.
|
||||
Preferences::delete('remote_guard_alt_email');
|
||||
|
||||
// return to log in.
|
||||
session()->flash('success', (string) trans('firefly.login_with_new_email'));
|
||||
|
||||
@@ -26,14 +26,16 @@ namespace FireflyIII\Http\Controllers\RuleGroup;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Events\Model\TransactionGroup\TriggeredStoredTransactionGroup;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Requests\SelectTransactionsRequest;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\TransactionRules\Engine\RuleEngineInterface;
|
||||
use FireflyIII\User;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
@@ -41,18 +43,20 @@ use Illuminate\View\View;
|
||||
*/
|
||||
class ExecutionController extends Controller
|
||||
{
|
||||
private readonly AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* ExecutionController constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.rules'));
|
||||
app('view')->share('title', (string)trans('firefly.rules'));
|
||||
app('view')->share('mainTitleIcon', 'fa-random');
|
||||
|
||||
$this->repository->setUser(auth()->user());
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
@@ -67,34 +71,37 @@ class ExecutionController extends Controller
|
||||
public function execute(SelectTransactionsRequest $request, RuleGroup $ruleGroup): RedirectResponse
|
||||
{
|
||||
// Get parameters specified by the user
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$accounts = implode(',', $request->get('accounts'));
|
||||
// create new rule engine:
|
||||
$newRuleEngine = app(RuleEngineInterface::class);
|
||||
$newRuleEngine->setUser($user);
|
||||
$accounts = $request->get('accounts');
|
||||
$set = $this->repository->getAccountsById($accounts);
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setAccounts($set);
|
||||
// add date operators.
|
||||
if (null !== $request->get('start')) {
|
||||
$startDate = new Carbon($request->get('start'));
|
||||
$newRuleEngine->addOperator(['type' => 'date_after', 'value' => $startDate->format('Y-m-d')]);
|
||||
$collector->setStart($startDate);
|
||||
}
|
||||
if (null !== $request->get('end')) {
|
||||
$endDate = new Carbon($request->get('end'));
|
||||
$newRuleEngine->addOperator(['type' => 'date_before', 'value' => $endDate->format('Y-m-d')]);
|
||||
$collector->setEnd($endDate);
|
||||
}
|
||||
$final = $collector->getGroups();
|
||||
$ids = $final->pluck('id')->toArray();
|
||||
Log::debug(sprintf('Found %d groups collected from %d account(s)', $final->count(), $set->count()));
|
||||
foreach (array_chunk($ids, 1337) as $setOfIds) {
|
||||
Log::debug(sprintf('Now processing %d groups', count($setOfIds)));
|
||||
$groups = TransactionGroup::whereIn('id', $setOfIds)->get();
|
||||
|
||||
/** @var TransactionGroup $group */
|
||||
foreach ($groups as $group) {
|
||||
Log::debug(sprintf('Processing group #%d.', $group->id));
|
||||
event(new TriggeredStoredTransactionGroup($group));
|
||||
}
|
||||
}
|
||||
|
||||
// add extra operators:
|
||||
$newRuleEngine->addOperator(['type' => 'account_id', 'value' => $accounts]);
|
||||
|
||||
// set rules:
|
||||
// #10427, file rule group and not the set of rules.
|
||||
$collection = new Collection()->push($ruleGroup);
|
||||
$newRuleEngine->setRuleGroups($collection);
|
||||
$newRuleEngine->fire();
|
||||
|
||||
// Tell the user that the job is queued
|
||||
session()->flash('success', (string) trans('firefly.applied_rule_group_selection', ['title' => $ruleGroup->title]));
|
||||
session()->flash('success', (string)trans('firefly.applied_rule_group_selection', ['title' => $ruleGroup->title]));
|
||||
|
||||
return redirect()->route('rules.index');
|
||||
}
|
||||
@@ -106,7 +113,7 @@ class ExecutionController extends Controller
|
||||
*/
|
||||
public function selectTransactions(RuleGroup $ruleGroup): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$subTitle = (string) trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);
|
||||
$subTitle = (string)trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);
|
||||
|
||||
return view('rules.rule-group.select-transactions', ['ruleGroup' => $ruleGroup, 'subTitle' => $subTitle]);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ use FireflyIII\Events\Model\PiggyBank\ChangedAmount;
|
||||
use FireflyIII\Events\Model\PiggyBank\ChangedName;
|
||||
use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
|
||||
use FireflyIII\Events\Model\Rule\RuleActionFailedOnObject;
|
||||
use FireflyIII\Events\Model\TransactionGroup\TriggeredStoredTransactionGroup;
|
||||
use FireflyIII\Events\NewVersionAvailable;
|
||||
use FireflyIII\Events\Preferences\UserGroupChangedPrimaryCurrency;
|
||||
use FireflyIII\Events\RegisteredUser;
|
||||
@@ -131,6 +132,9 @@ class EventServiceProvider extends ServiceProvider
|
||||
StoredTransactionGroup::class => [
|
||||
'FireflyIII\Handlers\Events\StoredGroupEventHandler@runAllHandlers',
|
||||
],
|
||||
TriggeredStoredTransactionGroup::class => [
|
||||
'FireflyIII\Handlers\Events\StoredGroupEventHandler@triggerRulesManually',
|
||||
],
|
||||
// is a Transaction Journal related event.
|
||||
UpdatedTransactionGroup::class => [
|
||||
'FireflyIII\Handlers\Events\UpdatedGroupEventHandler@runAllHandlers',
|
||||
|
||||
@@ -78,9 +78,7 @@ class GroupUpdateService
|
||||
if (1 === count($transactions) && 1 === $transactionGroup->transactionJournals()->count()) {
|
||||
/** @var TransactionJournal $first */
|
||||
$first = $transactionGroup->transactionJournals()->first();
|
||||
Log::debug(
|
||||
sprintf('Will now update journal #%d (only journal in group #%d)', $first->id, $transactionGroup->id)
|
||||
);
|
||||
Log::debug(sprintf('Will now update journal #%d (only journal in group #%d)', $first->id, $transactionGroup->id));
|
||||
$this->updateTransactionJournal($transactionGroup, $first, reset($transactions));
|
||||
$transactionGroup->touch();
|
||||
$transactionGroup->refresh();
|
||||
|
||||
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Internal\Update;
|
||||
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidDateException;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
@@ -47,6 +46,7 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
|
||||
use FireflyIII\Services\Internal\Support\JournalServiceTrait;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\Support\NullArrayObject;
|
||||
use FireflyIII\Validation\AccountValidator;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -60,34 +60,36 @@ class JournalUpdateService
|
||||
{
|
||||
use JournalServiceTrait;
|
||||
|
||||
private BillRepositoryInterface $billRepository;
|
||||
private CurrencyRepositoryInterface $currencyRepository;
|
||||
private BillRepositoryInterface $billRepository;
|
||||
private CurrencyRepositoryInterface $currencyRepository;
|
||||
private TransactionGroupRepositoryInterface $transactionGroupRepository;
|
||||
private array $data;
|
||||
private ?Account $destinationAccount = null;
|
||||
private ?Transaction $destinationTransaction = null;
|
||||
private array $metaDate = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date',
|
||||
'invoice_date', ];
|
||||
private array $metaString = [
|
||||
'sepa_cc',
|
||||
'sepa_ct_op',
|
||||
'sepa_ct_id',
|
||||
'sepa_db',
|
||||
'sepa_country',
|
||||
'sepa_ep',
|
||||
'sepa_ci',
|
||||
'sepa_batch_id',
|
||||
'recurrence_id',
|
||||
'internal_reference',
|
||||
'bunq_payment_id',
|
||||
'external_id',
|
||||
'external_url',
|
||||
];
|
||||
private ?Account $sourceAccount = null;
|
||||
private ?Transaction $sourceTransaction = null;
|
||||
private ?TransactionGroup $transactionGroup = null;
|
||||
private ?TransactionJournal $transactionJournal = null;
|
||||
private string $startCompareHash = '';
|
||||
private array $data;
|
||||
private ?Account $destinationAccount = null;
|
||||
private ?Transaction $destinationTransaction = null;
|
||||
private array $metaDate
|
||||
= ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date',
|
||||
'invoice_date', ];
|
||||
private array $metaString
|
||||
= [
|
||||
'sepa_cc',
|
||||
'sepa_ct_op',
|
||||
'sepa_ct_id',
|
||||
'sepa_db',
|
||||
'sepa_country',
|
||||
'sepa_ep',
|
||||
'sepa_ci',
|
||||
'sepa_batch_id',
|
||||
'recurrence_id',
|
||||
'internal_reference',
|
||||
'bunq_payment_id',
|
||||
'external_id',
|
||||
'external_url',
|
||||
];
|
||||
private ?Account $sourceAccount = null;
|
||||
private ?Transaction $sourceTransaction = null;
|
||||
private ?TransactionGroup $transactionGroup = null;
|
||||
private ?TransactionJournal $transactionJournal = null;
|
||||
private string $startCompareHash = '';
|
||||
|
||||
/**
|
||||
* JournalUpdateService constructor.
|
||||
@@ -492,15 +494,7 @@ class JournalUpdateService
|
||||
Log::debug(sprintf('Create date value from string "%s".', $value));
|
||||
$this->transactionJournal->date_tz = $value->format('e');
|
||||
}
|
||||
event(
|
||||
new TriggeredAuditLog(
|
||||
$this->transactionJournal->user,
|
||||
$this->transactionJournal,
|
||||
sprintf('update_%s', $fieldName),
|
||||
$this->transactionJournal->{$fieldName}, // @phpstan-ignore-line
|
||||
$value
|
||||
)
|
||||
);
|
||||
event(new TriggeredAuditLog($this->transactionJournal->user, $this->transactionJournal, sprintf('update_%s', $fieldName), $this->transactionJournal->{$fieldName}, $value));
|
||||
|
||||
$this->transactionJournal->{$fieldName} = $value; // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Updated %s', $fieldName));
|
||||
@@ -671,6 +665,7 @@ class JournalUpdateService
|
||||
$origSourceTransaction->balance_dirty = true;
|
||||
$origSourceTransaction->save();
|
||||
$destTransaction = $this->getDestinationTransaction();
|
||||
$originalAmount = $destTransaction->amount;
|
||||
$destTransaction->amount = app('steam')->positive($amount);
|
||||
$destTransaction->balance_dirty = true;
|
||||
$destTransaction->save();
|
||||
@@ -678,6 +673,23 @@ class JournalUpdateService
|
||||
$this->sourceTransaction->refresh();
|
||||
$this->destinationTransaction->refresh();
|
||||
Log::debug(sprintf('Updated amount to "%s"', $amount));
|
||||
|
||||
event(new TriggeredAuditLog(
|
||||
$this->transactionGroup->user,
|
||||
$this->transactionGroup,
|
||||
'update_amount',
|
||||
[
|
||||
'currency_symbol' => $destTransaction->transactionCurrency->symbol,
|
||||
'decimal_places' => $destTransaction->transactionCurrency->decimal_places,
|
||||
'amount' => $originalAmount,
|
||||
],
|
||||
[
|
||||
'currency_symbol' => $destTransaction->transactionCurrency->symbol,
|
||||
'decimal_places' => $destTransaction->transactionCurrency->decimal_places,
|
||||
'amount' => $value,
|
||||
]
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
private function updateForeignAmount(): void
|
||||
@@ -697,7 +709,7 @@ class JournalUpdateService
|
||||
$newForeignId = $this->data['foreign_currency_id'] ?? null;
|
||||
$newForeignCode = $this->data['foreign_currency_code'] ?? null;
|
||||
$foreignCurrency = $this->currencyRepository->findCurrencyNull($newForeignId, $newForeignCode)
|
||||
?? $foreignCurrency;
|
||||
?? $foreignCurrency;
|
||||
|
||||
// not the same as normal currency
|
||||
if (null !== $foreignCurrency && $foreignCurrency->id === $this->transactionJournal->transaction_currency_id) {
|
||||
|
||||
@@ -151,13 +151,7 @@ class Navigation
|
||||
|
||||
public function diffInPeriods(string $period, int $skip, Carbon $beginning, Carbon $end): int
|
||||
{
|
||||
Log::debug(sprintf(
|
||||
'diffInPeriods: %s (skip: %d), between %s and %s.',
|
||||
$period,
|
||||
$skip,
|
||||
$beginning->format('Y-m-d'),
|
||||
$end->format('Y-m-d')
|
||||
));
|
||||
Log::debug(sprintf('diffInPeriods: %s (skip: %d), between %s and %s.', $period, $skip, $beginning->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
$map = [
|
||||
'daily' => 'diffInDays',
|
||||
'weekly' => 'diffInWeeks',
|
||||
@@ -211,9 +205,14 @@ class Navigation
|
||||
// Log::debug(sprintf('Now in endOfPeriod("%s", "%s").', $currentEnd->toIso8601String(), $repeatFreq));
|
||||
if ('MTD' === $repeatFreq && $end->isFuture()) {
|
||||
// fall back to a monthly schedule if the requested period is MTD.
|
||||
Log::debug('endOfPeriod() requests "MTD", set it to "1M" instead.');
|
||||
Log::debug('endOfPeriod() requests "MTD" + future, set it to "1M" instead.');
|
||||
$repeatFreq = '1M';
|
||||
}
|
||||
if ('YTD' === $repeatFreq && $end->isFuture()) {
|
||||
// fall back to a yearly schedule if the requested period is YTD.
|
||||
Log::debug('endOfPeriod() requests "YTD" + future, set it to "1Y" instead.');
|
||||
$repeatFreq = '1Y';
|
||||
}
|
||||
|
||||
$functionMap = [
|
||||
'1D' => 'endOfDay',
|
||||
|
||||
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\TransactionRules\Actions;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
|
||||
use FireflyIII\Events\Model\Rule\RuleActionFailedOnObject;
|
||||
@@ -33,10 +32,13 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class ConvertToTransfer
|
||||
@@ -77,10 +79,8 @@ class ConvertToTransfer implements ActionInterface
|
||||
$user = $object->user;
|
||||
$journalId = $object->id;
|
||||
if (TransactionTypeEnum::TRANSFER->value === $type) {
|
||||
Log::error(
|
||||
sprintf('Journal #%d is already a transfer so cannot be converted (rule #%d).', $object->id, $this->action->rule_id)
|
||||
);
|
||||
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.is_already_transfer')));
|
||||
Log::error(sprintf('Journal #%d is already a transfer so cannot be converted (rule #%d).', $object->id, $this->action->rule_id));
|
||||
// event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.is_already_transfer')));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -106,15 +106,7 @@ class ConvertToTransfer implements ActionInterface
|
||||
$opposing = $repository->findByName($accountName, [$expectedType]);
|
||||
|
||||
if (null === $opposing) {
|
||||
Log::error(
|
||||
sprintf(
|
||||
'Journal #%d cannot be converted because no valid %s account with name "%s" exists (rule #%d).',
|
||||
$expectedType,
|
||||
$journalId,
|
||||
$accountName,
|
||||
$this->action->rule_id
|
||||
)
|
||||
);
|
||||
Log::error(sprintf('Journal #%d cannot be converted because no valid %s account with name "%s" exists (rule #%d).', $expectedType, $journalId, $accountName, $this->action->rule_id));
|
||||
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_valid_opposing', ['name' => $accountName])));
|
||||
|
||||
return false;
|
||||
@@ -167,7 +159,7 @@ class ConvertToTransfer implements ActionInterface
|
||||
return '';
|
||||
}
|
||||
|
||||
return (string) $journal->transactions()->where('amount', '<', 0)->first()?->account?->accountType?->type;
|
||||
return (string)$journal->transactions()->where('amount', '<', 0)->first()?->account?->accountType?->type;
|
||||
}
|
||||
|
||||
private function getDestinationType(int $journalId): string
|
||||
@@ -180,7 +172,7 @@ class ConvertToTransfer implements ActionInterface
|
||||
return '';
|
||||
}
|
||||
|
||||
return (string) $journal->transactions()->where('amount', '>', 0)->first()?->account?->accountType?->type;
|
||||
return (string)$journal->transactions()->where('amount', '>', 0)->first()?->account?->accountType?->type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,33 +184,57 @@ class ConvertToTransfer implements ActionInterface
|
||||
*/
|
||||
private function convertWithdrawalArray(TransactionJournal $journal, Account $opposing): bool
|
||||
{
|
||||
$sourceAccount = $this->getSourceAccount($journal);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$sourceAccount = $this->getSourceAccount($journal);
|
||||
$repository->setUser($sourceAccount->user);
|
||||
if ($sourceAccount->id === $opposing->id) {
|
||||
Log::error(
|
||||
vsprintf(
|
||||
'Journal #%d has already has "%s" as a source asset. ConvertToTransfer failed. (rule #%d).',
|
||||
[$journal->id, $opposing->name, $this->action->rule_id]
|
||||
)
|
||||
);
|
||||
Log::error(vsprintf('Journal #%d has already has "%s" as a source asset. ConvertToTransfer failed. (rule #%d).', [$journal->id, $opposing->name, $this->action->rule_id]));
|
||||
event(new RuleActionFailedOnObject($this->action, $journal, trans('rules.already_has_source_asset', ['name' => $opposing->name])));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var Transaction $sourceTransaction */
|
||||
$sourceTransaction = Transaction::where('transaction_journal_id', '=', $journal->id)->where('amount', '<', 0)->first();
|
||||
|
||||
/** @var Transaction $destTransaction */
|
||||
$destTransaction = Transaction::where('transaction_journal_id', '=', $journal->id)->where('amount', '>', 0)->first();
|
||||
// update destination transaction:
|
||||
DB::table('transactions')
|
||||
->where('transaction_journal_id', '=', $journal->id)
|
||||
->where('amount', '>', 0)
|
||||
->update(['account_id' => $opposing->id])
|
||||
;
|
||||
$destTransaction->account_id = $opposing->id;
|
||||
$destTransaction->save();
|
||||
|
||||
// check if the currencies are a match.
|
||||
/** @var TransactionCurrency $sourceCurrency */
|
||||
$sourceCurrency = $repository->getAccountCurrency($sourceAccount);
|
||||
|
||||
/** @var TransactionCurrency $destCurrency */
|
||||
$destCurrency = $repository->getAccountCurrency($opposing);
|
||||
|
||||
// if the currencies do not match, need to be smart about the involved amounts:
|
||||
if ($sourceCurrency->id !== $destCurrency->id) {
|
||||
Log::debug(sprintf('Accounts have different currencies. Source has %s, dest has %s', $sourceCurrency->code, $destCurrency->code));
|
||||
$foreignAmount = '' === (string)$sourceTransaction->foreign_amount ? $sourceTransaction->amount : $sourceTransaction->foreign_amount;
|
||||
Log::debug(sprintf('Foreign amount: %s', $foreignAmount));
|
||||
|
||||
// source transaction: set the foreign currency ID and leave as is.
|
||||
$sourceTransaction->foreign_currency_id = $destCurrency->id;
|
||||
$sourceTransaction->foreign_amount = Steam::negative($foreignAmount);
|
||||
$sourceTransaction->save();
|
||||
Log::debug(sprintf('Set source transaction #%d foreign currency ID to #%d (amount: %s)', $sourceTransaction->id, $destCurrency->id, $foreignAmount));
|
||||
|
||||
// dest transaction: set reverse amounts and currency IDs from source transaction.
|
||||
$destTransaction->foreign_currency_id = $sourceCurrency->transaction_currency_id;
|
||||
$destTransaction->transaction_currency_id = $sourceTransaction->foreign_currency_id;
|
||||
$destTransaction->amount = Steam::positive($foreignAmount);
|
||||
$destTransaction->foreign_amount = Steam::positive($sourceTransaction->amount);
|
||||
$destTransaction->save();
|
||||
Log::debug(sprintf('Set dest transaction #%d to #%d %s and foreign #%d %s', $destTransaction->id, $destTransaction->transaction_currency_id, $destTransaction->amount, $destTransaction->foreign_currency_id, $destTransaction->foreign_amount));
|
||||
}
|
||||
|
||||
// change transaction type of journal:
|
||||
$newType = TransactionType::whereType(TransactionTypeEnum::TRANSFER->value)->first();
|
||||
$newType = TransactionType::whereType(TransactionTypeEnum::TRANSFER->value)->first();
|
||||
|
||||
DB::table('transaction_journals')
|
||||
->where('id', '=', $journal->id)
|
||||
->update(['transaction_type_id' => $newType->id, 'bill_id' => null])
|
||||
;
|
||||
DB::table('transaction_journals')->where('id', '=', $journal->id)->update(['transaction_type_id' => $newType->id, 'bill_id' => null]);
|
||||
|
||||
Log::debug('Converted withdrawal to transfer.');
|
||||
|
||||
|
||||
@@ -107,9 +107,9 @@
|
||||
"spatie/laravel-html": "^3.2",
|
||||
"spatie/laravel-ignition": "^2",
|
||||
"spatie/period": "^2.4",
|
||||
"symfony/expression-language": "^7.0",
|
||||
"symfony/http-client": "^7.1",
|
||||
"symfony/mailgun-mailer": "^7.1",
|
||||
"symfony/expression-language": "^8.0",
|
||||
"symfony/http-client": "^8.0",
|
||||
"symfony/mailgun-mailer": "^8.0",
|
||||
"thecodingmachine/safe": "^3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
502
composer.lock
generated
502
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -78,8 +78,8 @@ return [
|
||||
'running_balance_column' => env('USE_RUNNING_BALANCE', false),
|
||||
// see cer.php for exchange rates feature flag.
|
||||
],
|
||||
'version' => '6.4.9',
|
||||
'build_time' => 1764362024,
|
||||
'version' => 'develop/2025-12-14',
|
||||
'build_time' => 1765725141,
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 28, // field is no longer used.
|
||||
|
||||
|
||||
490
package-lock.json
generated
490
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -8,5 +8,8 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"postcss": "^8.4.47"
|
||||
},
|
||||
"dependencies": {
|
||||
"patch-package": "^8.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
diff --git a/node_modules/admin-lte/src/scss/_app-sidebar.scss b/node_modules/admin-lte/src/scss/_app-sidebar.scss
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index 69dfc16..dc341eb
|
||||
index 4420bd0..35da532
|
||||
--- a/node_modules/admin-lte/src/scss/_app-sidebar.scss
|
||||
+++ b/node_modules/admin-lte/src/scss/_app-sidebar.scss
|
||||
@@ -577,7 +577,6 @@ body:not(.app-loaded) {
|
||||
@@ -599,7 +599,6 @@ body:not(.app-loaded) {
|
||||
|
||||
@if $enable-dark-mode {
|
||||
@include color-mode(dark) {
|
||||
@@ -7,7 +7,7 @@
|
||||
"administration_currency_form_help": "It may take a long time for the page to load if you change the primary currency because transaction may need to be converted to your (new) primary currency.",
|
||||
"administrations_page_edit_sub_title_js": "Edit financial administration \"{title}\"",
|
||||
"table": "Tabel",
|
||||
"welcome_back": "Ce se red\u0103?",
|
||||
"welcome_back": "Situa\u021bia ta financiar\u0103",
|
||||
"flash_error": "Eroare!",
|
||||
"flash_warning": "Avertizare!",
|
||||
"flash_success": "Succes!",
|
||||
|
||||
@@ -366,13 +366,21 @@
|
||||
</span>
|
||||
<br/>
|
||||
{% endif %}
|
||||
{% if spentInfo.currency_id == budgetLimit.currency_id and not budgetLimit.in_range %}
|
||||
{% if spentInfo.currency_id == budgetLimit.currency_id and not budgetLimit.in_range and 0.0 == budgetLimit.total_days %}
|
||||
<span class="left_span" data-currency="{{ spentInfo.currency_id }}" data-limit="{{ budgetLimit.id }}"
|
||||
data-value="{{ spentInfo.spent + budgetLimit.amount }}" class="amount_left">
|
||||
{{ formatAmountBySymbol(spentInfo.spent + budgetLimit.amount, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }}
|
||||
</span>
|
||||
<span class="text-muted">({{ 'unknown'|_ }})</span>
|
||||
{% endif %}
|
||||
{% if spentInfo.currency_id == budgetLimit.currency_id and not budgetLimit.in_range and 0.0 != budgetLimit.total_days %}
|
||||
<span class="left_span" data-currency="{{ spentInfo.currency_id }}" data-limit="{{ budgetLimit.id }}"
|
||||
data-value="{{ spentInfo.spent + budgetLimit.amount }}" class="amount_left">
|
||||
{{ formatAmountBySymbol(spentInfo.spent + budgetLimit.amount, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }}
|
||||
</span>
|
||||
({{ formatAmountBySymbol((spentInfo.spent + budgetLimit.amount) / budgetLimit.total_days, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }})
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% if countLimit == 0 %}
|
||||
|
||||
@@ -272,21 +272,35 @@
|
||||
{% if transaction.transaction_type_type == 'Deposit' %}
|
||||
{% if transaction.source_account_id == account.id %}
|
||||
{{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% else %}
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% endif %}
|
||||
|
||||
{% elseif transaction.transaction_type_type == 'Withdrawal' %}
|
||||
|
||||
{# withdrawal into a liability #}
|
||||
{% if 'Loan' == transaction.destination_account_type or 'Mortgage' == transaction.destination_account_type or 'Debt' == transaction.destination_account_type %}
|
||||
{% if currency.id == transaction.currency_id %}
|
||||
{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% if account.id == transaction.source_account_id %}
|
||||
{{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% elseif account.id == transaction.destination_account_id %}
|
||||
{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if currency.id == transaction.foreign_currency_id and null != transaction.destination_balance_after and null != transaction.destination_balance_after %}
|
||||
{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.foreign_currency_symbol ?? transaction.currency_symbol, transaction.foreign_currency_decimal_places ?? transaction.currency_decimal_places) }}
|
||||
{% endif %}
|
||||
|
||||
{# withdrawal into an expense account #}
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% if account.id == transaction.source_account_id %}
|
||||
{{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% elseif account.id == transaction.destination_account_id %}
|
||||
{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% elseif transaction.transaction_type_type == 'Opening balance' %}
|
||||
{% if transaction.source_account_type == 'Initial balance account' %}
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Tests\unit\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Bimonthly;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
|
||||
/**
|
||||
* @group unit-test
|
||||
@@ -41,7 +40,7 @@ use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
*/
|
||||
final class BimonthlyTest extends IntervalTestCase
|
||||
{
|
||||
public static function factory(): Interval
|
||||
public static function factory(): Bimonthly
|
||||
{
|
||||
return new Bimonthly();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Tests\unit\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Daily;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
|
||||
/**
|
||||
* @group unit-test
|
||||
@@ -41,7 +40,7 @@ use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
*/
|
||||
final class DailyTest extends IntervalTestCase
|
||||
{
|
||||
public static function factory(): Interval
|
||||
public static function factory(): Daily
|
||||
{
|
||||
return new Daily();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Tests\unit\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Fortnightly;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
|
||||
/**
|
||||
* @group unit-test
|
||||
@@ -41,7 +40,7 @@ use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
*/
|
||||
final class FortnightlyTest extends IntervalTestCase
|
||||
{
|
||||
public static function factory(): Interval
|
||||
public static function factory(): Fortnightly
|
||||
{
|
||||
return new Fortnightly();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Tests\unit\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\HalfYearly;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
|
||||
/**
|
||||
* @group unit-test
|
||||
@@ -41,7 +40,7 @@ use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
*/
|
||||
final class HalfYearlyTest extends IntervalTestCase
|
||||
{
|
||||
public static function factory(): Interval
|
||||
public static function factory(): HalfYearly
|
||||
{
|
||||
return new HalfYearly();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Tests\unit\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Monthly;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
|
||||
/**
|
||||
* @group unit-test
|
||||
@@ -41,7 +40,7 @@ use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
*/
|
||||
final class MonthlyTest extends IntervalTestCase
|
||||
{
|
||||
public static function factory(): Interval
|
||||
public static function factory(): Monthly
|
||||
{
|
||||
return new Monthly();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Tests\unit\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Quarterly;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
|
||||
/**
|
||||
* @group unit-test
|
||||
@@ -41,7 +40,7 @@ use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
*/
|
||||
final class QuarterlyTest extends IntervalTestCase
|
||||
{
|
||||
public static function factory(): Interval
|
||||
public static function factory(): Quarterly
|
||||
{
|
||||
return new Quarterly();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Tests\unit\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Weekly;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
|
||||
/**
|
||||
* @group unit-test
|
||||
@@ -41,7 +40,7 @@ use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
*/
|
||||
final class WeeklyTest extends IntervalTestCase
|
||||
{
|
||||
public static function factory(): Interval
|
||||
public static function factory(): Weekly
|
||||
{
|
||||
return new Weekly();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace Tests\unit\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Yearly;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Support\Calendar\Periodicity;
|
||||
use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
|
||||
/**
|
||||
* @group unit-test
|
||||
@@ -41,7 +40,7 @@ use FireflyIII\Support\Calendar\Periodicity\Interval;
|
||||
*/
|
||||
final class YearlyTest extends IntervalTestCase
|
||||
{
|
||||
public static function factory(): Interval
|
||||
public static function factory(): Yearly
|
||||
{
|
||||
return new Yearly();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user