mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-30 18:11:45 +00:00
Compare commits
76 Commits
JC5-patch-
...
76899389b8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76899389b8 | ||
|
|
e83fe023d2 | ||
|
|
1dd098a283 | ||
|
|
52164689d4 | ||
|
|
034b14eb0b | ||
|
|
8722d264dc | ||
|
|
3603ef1cc7 | ||
|
|
7abd30f4dd | ||
|
|
3c904c9017 | ||
|
|
d8bdbf2842 | ||
|
|
d08966d141 | ||
|
|
bd71095e40 | ||
|
|
d7967a81e3 | ||
|
|
fa018e80c0 | ||
|
|
eb4b9659cf | ||
|
|
7b7b9118cd | ||
|
|
373e5c3733 | ||
|
|
4e0b1bf65d | ||
|
|
521a496c17 | ||
|
|
5fea35d5b1 | ||
|
|
21a6892601 | ||
|
|
3f386b9003 | ||
|
|
72fb534eb4 | ||
|
|
69b46af245 | ||
|
|
4a901a1b42 | ||
|
|
a8fffc25c0 | ||
|
|
d0dab136b1 | ||
|
|
91184489da | ||
|
|
e4e6cc71c3 | ||
|
|
33d637e618 | ||
|
|
42eb4410f8 | ||
|
|
5f6b345c79 | ||
|
|
30b48a479c | ||
|
|
55d23af802 | ||
|
|
34bfeba63a | ||
|
|
761c20b670 | ||
|
|
d756977ee0 | ||
|
|
40fe0d9c57 | ||
|
|
09b3fa1a52 | ||
|
|
bab767a447 | ||
|
|
341ab69939 | ||
|
|
479b90d9fc | ||
|
|
91889332b4 | ||
|
|
22b623c561 | ||
|
|
75932a9671 | ||
|
|
3ec528812b | ||
|
|
78de800777 | ||
|
|
4456b00cae | ||
|
|
a3c02d7e07 | ||
|
|
d9ff71b1a5 | ||
|
|
2e5528167c | ||
|
|
377486d5c7 | ||
|
|
c91845a0f2 | ||
|
|
0934de09bb | ||
|
|
55c045c791 | ||
|
|
8ff2f817c6 | ||
|
|
49b42538f5 | ||
|
|
3fd31bdf70 | ||
|
|
24e144df5d | ||
|
|
abfa2af278 | ||
|
|
e3efb275a9 | ||
|
|
122a389a95 | ||
|
|
b54d7d5c7b | ||
|
|
897c80c2d8 | ||
|
|
02329a177d | ||
|
|
0ca814f718 | ||
|
|
6e9e47bc19 | ||
|
|
323c93372b | ||
|
|
c43162727f | ||
|
|
db0c7e4d9a | ||
|
|
57ea24e73d | ||
|
|
e7fe6fdd3a | ||
|
|
a498169148 | ||
|
|
68183a0a0e | ||
|
|
d2610be790 | ||
|
|
38691d6fdf |
68
.ci/php-cs-fixer/composer.lock
generated
68
.ci/php-cs-fixer/composer.lock
generated
@@ -402,16 +402,16 @@
|
||||
},
|
||||
{
|
||||
"name": "friendsofphp/php-cs-fixer",
|
||||
"version": "v3.89.2",
|
||||
"version": "v3.90.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
||||
"reference": "7569658f91e475ec93b99bd5964b059ad1336dcf"
|
||||
"reference": "ad732c2e9299c9743f9c55ae53cc0e7642ab1155"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7569658f91e475ec93b99bd5964b059ad1336dcf",
|
||||
"reference": "7569658f91e475ec93b99bd5964b059ad1336dcf",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ad732c2e9299c9743f9c55ae53cc0e7642ab1155",
|
||||
"reference": "ad732c2e9299c9743f9c55ae53cc0e7642ab1155",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -429,17 +429,17 @@
|
||||
"react/socket": "^1.16",
|
||||
"react/stream": "^1.4",
|
||||
"sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0",
|
||||
"symfony/console": "^5.4.47 || ^6.4.24 || ^7.0",
|
||||
"symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0",
|
||||
"symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0",
|
||||
"symfony/finder": "^5.4.45 || ^6.4.24 || ^7.0",
|
||||
"symfony/options-resolver": "^5.4.45 || ^6.4.24 || ^7.0",
|
||||
"symfony/console": "^5.4.47 || ^6.4.24 || ^7.0 || ^8.0",
|
||||
"symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
|
||||
"symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
|
||||
"symfony/finder": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
|
||||
"symfony/options-resolver": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
|
||||
"symfony/polyfill-mbstring": "^1.33",
|
||||
"symfony/polyfill-php80": "^1.33",
|
||||
"symfony/polyfill-php81": "^1.33",
|
||||
"symfony/polyfill-php84": "^1.33",
|
||||
"symfony/process": "^5.4.47 || ^6.4.24 || ^7.2",
|
||||
"symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0"
|
||||
"symfony/process": "^5.4.47 || ^6.4.24 || ^7.2 || ^8.0",
|
||||
"symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"facile-it/paraunit": "^1.3.1 || ^2.7",
|
||||
@@ -451,8 +451,8 @@
|
||||
"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/var-dumper": "^5.4.48 || ^6.4.24 || ^7.3.2",
|
||||
"symfony/yaml": "^5.4.45 || ^6.4.24 || ^7.3.2"
|
||||
"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"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-dom": "For handling output formats in XML",
|
||||
@@ -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.89.2"
|
||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.90.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -501,7 +501,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-11-06T21:12:50+00:00"
|
||||
"time": "2025-11-20T15:15:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
@@ -805,16 +805,16 @@
|
||||
},
|
||||
{
|
||||
"name": "react/dns",
|
||||
"version": "v1.13.0",
|
||||
"version": "v1.14.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/dns.git",
|
||||
"reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5"
|
||||
"reference": "7562c05391f42701c1fccf189c8225fece1cd7c3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5",
|
||||
"reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5",
|
||||
"url": "https://api.github.com/repos/reactphp/dns/zipball/7562c05391f42701c1fccf189c8225fece1cd7c3",
|
||||
"reference": "7562c05391f42701c1fccf189c8225fece1cd7c3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -869,7 +869,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/reactphp/dns/issues",
|
||||
"source": "https://github.com/reactphp/dns/tree/v1.13.0"
|
||||
"source": "https://github.com/reactphp/dns/tree/v1.14.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -877,20 +877,20 @@
|
||||
"type": "open_collective"
|
||||
}
|
||||
],
|
||||
"time": "2024-06-13T14:18:03+00:00"
|
||||
"time": "2025-11-18T19:34:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/event-loop",
|
||||
"version": "v1.5.0",
|
||||
"version": "v1.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/event-loop.git",
|
||||
"reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354"
|
||||
"reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354",
|
||||
"reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354",
|
||||
"url": "https://api.github.com/repos/reactphp/event-loop/zipball/ba276bda6083df7e0050fd9b33f66ad7a4ac747a",
|
||||
"reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -941,7 +941,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/reactphp/event-loop/issues",
|
||||
"source": "https://github.com/reactphp/event-loop/tree/v1.5.0"
|
||||
"source": "https://github.com/reactphp/event-loop/tree/v1.6.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -949,7 +949,7 @@
|
||||
"type": "open_collective"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-13T13:48:05+00:00"
|
||||
"time": "2025-11-17T20:46:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/promise",
|
||||
@@ -1026,16 +1026,16 @@
|
||||
},
|
||||
{
|
||||
"name": "react/socket",
|
||||
"version": "v1.16.0",
|
||||
"version": "v1.17.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/reactphp/socket.git",
|
||||
"reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1"
|
||||
"reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1",
|
||||
"reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1",
|
||||
"url": "https://api.github.com/repos/reactphp/socket/zipball/ef5b17b81f6f60504c539313f94f2d826c5faa08",
|
||||
"reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1094,7 +1094,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/reactphp/socket/issues",
|
||||
"source": "https://github.com/reactphp/socket/tree/v1.16.0"
|
||||
"source": "https://github.com/reactphp/socket/tree/v1.17.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1102,7 +1102,7 @@
|
||||
"type": "open_collective"
|
||||
}
|
||||
],
|
||||
"time": "2024-07-26T10:38:09+00:00"
|
||||
"time": "2025-11-19T20:47:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/stream",
|
||||
@@ -2675,5 +2675,5 @@
|
||||
"prefer-lowest": false,
|
||||
"platform": {},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
"plugin-api-version": "2.9.0"
|
||||
}
|
||||
|
||||
2
.github/workflows/depsreview.yml
vendored
2
.github/workflows/depsreview.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Checkout repository'
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: 'Dependency review'
|
||||
|
||||
67
.github/workflows/issues-reply-old-versions.yml
vendored
67
.github/workflows/issues-reply-old-versions.yml
vendored
@@ -31,6 +31,8 @@ jobs:
|
||||
excludes: prerelease, draft
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: |
|
||||
ISSUE_BODY=$(gh issue view $NUMBER --json body)
|
||||
|
||||
# sure this can be done in a single step but still.
|
||||
FFNOV="${{ steps.ff3version.outputs.release }}"
|
||||
FFNOV="${FFNOV:1}"
|
||||
@@ -38,21 +40,74 @@ jobs:
|
||||
DDNOV="${{ steps.importerversion.outputs.release }}"
|
||||
DDNOV="${DDNOV:1}"
|
||||
|
||||
echo "Version is ${{ steps.ff3version.outputs.release }}, without v is $FFNOV"
|
||||
echo "Firefly III version is ${{ steps.ff3version.outputs.release }}, without v is $FFNOV"
|
||||
echo "Data importer version is ${{ steps.ff3version.outputs.release }}, without v is $FFNOV"
|
||||
|
||||
ISSUE_BODY=$(gh issue view $NUMBER --json body)
|
||||
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY != *${{ steps.ff3version.outputs.release }}* && $ISSUE_BODY != *${{ steps.importerversion.outputs.release }}* ]]; then
|
||||
# user includes no debug info at all, and does not mention current version.
|
||||
# user includes no debug info at all, but does mention current version
|
||||
# user includes debug info, but not the current version.
|
||||
# user includes debug info, and the current version.
|
||||
|
||||
# first test: user includes no debug info at all, and does not mention current version.
|
||||
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY != *"Debug information generated at"* && $ISSUE_BODY != *${{ steps.ff3version.outputs.release }}* && $ISSUE_BODY != *${{ steps.importerversion.outputs.release }}* && $ISSUE_BODY != *$FFNOV* && $ISSUE_BODY != *$DDNOV* ]]; then
|
||||
MESSAGE="Hi there!
|
||||
|
||||
This is an automated reply. \`Share and enjoy\`
|
||||
|
||||
You triggered an automated reply, because it looks like you didn't include the output from the \`/debug\` page. Would you be so kind as to do that? It helps the developers debug your issue more easily.
|
||||
|
||||
If you *did* include debug information or of if the debug information isn't relevant (or even reachable), my apologies for the intrusion."
|
||||
|
||||
gh issue comment "$NUMBER" --body "$MESSAGE"
|
||||
echo "Triggered on first test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# second test: user includes no debug info at all, but does mention current version
|
||||
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY != *"Debug information generated at"* && ( $ISSUE_BODY == *${{ steps.ff3version.outputs.release }}* || $ISSUE_BODY == *${{ steps.importerversion.outputs.release }}* || $ISSUE_BODY == *$FFNOV* || $ISSUE_BODY == *$DDNOV* ) ]]; then
|
||||
MESSAGE="Hi there!
|
||||
|
||||
This is an automated reply. \`Share and enjoy\`
|
||||
|
||||
Thank you for running the latest version of Firefly III (or the data importer). You triggered an automated reply, because it looks like you didn't include the output from the \`/debug\` page. Would you be so kind as to do that? It helps the developers debug your issue more easily.
|
||||
|
||||
If you *did* include debug information or of if the debug information isn't relevant (or even reachable), my apologies for the intrusion."
|
||||
|
||||
gh issue comment "$NUMBER" --body "$MESSAGE"
|
||||
echo "Triggered on second test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# third test: user includes debug info, but not the current version.
|
||||
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY == *"Debug information generated at"* && $ISSUE_BODY != *${{ steps.ff3version.outputs.release }}* && $ISSUE_BODY != *${{ steps.importerversion.outputs.release }}* && $ISSUE_BODY != *$FFNOV* && $ISSUE_BODY != *$DDNOV* ]]; then
|
||||
|
||||
MESSAGE="Hi there!
|
||||
|
||||
This is an automated reply. \`Share and enjoy\`
|
||||
|
||||
You triggered an automated reply, because it looks like you're not running Firefly III version **${{ steps.ff3version.outputs.release }}** or version **${{ steps.importerversion.outputs.release }}** of the data importer.
|
||||
Thank you for including debug information. You triggered an automated reply, because it looks like you're not running Firefly III version **${{ steps.ff3version.outputs.release }}** or version **${{ steps.importerversion.outputs.release }}** of the data importer.
|
||||
|
||||
Please be so kind as to include the output from the \`/debug\`-page, if you have not done so already. If you already included the debug information, plase make sure to upgrade to the latest version of Firefly III (or the data importer) *first*. This may already solve your issue.
|
||||
Please make sure to upgrade to the latest version of Firefly III (or the data importer) *first*. This may already solve your issue.
|
||||
|
||||
If you *are* running the latest version, and this message is wrong, my apologies for the intrusion."
|
||||
|
||||
If you are running the latest version, and this message is wrong, my apologies for the intrusion."
|
||||
gh issue comment "$NUMBER" --body "$MESSAGE"
|
||||
echo "Triggered on third test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# fourth test: user includes debug info, and the current version.
|
||||
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY == *"Debug information generated at"* && ( $ISSUE_BODY == *${{ steps.ff3version.outputs.release }}* || $ISSUE_BODY == *${{ steps.importerversion.outputs.release }}* || $ISSUE_BODY == *$FFNOV* || $ISSUE_BODY == *$DDNOV* ) ]]; then
|
||||
|
||||
MESSAGE="Hi there!
|
||||
|
||||
This is an automated reply. \`Share and enjoy\`
|
||||
|
||||
Thank you for running the latest version of Firefly III (or the data importer)."
|
||||
|
||||
# gh issue comment "$NUMBER" --body "$MESSAGE"
|
||||
echo "Triggered on fourth test"
|
||||
exit 0
|
||||
fi
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
env:
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Import GPG key
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\AccountTypeEnum;
|
||||
@@ -60,7 +61,7 @@ class AccountController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
@@ -138,7 +139,7 @@ class AccountController extends Controller
|
||||
// custom order.
|
||||
usort(
|
||||
$return,
|
||||
static function (array $left, array $right) {
|
||||
static function (array $left, array $right): int {
|
||||
$order = [AccountTypeEnum::ASSET->value, AccountTypeEnum::REVENUE->value, AccountTypeEnum::EXPENSE->value];
|
||||
$posA = (int)array_search($left['type'], $order, true);
|
||||
$posB = (int)array_search($right['type'], $order, true);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -46,7 +47,7 @@ class BillController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(BillRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
@@ -65,7 +66,7 @@ class BillController extends Controller
|
||||
{
|
||||
$result = $this->repository->searchBill($request->attributes->get('query'), $request->attributes->get('limit'));
|
||||
$filtered = $result->map(
|
||||
static fn (Bill $item) => [
|
||||
static fn (Bill $item): array => [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
'active' => $item->active,
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -46,7 +47,7 @@ class BudgetController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
@@ -65,7 +66,7 @@ class BudgetController extends Controller
|
||||
{
|
||||
$result = $this->repository->searchBudget($request->attributes->get('query'), $request->attributes->get('limit'));
|
||||
$filtered = $result->map(
|
||||
static fn (Budget $item) => [
|
||||
static fn (Budget $item): array => [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
'active' => $item->active,
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -46,7 +47,7 @@ class CategoryController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(CategoryRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
@@ -65,7 +66,7 @@ class CategoryController extends Controller
|
||||
{
|
||||
$result = $this->repository->searchCategory($request->attributes->get('query'), $request->attributes->get('limit'));
|
||||
$filtered = $result->map(
|
||||
static fn (Category $item) => [
|
||||
static fn (Category $item): array => [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
]
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Deprecated;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
@@ -48,7 +49,7 @@ class CurrencyController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(CurrencyRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -46,7 +47,7 @@ class ObjectGroupController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(ObjectGroupRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -50,7 +51,7 @@ class PiggyBankController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->piggyRepository = app(PiggyBankRepositoryInterface::class);
|
||||
$this->accountRepository = app(AccountRepositoryInterface::class);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -46,7 +47,7 @@ class RecurrenceController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(RecurringRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -46,7 +47,7 @@ class RuleController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(RuleRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -46,7 +47,7 @@ class RuleGroupController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(RuleGroupRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -46,7 +47,7 @@ class TagController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(TagRepositoryInterface::class);
|
||||
$this->repository->setUser($this->user);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteTransactionApiRequest;
|
||||
@@ -51,7 +52,7 @@ class TransactionController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
$this->groupRepository = app(TransactionGroupRepositoryInterface::class);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -46,7 +47,7 @@ class TransactionTypeController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(TransactionTypeRepositoryInterface::class);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ 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;
|
||||
@@ -59,7 +60,7 @@ class AccountController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository->setUserGroup($this->userGroup);
|
||||
|
||||
@@ -25,6 +25,7 @@ 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\TransactionTypeEnum;
|
||||
@@ -56,7 +57,7 @@ class BalanceController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->collector = app(GroupCollectorInterface::class);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Chart;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\DateRangeRequest;
|
||||
@@ -61,7 +62,7 @@ class BudgetController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->blRepository = app(BudgetLimitRepositoryInterface::class);
|
||||
@@ -140,14 +141,14 @@ class BudgetController extends Controller
|
||||
}
|
||||
|
||||
// convert data if necessary.
|
||||
if (true === $this->convertToPrimary && $currencyId !== $this->primaryCurrency->id) {
|
||||
if ($this->convertToPrimary && $currencyId !== $this->primaryCurrency->id) {
|
||||
$currencies[$currencyId] ??= Amount::getTransactionCurrencyById($currencyId);
|
||||
$row['pc_budgeted'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['budgeted']);
|
||||
$row['pc_spent'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['spent']);
|
||||
$row['pc_left'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['left']);
|
||||
$row['pc_overspent'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['overspent']);
|
||||
}
|
||||
if (true === $this->convertToPrimary && $currencyId === $this->primaryCurrency->id) {
|
||||
if ($this->convertToPrimary && $currencyId === $this->primaryCurrency->id) {
|
||||
$row['pc_budgeted'] = $row['budgeted'];
|
||||
$row['pc_spent'] = $row['spent'];
|
||||
$row['pc_left'] = $row['left'];
|
||||
@@ -265,7 +266,7 @@ class BudgetController extends Controller
|
||||
|
||||
/** @var BudgetLimit $current */
|
||||
foreach ($limits as $current) {
|
||||
if (true === $this->convertToPrimary) {
|
||||
if ($this->convertToPrimary) {
|
||||
if ($current->transaction_currency_id === $this->primaryCurrency->id) {
|
||||
// simply add it.
|
||||
$amount = bcadd($amount, (string)$current->amount);
|
||||
@@ -283,7 +284,7 @@ class BudgetController extends Controller
|
||||
$limit = $current;
|
||||
}
|
||||
}
|
||||
if (null !== $limit && true === $this->convertToPrimary) {
|
||||
if (null !== $limit && $this->convertToPrimary) {
|
||||
// convert and add all amounts.
|
||||
$limit->amount = app('steam')->positive($amount);
|
||||
Log::debug(sprintf('Final amount in limit with converted amount %s', $limit->amount));
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Chart;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\DateRangeRequest;
|
||||
@@ -58,7 +59,7 @@ class CategoryController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->accountRepos = app(AccountRepositoryInterface::class);
|
||||
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
@@ -181,7 +182,7 @@ class CategoryController extends Controller
|
||||
$return = array_values($return);
|
||||
|
||||
// order by amount
|
||||
usort($return, static fn (array $a, array $b) => ((float)$a['entries']['spent'] + (float)$a['entries']['earned']) < ((float)$b['entries']['spent'] + (float)$b['entries']['earned']) ? 1 : -1);
|
||||
usort($return, static fn (array $a, array $b): int => ((float)$a['entries']['spent'] + (float)$a['entries']['earned']) < ((float)$b['entries']['spent'] + (float)$b['entries']['earned']) ? 1 : -1);
|
||||
|
||||
return response()->json($this->clean($return));
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers;
|
||||
|
||||
use Deprecated;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use FireflyIII\Exceptions\BadHttpHeaderException;
|
||||
@@ -100,10 +101,10 @@ abstract class Controller extends BaseController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use Request classes
|
||||
* Method to grab all parameters from the URL
|
||||
*/
|
||||
#[Deprecated(message: <<<'TXT'
|
||||
use Request classes
|
||||
Method to grab all parameters from the URL
|
||||
TXT)]
|
||||
private function getParameters(): ParameterBag
|
||||
{
|
||||
$bag = new ParameterBag();
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Data\Bulk;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Data\Bulk\TransactionRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -51,7 +52,7 @@ class TransactionController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->repository->setUserGroup($this->userGroup);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Data;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Data\DestroyRequest;
|
||||
use FireflyIII\Enums\AccountTypeEnum;
|
||||
@@ -63,7 +64,7 @@ class DestroyController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
|
||||
return $next($request);
|
||||
@@ -185,7 +186,7 @@ class DestroyController extends Controller
|
||||
/** @var Account $account */
|
||||
foreach ($collection as $account) {
|
||||
$count = $account->transactions()->count();
|
||||
if (true === $this->unused && 0 === $count) {
|
||||
if ($this->unused && 0 === $count) {
|
||||
Log::info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name));
|
||||
Log::channel('audit')->info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name));
|
||||
$service->destroy($account, null);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Data\Export;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Data\Export\ExportRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -49,7 +50,7 @@ class ExportController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
$this->exporter = app(ExportDataGenerator::class);
|
||||
$this->exporter->setUserGroup($this->userGroup);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Data;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
use FireflyIII\Models\Account;
|
||||
@@ -51,7 +52,7 @@ class PurgeController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->validateUserGroup($request);
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\DestroyRequest;
|
||||
@@ -47,7 +48,7 @@ class DestroyController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->repository = app(ExchangeRateRepositoryInterface::class);
|
||||
$this->repository->setUserGroup($this->validateUserGroup($request));
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
|
||||
@@ -39,7 +40,7 @@ class IndexController extends Controller
|
||||
{
|
||||
use ValidatesUserGroupTrait;
|
||||
|
||||
public const string RESOURCE_KEY = 'currency_exchange_rates';
|
||||
public const string RESOURCE_KEY = 'exchange-rates';
|
||||
protected array $acceptedRoles = [UserRoleEnum::OWNER];
|
||||
private ExchangeRateRepositoryInterface $repository;
|
||||
|
||||
@@ -47,7 +48,7 @@ class IndexController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->repository = app(ExchangeRateRepositoryInterface::class);
|
||||
$this->repository->setUserGroup($this->validateUserGroup($request));
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -51,7 +52,7 @@ class ShowController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->repository = app(ExchangeRateRepositoryInterface::class);
|
||||
$this->repository->setUserGroup($this->validateUserGroup($request));
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\StoreByCurrenciesRequest;
|
||||
@@ -52,7 +53,7 @@ class StoreController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->repository = app(ExchangeRateRepositoryInterface::class);
|
||||
$this->repository->setUserGroup($this->validateUserGroup($request));
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\UpdateRequest;
|
||||
@@ -48,7 +49,7 @@ class UpdateController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
$this->repository = app(ExchangeRateRepositoryInterface::class);
|
||||
$this->repository->setUserGroup($this->validateUserGroup($request));
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Controllers\Models\Transaction;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Models\Transaction\StoreRequest;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
@@ -61,7 +62,7 @@ class StoreController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
function (Request $request, $next) {
|
||||
/** @var User $admin */
|
||||
$admin = auth()->user();
|
||||
$userGroup = $this->validateUserGroup($request);
|
||||
|
||||
@@ -90,7 +90,7 @@ class ListController extends Controller
|
||||
|
||||
// filter list on currency preference:
|
||||
$collection = $unfiltered->filter(
|
||||
static function (Account $account) use ($currency, $accountRepository) {
|
||||
static function (Account $account) use ($currency, $accountRepository): bool {
|
||||
$currencyId = (int) $accountRepository->getMetaValue($account, 'currency_id');
|
||||
|
||||
return $currencyId === $currency->id;
|
||||
@@ -178,7 +178,7 @@ class ListController extends Controller
|
||||
|
||||
// filter and paginate list:
|
||||
$collection = $unfiltered->filter(
|
||||
static fn (Bill $bill) => $bill->transaction_currency_id === $currency->id
|
||||
static fn (Bill $bill): bool => $bill->transaction_currency_id === $currency->id
|
||||
);
|
||||
$count = $collection->count();
|
||||
$bills = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
@@ -261,8 +261,8 @@ class ListController extends Controller
|
||||
|
||||
// filter selection
|
||||
$collection = $unfiltered->filter(
|
||||
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line
|
||||
if (array_any($recurrence->recurrenceTransactions, fn ($transaction) => $transaction->transaction_currency_id === $currency->id || $transaction->foreign_currency_id === $currency->id)) {
|
||||
static function (Recurrence $recurrence) use ($currency): ?Recurrence { // @phpstan-ignore-line
|
||||
if (array_any($recurrence->recurrenceTransactions, fn ($transaction): bool => $transaction->transaction_currency_id === $currency->id || $transaction->foreign_currency_id === $currency->id)) {
|
||||
return $recurrence;
|
||||
}
|
||||
|
||||
@@ -310,8 +310,8 @@ class ListController extends Controller
|
||||
$unfiltered = $ruleRepos->getAll();
|
||||
|
||||
$collection = $unfiltered->filter(
|
||||
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line
|
||||
if (array_any($rule->ruleTriggers, fn ($trigger) => 'currency_is' === $trigger->trigger_type && $currency->name === $trigger->trigger_value)) {
|
||||
static function (Rule $rule) use ($currency): ?Rule { // @phpstan-ignore-line
|
||||
if (array_any($rule->ruleTriggers, fn ($trigger): bool => 'currency_is' === $trigger->trigger_type && $currency->name === $trigger->trigger_value)) {
|
||||
return $rule;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,18 +45,17 @@ class AccountController extends Controller
|
||||
{
|
||||
use AccountFilter;
|
||||
|
||||
private array $validFields;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->validFields = [
|
||||
private array $validFields = [
|
||||
AccountSearch::SEARCH_ALL,
|
||||
AccountSearch::SEARCH_ID,
|
||||
AccountSearch::SEARCH_NAME,
|
||||
AccountSearch::SEARCH_IBAN,
|
||||
AccountSearch::SEARCH_NUMBER,
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -591,7 +591,7 @@ class BasicController extends Controller
|
||||
|
||||
// filter list on preference of being included.
|
||||
$filtered = $allAccounts->filter(
|
||||
function (Account $account) {
|
||||
function (Account $account): bool {
|
||||
$includeNetWorth = $this->accountRepository->getMetaValue($account, 'include_net_worth');
|
||||
|
||||
return null === $includeNetWorth || '1' === $includeNetWorth;
|
||||
@@ -651,11 +651,8 @@ class BasicController extends Controller
|
||||
if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) {
|
||||
return true;
|
||||
}
|
||||
// start and end in the past? use $end
|
||||
if ($start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
// start and end in the past? use $end
|
||||
return $start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
use Override;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
use RuntimeException;
|
||||
|
||||
abstract class AggregateFormRequest extends ApiRequest
|
||||
@@ -39,6 +40,7 @@ abstract class AggregateFormRequest extends ApiRequest
|
||||
/** @return array<array|string> */
|
||||
abstract protected function getRequests(): array;
|
||||
|
||||
#[Override]
|
||||
public function initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null): void
|
||||
{
|
||||
parent::initialize($query, $request, $attributes, $cookies, $files, $server, $content);
|
||||
@@ -76,7 +78,7 @@ abstract class AggregateFormRequest extends ApiRequest
|
||||
// check all subrequests for rules and combine them
|
||||
return array_reduce(
|
||||
$this->requests,
|
||||
static fn (array $rules, FormRequest $request) => $rules
|
||||
static fn (array $rules, FormRequest $request): array => $rules
|
||||
+ (
|
||||
method_exists($request, 'rules')
|
||||
? $request->rules()
|
||||
@@ -91,7 +93,7 @@ abstract class AggregateFormRequest extends ApiRequest
|
||||
// register all subrequests' validators
|
||||
foreach ($this->requests as $request) {
|
||||
if (method_exists($request, 'withValidator')) {
|
||||
Log::debug(sprintf('Process withValidator from class %s', get_class($request)));
|
||||
Log::debug(sprintf('Process withValidator from class %s', $request::class));
|
||||
$request->withValidator($validator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Chart;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Enums\UserRoleEnum;
|
||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class ChartRequest
|
||||
|
||||
@@ -24,12 +24,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Data\Bulk;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class MoveTransactionsRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Data\Bulk;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Enums\ClauseType;
|
||||
use FireflyIII\Rules\IsValidBulkClause;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\Validation\Api\Data\Bulk\ValidatesBulkTransactionQuery;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
use JsonException;
|
||||
|
||||
use function Safe\json_decode;
|
||||
|
||||
@@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
use Illuminate\Validation\Validator;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
class DateRangeRequest extends ApiRequest
|
||||
{
|
||||
|
||||
@@ -23,8 +23,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class DateRequest extends ApiRequest
|
||||
{
|
||||
|
||||
@@ -24,13 +24,15 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Api\V1\Requests\Generic;
|
||||
|
||||
use FireflyIII\Api\V1\Requests\ApiRequest;
|
||||
use FireflyIII\Enums\AccountTypeEnum;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Rules\Account\IsValidAccountTypeList;
|
||||
use FireflyIII\Rules\TransactionType\IsValidTransactionTypeList;
|
||||
use FireflyIII\Support\Http\Api\AccountFilter;
|
||||
use FireflyIII\Support\Http\Api\TransactionFilter;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Override;
|
||||
use RuntimeException;
|
||||
|
||||
class ObjectTypeApiRequest extends ApiRequest
|
||||
@@ -40,6 +42,7 @@ class ObjectTypeApiRequest extends ApiRequest
|
||||
|
||||
private ?string $objectType = null;
|
||||
|
||||
#[Override]
|
||||
public function handleConfig(array $config): void
|
||||
{
|
||||
parent::handleConfig($config);
|
||||
@@ -86,7 +89,11 @@ class ObjectTypeApiRequest extends ApiRequest
|
||||
|
||||
// no break
|
||||
case Account::class:
|
||||
$this->attributes->set('types', $this->mapAccountTypes($type));
|
||||
$types = $this->mapAccountTypes($type);
|
||||
|
||||
// remove system account types because autocomplete doesn't need them.
|
||||
$types = array_values(array_diff($types, [AccountTypeEnum::INITIAL_BALANCE->value, AccountTypeEnum::RECONCILIATION->value, AccountTypeEnum::LIABILITY_CREDIT->value]));
|
||||
$this->attributes->set('types', $types);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Generic;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Api\V1\Requests\ApiRequest;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class QueryRequest extends ApiRequest
|
||||
{
|
||||
|
||||
@@ -23,9 +23,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Account;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Api\V1\Requests\ApiRequest;
|
||||
use FireflyIII\Support\Http\Api\AccountFilter;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class AccountTypeApiRequest extends ApiRequest
|
||||
{
|
||||
|
||||
@@ -23,10 +23,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Account;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Api\V1\Requests\ApiRequest;
|
||||
use FireflyIII\Rules\Account\IsValidAccountTypeList;
|
||||
use FireflyIII\Support\Http\Api\AccountFilter;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class AccountTypesApiRequest extends ApiRequest
|
||||
{
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace FireflyIII\Api\V1\Requests\Models\Account;
|
||||
use FireflyIII\Api\V1\Requests\AggregateFormRequest;
|
||||
use FireflyIII\Api\V1\Requests\DateRangeRequest;
|
||||
use FireflyIII\Api\V1\Requests\DateRequest;
|
||||
use FireflyIII\Api\V1\Requests\Generic\ObjectTypeApiRequest;
|
||||
use FireflyIII\Api\V1\Requests\PaginationRequest;
|
||||
use FireflyIII\Models\Account;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Account;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Location;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
@@ -35,7 +36,6 @@ use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
|
||||
@@ -58,7 +58,7 @@ class StoreRequest extends FormRequest
|
||||
{
|
||||
$models = config('firefly.valid_attachment_models');
|
||||
$models = array_map(
|
||||
static fn (string $className) => str_replace('FireflyIII\Models\\', '', $className),
|
||||
static fn (string $className): string => str_replace('FireflyIII\Models\\', '', $className),
|
||||
$models
|
||||
);
|
||||
$models = implode(',', $models);
|
||||
|
||||
@@ -60,7 +60,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
$models = config('firefly.valid_attachment_models');
|
||||
$models = array_map(
|
||||
static fn (string $className) => str_replace('FireflyIII\Models\\', '', $className),
|
||||
static fn (string $className): string => str_replace('FireflyIII\Models\\', '', $className),
|
||||
$models
|
||||
);
|
||||
$models = implode(',', $models);
|
||||
|
||||
@@ -24,13 +24,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\AvailableBudget;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class Request
|
||||
|
||||
@@ -24,13 +24,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Bill;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
use TypeError;
|
||||
use ValueError;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Bill;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Budget;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class StoreRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Budget;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
@@ -32,7 +33,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\BudgetLimit;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Factory\TransactionCurrencyFactory;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
@@ -33,7 +34,6 @@ use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class StoreRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\BudgetLimit;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
|
||||
@@ -24,12 +24,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class StoreByCurrenciesRequest extends FormRequest
|
||||
{
|
||||
|
||||
@@ -24,13 +24,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class StoreByDateRequest extends FormRequest
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\PiggyBank;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Rules\IsValidZeroOrMoreAmount;
|
||||
@@ -32,7 +33,6 @@ use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class StoreRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Recurrence;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
@@ -35,7 +36,6 @@ use FireflyIII\Validation\RecurrenceValidation;
|
||||
use FireflyIII\Validation\TransactionValidation;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class StoreRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Recurrence;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
@@ -36,7 +37,6 @@ use FireflyIII\Validation\RecurrenceValidation;
|
||||
use FireflyIII\Validation\TransactionValidation;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Rule;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidActionExpression;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\Support\Request\GetRuleConfiguration;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class StoreRequest
|
||||
@@ -202,7 +202,7 @@ class StoreRequest extends FormRequest
|
||||
$inactiveIndex = $index;
|
||||
}
|
||||
}
|
||||
if (true === $allInactive) {
|
||||
if ($allInactive) {
|
||||
$validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger'));
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ class StoreRequest extends FormRequest
|
||||
$inactiveIndex = $index;
|
||||
}
|
||||
}
|
||||
if (true === $allInactive) {
|
||||
if ($allInactive) {
|
||||
$validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Rule;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidActionExpression;
|
||||
@@ -32,7 +33,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\Support\Request\GetRuleConfiguration;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
@@ -207,7 +207,7 @@ class UpdateRequest extends FormRequest
|
||||
$inactiveIndex = $index;
|
||||
}
|
||||
}
|
||||
if (true === $allInactive) {
|
||||
if ($allInactive) {
|
||||
$validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger'));
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@ class UpdateRequest extends FormRequest
|
||||
$inactiveIndex = $index;
|
||||
}
|
||||
}
|
||||
if (true === $allInactive) {
|
||||
if ($allInactive) {
|
||||
$validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Transaction;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Models\Location;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
@@ -39,7 +40,6 @@ use FireflyIII\Validation\GroupValidation;
|
||||
use FireflyIII\Validation\TransactionValidation;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class StoreRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\Transaction;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Rules\BelongsUser;
|
||||
@@ -37,7 +38,6 @@ use FireflyIII\Validation\GroupValidation;
|
||||
use FireflyIII\Validation\TransactionValidation;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
|
||||
@@ -23,8 +23,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\TransactionCurrency;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Api\V1\Requests\ApiRequest;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class CurrencyCodeRequest extends ApiRequest
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\TransactionLink;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class StoreRequest
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\Models\TransactionLink;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Models\TransactionJournalLink;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class UpdateRequest
|
||||
|
||||
@@ -52,7 +52,7 @@ class CreateRequest extends FormRequest
|
||||
$responses = $this->get('responses', []);
|
||||
$deliveries = $this->get('deliveries', []);
|
||||
|
||||
if (0 === count($triggers) || 0 === count($responses) || 0 === count($deliveries)) {
|
||||
if (in_array(0, [count($triggers), count($responses), count($deliveries)], true)) {
|
||||
throw new FireflyException('Unexpectedly got no responses, triggers or deliveries.');
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class UpdateRequest extends FormRequest
|
||||
$responses = $this->get('responses', []);
|
||||
$deliveries = $this->get('deliveries', []);
|
||||
|
||||
if (0 === count($triggers) || 0 === count($responses) || 0 === count($deliveries)) {
|
||||
if (in_array(0, [count($triggers), count($responses), count($deliveries)], true)) {
|
||||
throw new FireflyException('Unexpectedly got no responses, triggers or deliveries.');
|
||||
}
|
||||
|
||||
|
||||
@@ -23,16 +23,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests;
|
||||
|
||||
use Override;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Rules\IsValidSortInstruction;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Validation\Validator;
|
||||
use RuntimeException;
|
||||
|
||||
class PaginationRequest extends ApiRequest
|
||||
{
|
||||
private ?string $sortClass = null;
|
||||
|
||||
#[Override]
|
||||
public function handleConfig(array $config): void
|
||||
{
|
||||
parent::handleConfig($config);
|
||||
|
||||
@@ -24,13 +24,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Api\V1\Requests\System;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class UserUpdateRequest
|
||||
|
||||
@@ -220,7 +220,7 @@ class CorrectsAmounts extends Command
|
||||
/** @var RuleTrigger $item */
|
||||
foreach ($set as $item) {
|
||||
$result = $this->fixRuleTrigger($item);
|
||||
if (true === $result) {
|
||||
if ($result) {
|
||||
++$fixed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ class CorrectsCurrencies extends Command
|
||||
$found = array_values(
|
||||
array_filter(
|
||||
$found,
|
||||
static fn (int $currencyId) => 0 !== $currencyId
|
||||
static fn (int $currencyId): bool => 0 !== $currencyId
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ class CorrectsDatabase extends Command
|
||||
'correction:group-accounts',
|
||||
'correction:recalculates-liabilities',
|
||||
'correction:preferences',
|
||||
'correction:corrects-inverted-budget-limits',
|
||||
// 'correction:transaction-types', // resource heavy, disabled.
|
||||
'correction:recalculate-pc-amounts',
|
||||
'correction:remove-links-to-deleted-objects',
|
||||
|
||||
@@ -55,10 +55,8 @@ class CorrectsGroupInformation extends Command
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): int
|
||||
{
|
||||
// objects: accounts, attachments, available budgets, bills, budgets, categories, currency_exchange_rates
|
||||
// recurrences, rule groups, rules, tags, transaction groups, transaction journals, webhooks
|
||||
|
||||
@@ -93,12 +93,8 @@ class CorrectsIbans extends Command
|
||||
if (in_array($type, [AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value], true)) {
|
||||
$type = 'liabilities';
|
||||
}
|
||||
if (array_key_exists($iban, $set[$userId])) {
|
||||
// iban already in use! two exceptions exist:
|
||||
if (
|
||||
!(AccountTypeEnum::EXPENSE->value === $set[$userId][$iban] && AccountTypeEnum::REVENUE->value === $type) // allowed combination
|
||||
&& !(AccountTypeEnum::REVENUE->value === $set[$userId][$iban] && AccountTypeEnum::EXPENSE->value === $type) // also allowed combination.
|
||||
) {
|
||||
if (array_key_exists($iban, $set[$userId]) && (!AccountTypeEnum::EXPENSE->value === $set[$userId][$iban] && AccountTypeEnum::REVENUE->value === $type && !(AccountTypeEnum::REVENUE->value === $set[$userId][$iban] && AccountTypeEnum::EXPENSE->value === $type))) {
|
||||
$this->friendlyWarning(
|
||||
sprintf(
|
||||
'IBAN "%s" is used more than once and will be removed from %s #%d ("%s")',
|
||||
@@ -112,7 +108,6 @@ class CorrectsIbans extends Command
|
||||
$account->save();
|
||||
++$this->count;
|
||||
}
|
||||
}
|
||||
|
||||
if (!array_key_exists($iban, $set[$userId])) {
|
||||
$set[$userId][$iban] = $type;
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/*
|
||||
* CorrectsInversedBudgetLimits.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\BudgetLimit;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CorrectsInvertedBudgetLimits extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'correction:corrects-inverted-budget-limits';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Reverse budget limits where the dates are inverted.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
|
||||
$set = BudgetLimit::where('start_date', '>', DB::raw('end_date'))->get();
|
||||
if (0 === $set->count()) {
|
||||
Log::debug('No inverted budget limits found.');
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($set as $budgetLimit) {
|
||||
$start = $budgetLimit->start_date->copy();
|
||||
$end = $budgetLimit->end_date->copy();
|
||||
$budgetLimit->start_date = $end;
|
||||
$budgetLimit->end_date = $start;
|
||||
$budgetLimit->saveQuietly();
|
||||
}
|
||||
if (1 === $set->count()) {
|
||||
$this->friendlyInfo('Corrected one budget limit to have the right start/end dates.');
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
$this->friendlyInfo(sprintf('Corrected %d budget limits to have the right start/end dates.', count($set)));
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class CorrectsPrimaryCurrencyAmounts extends Command
|
||||
$repository->setUserGroup($userGroup);
|
||||
$set = $repository->getPiggyBanks();
|
||||
$set = $set->filter(
|
||||
static fn (PiggyBank $piggyBank) => $currency->id !== $piggyBank->transaction_currency_id
|
||||
static fn (PiggyBank $piggyBank): bool => $currency->id !== $piggyBank->transaction_currency_id
|
||||
);
|
||||
foreach ($set as $piggyBank) {
|
||||
$piggyBank->encrypted = false;
|
||||
|
||||
@@ -53,7 +53,7 @@ class CorrectsTransactionTypes extends Command
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$fixed = $this->fixJournal($journal);
|
||||
if (true === $fixed) {
|
||||
if ($fixed) {
|
||||
++$count;
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class CorrectsTransactionTypes extends Command
|
||||
private function getSourceAccount(TransactionJournal $journal): Account
|
||||
{
|
||||
$collection = $journal->transactions->filter(
|
||||
static fn (Transaction $transaction) => $transaction->amount < 0
|
||||
static fn (Transaction $transaction): bool => $transaction->amount < 0
|
||||
);
|
||||
if (0 === $collection->count()) {
|
||||
throw new FireflyException(sprintf('300001: Journal #%d has no source transaction.', $journal->id));
|
||||
@@ -142,7 +142,7 @@ class CorrectsTransactionTypes extends Command
|
||||
private function getDestinationAccount(TransactionJournal $journal): Account
|
||||
{
|
||||
$collection = $journal->transactions->filter(
|
||||
static fn (Transaction $transaction) => $transaction->amount > 0
|
||||
static fn (Transaction $transaction): bool => $transaction->amount > 0
|
||||
);
|
||||
if (0 === $collection->count()) {
|
||||
throw new FireflyException(sprintf('300004: Journal #%d has no destination transaction.', $journal->id));
|
||||
|
||||
@@ -257,21 +257,14 @@ 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('[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)));
|
||||
|
||||
if (0 === bccomp(Steam::positive($source->amount), Steam::positive($destination->foreign_amount))
|
||||
return 0 === bccomp(Steam::positive($source->amount), Steam::positive($destination->foreign_amount))
|
||||
&& $source->transaction_currency_id === $destination->foreign_currency_id
|
||||
&& 0 === bccomp(Steam::positive($destination->amount), Steam::positive($source->foreign_amount))
|
||||
&& (int) $destination->transaction_currency_id === (int) $source->foreign_currency_id
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
&& (int) $destination->transaction_currency_id === (int) $source->foreign_currency_id;
|
||||
}
|
||||
|
||||
private function matchCurrencies(): void
|
||||
|
||||
@@ -56,7 +56,7 @@ class RestoresOAuthKeys extends Command
|
||||
}
|
||||
if ($this->keysInDatabase() && !$this->keysOnDrive()) {
|
||||
$result = $this->restoreKeysFromDB();
|
||||
if (true === $result) {
|
||||
if ($result) {
|
||||
$this->friendlyInfo('Restored OAuth keys from database.');
|
||||
|
||||
return;
|
||||
|
||||
@@ -206,7 +206,7 @@ class ExportsData extends Command
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (true === $error && 'start' === $field) {
|
||||
if ($error && 'start' === $field) {
|
||||
$journal = $this->journalRepository->firstNull();
|
||||
$date = $journal instanceof TransactionJournal ? $journal->date : today(config('app.timezone'))->subYear();
|
||||
$date->startOfDay();
|
||||
@@ -214,7 +214,7 @@ class ExportsData extends Command
|
||||
return $date;
|
||||
}
|
||||
// field can only be 'end' at this point, so no need to include it in the check.
|
||||
if (true === $error) {
|
||||
if ($error) {
|
||||
$date = today(config('app.timezone'));
|
||||
$date->endOfDay();
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class CreatesDatabase extends Command
|
||||
$pdo->exec(sprintf('CREATE DATABASE `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;', env('DB_DATABASE')));
|
||||
$this->friendlyInfo(sprintf('Created database "%s"', env('DB_DATABASE')));
|
||||
}
|
||||
if (true === $exists) {
|
||||
if ($exists) {
|
||||
$this->friendlyInfo(sprintf('Database "%s" exists.', env('DB_DATABASE')));
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class ForcesDecimalSize extends Command
|
||||
use ShowsFriendlyMessages;
|
||||
|
||||
protected $description = 'This command resizes DECIMAL columns in MySQL or PostgreSQL and correct amounts (only MySQL).';
|
||||
protected $signature = 'firefly-iii:force-decimal-size';
|
||||
protected $signature = 'firefly-iii:force-decimal-size {--force}';
|
||||
private string $cast;
|
||||
private array $classes
|
||||
= [
|
||||
@@ -98,9 +98,14 @@ class ForcesDecimalSize extends Command
|
||||
Log::debug('Now in ForceDecimalSize::handle()');
|
||||
$this->determineDatabaseType();
|
||||
|
||||
$force = $this->option('force');
|
||||
$question = true;
|
||||
if (false === $force) {
|
||||
$this->friendlyError('Running this command is dangerous and can cause data loss.');
|
||||
$this->friendlyError('Please do not continue.');
|
||||
$this->friendlyError('Please make sure you have a backup.');
|
||||
$question = $this->confirm('Do you want to continue?');
|
||||
}
|
||||
|
||||
if (true === $question) {
|
||||
$this->correctAmounts();
|
||||
$this->updateDecimals();
|
||||
@@ -132,11 +137,11 @@ class ForcesDecimalSize extends Command
|
||||
{
|
||||
// if sqlite, add function?
|
||||
if ('sqlite' === (string)config('database.default')) {
|
||||
DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', static function ($pattern, $value) {
|
||||
DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', static function ($pattern, $value): int {
|
||||
mb_regex_encoding('UTF-8');
|
||||
$pattern = trim($pattern, '"');
|
||||
|
||||
return (false !== mb_ereg($pattern, (string) $value)) ? 1 : 0;
|
||||
return (mb_ereg($pattern, (string)$value)) ? 1 : 0;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ class ApplyRules extends Command
|
||||
foreach ($rules as $rule) {
|
||||
// if in rule selection, or group in selection or all rules, it's included.
|
||||
$test = $this->includeRule($rule, $group);
|
||||
if (true === $test) {
|
||||
if ($test) {
|
||||
Log::debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
|
||||
$rulesToApply->push($rule);
|
||||
}
|
||||
|
||||
@@ -136,11 +136,8 @@ class UpgradesLiabilitiesEight extends Command
|
||||
if (null === $liabilityJournal) {
|
||||
return false;
|
||||
}
|
||||
if (!$openingJournal->date->isSameDay($liabilityJournal->date)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return (bool) $openingJournal->date->isSameDay($liabilityJournal->date);
|
||||
}
|
||||
|
||||
private function deleteCreditTransaction(Account $account): void
|
||||
|
||||
@@ -77,7 +77,7 @@ class UpgradesTagLocations extends Command
|
||||
|
||||
private function hasLocationDetails(Tag $tag): bool
|
||||
{
|
||||
return null !== $tag->latitude && null !== $tag->longitude && null !== $tag->zoomLevel;
|
||||
return !in_array(null, [$tag->latitude, $tag->longitude, $tag->zoomLevel], true);
|
||||
}
|
||||
|
||||
private function migrateLocationDetails(Tag $tag): void
|
||||
|
||||
@@ -180,7 +180,7 @@ class UpgradesToGroups extends Command
|
||||
private function getDestinationTransactions(TransactionJournal $journal): Collection
|
||||
{
|
||||
return $journal->transactions->filter(
|
||||
static fn (Transaction $transaction) => $transaction->amount > 0
|
||||
static fn (Transaction $transaction): bool => $transaction->amount > 0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ class UpgradesToGroups extends Command
|
||||
private function findOpposingTransaction(TransactionJournal $journal, Transaction $transaction): ?Transaction
|
||||
{
|
||||
$set = $journal->transactions->filter(
|
||||
static function (Transaction $subject) use ($transaction) {
|
||||
static function (Transaction $subject) use ($transaction): bool {
|
||||
$amount = (float) $transaction->amount * -1 === (float) $subject->amount; // intentional float
|
||||
$identifier = $transaction->identifier === $subject->identifier;
|
||||
Log::debug(sprintf('Amount the same? %s', var_export($amount, true)));
|
||||
|
||||
@@ -211,7 +211,6 @@ class UpgradesVariousCurrencyInformation extends Command
|
||||
break;
|
||||
}
|
||||
|
||||
/** @var null|Transaction */
|
||||
return $lead;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class UpgradesWebhooks extends Command
|
||||
$delivery = WebhookDelivery::tryFrom((int)$webhook->delivery);
|
||||
$response = WebhookResponse::tryFrom((int)$webhook->response);
|
||||
$trigger = WebhookTrigger::tryFrom((int)$webhook->trigger);
|
||||
if (null === $delivery || null === $response || null === $trigger) {
|
||||
if (in_array(null, [$delivery, $response, $trigger], true)) {
|
||||
$this->friendlyError(sprintf('[a] Webhook #%d has an invalid delivery, response or trigger value. Will not upgrade.', $webhook->id));
|
||||
|
||||
return;
|
||||
@@ -92,7 +92,7 @@ class UpgradesWebhooks extends Command
|
||||
$deliveryModel = WebhookDeliveryModel::where('key', $delivery->value)->first();
|
||||
$responseModel = WebhookResponseModel::where('key', $response->value)->first();
|
||||
$triggerModel = WebhookTriggerModel::where('key', $trigger->value)->first();
|
||||
if (null === $deliveryModel || null === $responseModel || null === $triggerModel) {
|
||||
if (in_array(null, [$deliveryModel, $responseModel, $triggerModel], true)) {
|
||||
$this->friendlyError(sprintf('[b] Webhook #%d has an invalid delivery, response or trigger model. Will not upgrade.', $webhook->id));
|
||||
|
||||
return;
|
||||
|
||||
@@ -50,10 +50,8 @@ class RequestedReportOnJournals
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return PrivateChannel
|
||||
*/
|
||||
public function broadcastOn()
|
||||
public function broadcastOn(): PrivateChannel
|
||||
{
|
||||
return new PrivateChannel('channel-name');
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
$user = auth()->user();
|
||||
$route = $request->route();
|
||||
$param = $route->parameter('transactionGroup');
|
||||
$groupId = !is_object($param) ? (int) $param : 0;
|
||||
$groupId = is_object($param) ? 0 : (int) $param;
|
||||
|
||||
/** @var null|TransactionGroup $group */
|
||||
$group = $user->transactionGroups()->withTrashed()->find($groupId);
|
||||
|
||||
@@ -274,7 +274,7 @@ class Handler extends ExceptionHandler
|
||||
{
|
||||
return null !== Arr::first(
|
||||
$this->dontReport,
|
||||
static fn ($type) => $e instanceof $type
|
||||
static fn ($type): bool => $e instanceof $type
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ use Throwable;
|
||||
*/
|
||||
final class IntervalException extends Exception
|
||||
{
|
||||
public array $availableIntervals;
|
||||
public Periodicity $periodicity;
|
||||
public array $availableIntervals = [];
|
||||
public Periodicity $periodicity = Periodicity::Monthly;
|
||||
|
||||
/** @var mixed */
|
||||
protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s';
|
||||
@@ -42,8 +42,6 @@ final class IntervalException extends Exception
|
||||
public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
$this->availableIntervals = [];
|
||||
$this->periodicity = Periodicity::Monthly;
|
||||
}
|
||||
|
||||
public static function unavailable(
|
||||
|
||||
@@ -130,7 +130,7 @@ class AccountFactory
|
||||
protected function getAccountType(array $data): ?AccountType
|
||||
{
|
||||
$accountTypeId = array_key_exists('account_type_id', $data) ? (int) $data['account_type_id'] : 0;
|
||||
$accountTypeName = array_key_exists('account_type_name', $data) ? $data['account_type_name'] : null;
|
||||
$accountTypeName = $data['account_type_name'] ?? null;
|
||||
$result = null;
|
||||
// find by name or ID
|
||||
if ($accountTypeId > 0) {
|
||||
@@ -174,7 +174,7 @@ class AccountFactory
|
||||
$this->accountRepository->resetAccountOrder();
|
||||
|
||||
// create it:
|
||||
$virtualBalance = array_key_exists('virtual_balance', $data) ? $data['virtual_balance'] : null;
|
||||
$virtualBalance = $data['virtual_balance'] ?? null;
|
||||
$active = array_key_exists('active', $data) ? $data['active'] : true;
|
||||
$databaseData = [
|
||||
'user_id' => $this->user->id,
|
||||
|
||||
@@ -44,8 +44,8 @@ class AttachmentFactory
|
||||
public function create(array $data): ?Attachment
|
||||
{
|
||||
// append if necessary.
|
||||
$model = !str_contains((string) $data['attachable_type'], 'FireflyIII') ? sprintf('FireflyIII\Models\%s', $data['attachable_type'])
|
||||
: $data['attachable_type'];
|
||||
$model = str_contains((string) $data['attachable_type'], 'FireflyIII') ? $data['attachable_type']
|
||||
: sprintf('FireflyIII\Models\%s', $data['attachable_type']);
|
||||
|
||||
// get journal instead of transaction.
|
||||
if (Transaction::class === $model) {
|
||||
|
||||
@@ -89,7 +89,7 @@ class TagFactory
|
||||
|
||||
/** @var null|Tag $tag */
|
||||
$tag = Tag::create($array);
|
||||
if (null !== $tag && null !== $latitude && null !== $longitude) {
|
||||
if (!in_array(null, [$tag, $latitude, $longitude], true)) {
|
||||
// create location object.
|
||||
$location = new Location();
|
||||
$location->latitude = $latitude;
|
||||
|
||||
@@ -41,20 +41,11 @@ use Illuminate\Support\Facades\Log;
|
||||
class TransactionFactory
|
||||
{
|
||||
private Account $account;
|
||||
private array $accountInformation;
|
||||
private array $accountInformation = [];
|
||||
private TransactionCurrency $currency;
|
||||
private ?TransactionCurrency $foreignCurrency = null;
|
||||
private TransactionJournal $journal;
|
||||
private bool $reconciled;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->reconciled = false;
|
||||
$this->accountInformation = [];
|
||||
}
|
||||
private bool $reconciled = false;
|
||||
|
||||
/**
|
||||
* Create transaction with negative amount (for source accounts).
|
||||
|
||||
@@ -71,7 +71,7 @@ class TransactionJournalFactory
|
||||
private AccountValidator $accountValidator;
|
||||
private BillRepositoryInterface $billRepository;
|
||||
private CurrencyRepositoryInterface $currencyRepository;
|
||||
private bool $errorOnHash;
|
||||
private bool $errorOnHash = false;
|
||||
private array $fields;
|
||||
private PiggyBankEventFactory $piggyEventFactory;
|
||||
private PiggyBankRepositoryInterface $piggyRepository;
|
||||
@@ -86,7 +86,6 @@ class TransactionJournalFactory
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->errorOnHash = false;
|
||||
$this->fields = config('firefly.journal_meta_fields');
|
||||
$this->currencyRepository = app(CurrencyRepositoryInterface::class);
|
||||
$this->typeRepository = app(TransactionTypeRepositoryInterface::class);
|
||||
@@ -237,7 +236,7 @@ class TransactionJournalFactory
|
||||
Log::debug('Done with getAccount(2x)');
|
||||
|
||||
// there is a safety catch here. If either account is NULL, they will be replaced with the cash account.
|
||||
if (null === $destinationAccount) {
|
||||
if (!$destinationAccount instanceof Account) {
|
||||
Log::warning('Destination account is NULL, will replace with cash account.');
|
||||
$destinationAccount = $this->accountRepository->getCashAccount();
|
||||
}
|
||||
@@ -615,7 +614,7 @@ class TransactionJournalFactory
|
||||
|
||||
private function storeLocation(TransactionJournal $journal, NullArrayObject $data): void
|
||||
{
|
||||
if (null !== $data['longitude'] && null !== $data['latitude'] && null !== $data['zoom_level']) {
|
||||
if (!in_array(null, [$data['longitude'], $data['latitude'], $data['zoom_level']], true)) {
|
||||
$location = new Location();
|
||||
$location->longitude = $data['longitude'];
|
||||
$location->latitude = $data['latitude'];
|
||||
@@ -628,7 +627,7 @@ class TransactionJournalFactory
|
||||
public function setErrorOnHash(bool $errorOnHash): void
|
||||
{
|
||||
$this->errorOnHash = $errorOnHash;
|
||||
if (true === $errorOnHash) {
|
||||
if ($errorOnHash) {
|
||||
Log::info('Will trigger duplication alert for this journal.');
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user