Compare commits

...

103 Commits

Author SHA1 Message Date
github-actions[bot]
3bf1c0075e Merge pull request #10018 from firefly-iii/develop
🤖 Automatically merge the PR into the main branch.
2025-03-22 14:02:18 +01:00
github-actions[bot]
1821ade319 Merge pull request #10017 from firefly-iii/release-1742648527
🤖 Automatically merge the PR into the develop branch.
2025-03-22 14:02:13 +01:00
JC5
dcd4f072d5 🤖 Auto commit for release 'v6.2.10' on 2025-03-22 2025-03-22 14:02:07 +01:00
James Cole
1734c7f545 Fix output.txt routine. 2025-03-22 13:58:40 +01:00
James Cole
aef3d340ae Escalate to sudo. 2025-03-22 13:53:56 +01:00
James Cole
e39d4bc288 Correct access rights. 2025-03-22 13:50:04 +01:00
James Cole
ed35b0f81a Debug run. 2025-03-22 09:54:25 +01:00
James Cole
4805c9e1c9 Merge branch 'main' into develop 2025-03-22 09:48:37 +01:00
James Cole
eebcbe0f67 Merge pull request #10016 from firefly-iii/move-action
Move action until after commits.
2025-03-22 09:48:14 +01:00
James Cole
61e2b79357 Move action until after commits. 2025-03-22 09:47:43 +01:00
github-actions[bot]
fd3b03d3de Merge pull request #10013 from firefly-iii/release-1742584829
🤖 Automatically merge the PR into the develop branch.
2025-03-21 20:20:34 +01:00
JC5
9423a28158 🤖 Auto commit for release 'develop' on 2025-03-21 2025-03-21 20:20:29 +01:00
James Cole
55062068fd Merge pull request #10012 from firefly-iii/update-changelog
Update changelog.
2025-03-21 20:15:39 +01:00
James Cole
542b6f670d Update changelog. 2025-03-21 20:15:10 +01:00
James Cole
5b163b42b4 Merge pull request #10010 from firefly-iii/debug-timer-10005
Add debug for #10005
2025-03-21 05:51:52 +01:00
James Cole
613dce51fb Add debug for #10005 2025-03-21 05:51:24 +01:00
James Cole
40adb5b203 Merge pull request #10009 from firefly-iii/fix-10007
Fix #10007
2025-03-21 05:49:50 +01:00
James Cole
fba796fa84 Fix #10007 2025-03-21 05:48:51 +01:00
James Cole
db4c3f9bfa Merge pull request #10008 from firefly-iii/fix-missing-init
Fix missing initialisation
2025-03-21 05:37:26 +01:00
James Cole
d960cc6ad7 Fix missing initialisation 2025-03-21 05:36:58 +01:00
github-actions[bot]
c620ec1f24 Merge pull request #9991 from firefly-iii/release-1742181403
🤖 Automatically merge the PR into the develop branch.
2025-03-17 04:16:47 +01:00
JC5
2d78bba6f4 🤖 Auto commit for release 'develop' on 2025-03-17 2025-03-17 04:16:43 +01:00
James Cole
b7a3f5d740 Merge branch 'main' into develop
# Conflicts:
#	package-lock.json
2025-03-16 17:54:09 +01:00
James Cole
96def3c5d4 Merge branch 'main' of github.com:firefly-iii/firefly-iii 2025-03-16 17:53:01 +01:00
James Cole
e1941d9d87 Remove test commit. 2025-03-16 17:52:47 +01:00
github-actions[bot]
a30cf03678 Merge pull request #9987 from firefly-iii/release-1742143821
🤖 Automatically merge the PR into the develop branch.
2025-03-16 17:50:27 +01:00
JC5
aa0dcd3b7e 🤖 Auto commit for release 'develop' on 2025-03-16 2025-03-16 17:50:22 +01:00
James Cole
810e92f7a3 Merge pull request #9977 from firefly-iii/dependabot/npm_and_yarn/npm_and_yarn-4692130362
Bump axios from 1.7.9 to 1.8.2 in the npm_and_yarn group across 1 directory
2025-03-16 17:46:41 +01:00
mergify[bot]
5dd49fc1e1 Merge branch 'main' into dependabot/npm_and_yarn/npm_and_yarn-4692130362 2025-03-16 16:44:48 +00:00
James Cole
8517af105d Fancy new release job. 2025-03-16 17:44:09 +01:00
mergify[bot]
442cf7f9b3 Merge branch 'main' into dependabot/npm_and_yarn/npm_and_yarn-4692130362 2025-03-16 06:19:29 +00:00
James Cole
82878b5214 Merge branch 'main' into develop 2025-03-16 07:19:02 +01:00
James Cole
b0f1102540 Ignore file. 2025-03-16 07:18:50 +01:00
dependabot[bot]
2efee7e6de Bump axios in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 1 update in the / directory: [axios](https://github.com/axios/axios).


Updates `axios` from 1.7.9 to 1.8.2
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.7.9...v1.8.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-15 10:05:12 +00:00
James Cole
abcecc7476 Can develop be merged through a PR and not a push? 2025-03-15 11:03:56 +01:00
github-actions
c28005f649 Auto commit for release 'develop' on 2025-03-14 2025-03-14 19:28:44 +01:00
James Cole
a369e61f18 Add changelog. 2025-03-14 19:24:54 +01:00
James Cole
05d82b6c05 Fix missing method. 2025-03-14 19:19:33 +01:00
James Cole
68ca8fd250 Merge pull request #9975 from firefly-iii/remove-transformers
Remove references to old transformers.
2025-03-14 19:18:50 +01:00
James Cole
b55b565ee5 Remove references to old transformers. 2025-03-14 19:18:17 +01:00
github-actions
fc98d66ef4 Auto commit for release 'develop' on 2025-03-14 2025-03-14 17:45:16 +01:00
James Cole
f6642c075d Merge pull request #9969 from firefly-iii/fix-9770
Fix #9770
2025-03-13 20:24:50 +01:00
James Cole
458a337521 Fix #9770 2025-03-13 20:23:53 +01:00
James Cole
37d2299a1d Merge pull request #9957 from firefly-iii/dependabot/composer/develop/phpstan/phpstan-2.1.8
Bump phpstan/phpstan from 2.1.7 to 2.1.8
2025-03-10 05:51:33 +01:00
James Cole
f69cffc50b Merge pull request #9958 from firefly-iii/dependabot/npm_and_yarn/develop/axios-1.8.2
Bump axios from 1.8.1 to 1.8.2
2025-03-10 05:51:22 +01:00
James Cole
fd77a17ba5 Merge pull request #9959 from firefly-iii/dependabot/npm_and_yarn/develop/vite-6.2.1
Bump vite from 6.2.0 to 6.2.1
2025-03-10 05:51:11 +01:00
dependabot[bot]
b481cf53e7 Bump vite from 6.2.0 to 6.2.1
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.2.0 to 6.2.1.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/create-vite@6.2.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 03:41:58 +00:00
dependabot[bot]
a4a4590c45 Bump axios from 1.8.1 to 1.8.2
Bumps [axios](https://github.com/axios/axios) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.8.1...v1.8.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 03:41:42 +00:00
dependabot[bot]
9e398beb07 Bump phpstan/phpstan from 2.1.7 to 2.1.8
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 2.1.7 to 2.1.8.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/2.1.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/2.1.7...2.1.8)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 03:19:15 +00:00
James Cole
38ae3df423 Merge pull request #9955 from firefly-iii/fix-9954
Fix #9954
2025-03-09 18:45:04 +01:00
James Cole
2f17701b68 Fix #9954 2025-03-09 18:44:39 +01:00
James Cole
4c797c1d4c Merge pull request #9953 from firefly-iii/fix-9876
Fix #9876
2025-03-09 10:35:38 +01:00
James Cole
a8e1c22c93 Fix #9876 2025-03-09 10:35:12 +01:00
James Cole
b60021e0ce Merge pull request #9952 from firefly-iii/speed-up-account-show
Speed up account show
2025-03-09 09:57:24 +01:00
James Cole
453ccd3271 Clean up overview. 2025-03-09 09:54:14 +01:00
James Cole
08f13aebe3 Fix period overview for account 2025-03-09 09:54:06 +01:00
James Cole
26df1be871 Remove debug 2025-03-09 09:53:52 +01:00
James Cole
fe2def9684 Fix nullpointer. 2025-03-09 09:53:36 +01:00
James Cole
db2cab3cef Add custom method. 2025-03-09 09:53:27 +01:00
James Cole
d84405191f Add debug timers. 2025-03-09 09:53:19 +01:00
James Cole
349d32a268 Merge pull request #9951 from firefly-iii/fix-phpstan-issues
Various code cleanup and sorting.
2025-03-08 19:55:51 +01:00
James Cole
30b7e17b6f Various code cleanup and sorting. 2025-03-08 19:55:21 +01:00
James Cole
2d3d3bc0a4 Merge pull request #9950 from firefly-iii/fix-9948
Fix #9948
2025-03-08 19:35:03 +01:00
James Cole
a4f887921a Fix #9948 2025-03-08 19:34:18 +01:00
James Cole
710732d7f5 Merge pull request #9949 from firefly-iii/missing-phpstan-methods
Missing phpstan methods
2025-03-08 15:58:27 +01:00
James Cole
cd08c16dee Replace missing methods. 2025-03-08 15:57:59 +01:00
James Cole
a8f36a2490 Add missing methods so phpstan stops complaining. 2025-03-08 15:52:50 +01:00
James Cole
7f12d06989 Merge pull request #9947 from firefly-iii/remove-usergroup-repositories
Remove references to user group specific repositories and instead use…
2025-03-08 15:12:13 +01:00
James Cole
8eb0313841 Remove references to user group specific repositories and instead use the normal ones. 2025-03-08 15:10:24 +01:00
James Cole
113eb84461 Merge pull request #9946 from firefly-iii/fix-currency-autocomplete
Add missing method to repository.
2025-03-08 05:57:19 +01:00
mergify[bot]
cdf42e50f0 Merge branch 'develop' into fix-currency-autocomplete 2025-03-08 04:56:06 +00:00
James Cole
e59cf03d80 Merge branch 'main' into develop
# Conflicts:
#	composer.lock
2025-03-08 05:55:45 +01:00
James Cole
0bd0e6caeb Add missing method to repository. 2025-03-08 05:51:50 +01:00
James Cole
605623a7af Merge pull request #9944 from firefly-iii/add-validation-command
Add command to validate various settings.
2025-03-08 05:50:47 +01:00
James Cole
042d055d85 Merge pull request #9945 from firefly-iii/mergify/JC5/config-update
ci(Mergify): configuration update
2025-03-08 05:45:27 +01:00
James Cole
cc29d0a850 ci(Mergify): configuration update
Signed-off-by: James Cole <james@firefly-iii.org>
2025-03-08 05:45:00 +01:00
James Cole
7dede49aee Add command to validate various settings. 2025-03-08 05:38:51 +01:00
James Cole
775282ae02 Fix #9941 2025-03-07 05:25:43 +01:00
James Cole
e49806078a Merge pull request #9935 from firefly-iii/dependabot/composer/composer-e6d0169aed 2025-03-06 05:28:45 +01:00
dependabot[bot]
71d8c0d219 Bump laravel/framework in the composer group across 1 directory
Bumps the composer group with 1 update in the / directory: [laravel/framework](https://github.com/laravel/framework).


Updates `laravel/framework` from 11.43.2 to 11.44.1
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/12.x/CHANGELOG.md)
- [Commits](https://github.com/laravel/framework/compare/v11.43.2...v11.44.1)

---
updated-dependencies:
- dependency-name: laravel/framework
  dependency-type: direct:production
  dependency-group: composer
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 23:45:21 +00:00
James Cole
0031c5a5ad Fix #9914 2025-03-05 20:12:44 +01:00
James Cole
3ce111550e Merge branch 'main' into develop 2025-03-05 19:53:29 +01:00
James Cole
58af83cc8c Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
# Conflicts:
#	.ci/php-cs-fixer/composer.lock
2025-03-05 19:52:36 +01:00
github-actions
422a23e700 Auto commit for release 'develop' on 2025-03-05 2025-03-05 15:50:17 +01:00
Sander Dorigo
8c2672cdf8 Fix #9895 2025-03-05 15:02:40 +01:00
Sander Dorigo
764e49985b add default values 2025-03-05 14:58:10 +01:00
Sander Dorigo
84251f8f10 Merge branch 'develop' of https://github.com/firefly-iii/firefly-iii into develop 2025-03-05 14:42:34 +01:00
James Cole
3d878cb5dd Merge pull request #9899 from firefly-iii/dependabot/github_actions/github/command-2.0.0
Bump github/command from 1.3.0 to 2.0.0
2025-03-05 12:28:06 +01:00
Sander Dorigo
8b4740d28c fix #9902 2025-03-05 12:27:08 +01:00
James Cole
0845e265c2 Merge pull request #9903 from lompi/add_support_for_strpos_in_expressions
Add support for PHP function `strpos` in expressions
2025-03-05 12:25:50 +01:00
Sander Dorigo
b4455a3802 Fix #9906 2025-03-05 12:18:14 +01:00
Sander Dorigo
8d12d47691 fix #9908 2025-03-05 12:13:56 +01:00
James Cole
3dc01b0d5c Merge pull request #9918 from firefly-iii/dependabot/composer/develop/diglactic/laravel-breadcrumbs-10.0.0
Bump diglactic/laravel-breadcrumbs from 9.0.0 to 10.0.0
2025-03-05 11:44:32 +01:00
dependabot[bot]
b442645280 Bump diglactic/laravel-breadcrumbs from 9.0.0 to 10.0.0
Bumps [diglactic/laravel-breadcrumbs](https://github.com/diglactic/laravel-breadcrumbs) from 9.0.0 to 10.0.0.
- [Release notes](https://github.com/diglactic/laravel-breadcrumbs/releases)
- [Upgrade guide](https://github.com/diglactic/laravel-breadcrumbs/blob/main/UPGRADE.md)
- [Commits](https://github.com/diglactic/laravel-breadcrumbs/compare/v9.0.0...v10.0.0)

---
updated-dependencies:
- dependency-name: diglactic/laravel-breadcrumbs
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-03 03:20:25 +00:00
Lompi
d9593db5e2 Add support for PHP function strpos in expressions
Signed-off-by: Lompi <lompi91+github_com@gmail.com>
2025-02-24 16:55:00 +01:00
dependabot[bot]
9dcb8e2680 Bump github/command from 1.3.0 to 2.0.0
Bumps [github/command](https://github.com/github/command) from 1.3.0 to 2.0.0.
- [Release notes](https://github.com/github/command/releases)
- [Commits](https://github.com/github/command/compare/v1.3.0...v2.0.0)

---
updated-dependencies:
- dependency-name: github/command
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-24 03:51:39 +00:00
James Cole
f7ad9c56c8 Add imports for facades 2025-02-23 12:47:04 +01:00
James Cole
0086a0ddc8 Fix namespace. 2025-02-23 12:35:13 +01:00
James Cole
25ebfd6978 php cs cleanup 2025-02-23 12:28:43 +01:00
James Cole
de8149137a Use trait and interface. 2025-02-23 12:28:27 +01:00
James Cole
79ae110368 Update php cs fixer 2025-02-23 12:27:49 +01:00
James Cole
60aef0de1a Mark as deprecated. 2025-02-23 12:27:34 +01:00
James Cole
8d464962a8 Remove methods, point to interface. 2025-02-23 12:27:07 +01:00
262 changed files with 3021 additions and 1949 deletions

View File

@@ -406,16 +406,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.70.1",
"version": "v3.73.1",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "add1b3a05256392dbad63875240041b2c0349ceb"
"reference": "ffcb8200a42045e65049af7910cfd022f631b064"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/add1b3a05256392dbad63875240041b2c0349ceb",
"reference": "add1b3a05256392dbad63875240041b2c0349ceb",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ffcb8200a42045e65049af7910cfd022f631b064",
"reference": "ffcb8200a42045e65049af7910cfd022f631b064",
"shasum": ""
},
"require": {
@@ -423,6 +423,7 @@
"composer/semver": "^3.4",
"composer/xdebug-handler": "^3.0.3",
"ext-filter": "*",
"ext-hash": "*",
"ext-json": "*",
"ext-tokenizer": "*",
"fidry/cpu-core-counter": "^1.2",
@@ -445,18 +446,18 @@
"symfony/stopwatch": "^5.4 || ^6.4 || ^7.0"
},
"require-dev": {
"facile-it/paraunit": "^1.3.1 || ^2.5",
"infection/infection": "^0.29.10",
"justinrainbow/json-schema": "^5.3 || ^6.0",
"facile-it/paraunit": "^1.3.1 || ^2.6",
"infection/infection": "^0.29.14",
"justinrainbow/json-schema": "^5.3 || ^6.2",
"keradus/cli-executor": "^2.1",
"mikey179/vfsstream": "^1.6.12",
"php-coveralls/php-coveralls": "^2.7",
"php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6",
"phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.7",
"symfony/var-dumper": "^5.4.48 || ^6.4.18 || ^7.2.0",
"symfony/yaml": "^5.4.45 || ^6.4.18 || ^7.2.0"
"phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.12",
"symfony/var-dumper": "^5.4.48 || ^6.4.18 || ^7.2.3",
"symfony/yaml": "^5.4.45 || ^6.4.18 || ^7.2.3"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
@@ -497,7 +498,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.70.1"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.73.1"
},
"funding": [
{
@@ -505,7 +506,7 @@
"type": "github"
}
],
"time": "2025-03-01T22:05:46+00:00"
"time": "2025-03-19T23:42:16+00:00"
},
{
"name": "psr/container",

View File

@@ -326,7 +326,7 @@ USE_RUNNING_BALANCE=false
FIREFLY_III_LAYOUT=v1
#
# Which Query Parser implementation to use for the search rngine and rules
# Which Query Parser implementation to use for the search engine and rules
# 'new' is experimental, 'legacy' is the classic one
#
QUERY_PARSER_IMPLEMENTATION=legacy

8
.github/mergify.yml vendored
View File

@@ -1,5 +1,11 @@
---
pull_request_rules:
- name: Make sure PR are up to date before merging
description: This automatically updates PRs when they are out-of-date with the
base branch to avoid semantic conflicts (next step is using a merge
queue).
conditions: []
actions:
update:
- name: Close all on main
conditions:
- base=main

View File

@@ -13,7 +13,7 @@ jobs:
close_duplicates:
runs-on: ubuntu-latest
steps:
- uses: github/command@v1.3.0
- uses: github/command@v2.0.0
id: command
with:
allowed_contexts: "issue"

View File

@@ -22,31 +22,43 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Switch branch
run: |
if [[ "develop" == "$version" ]]; then
git checkout --track origin/develop
git pull
elif [[ "$version" == branch* ]]; then
PULLBRANCH=${version:7}
echo "The branch is '$PULLBRANCH' ($version)"
git checkout --track origin/$PULLBRANCH
git pull
else
git config user.name github-actions
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout --track origin/develop
git pull
git checkout main
git merge develop
fi
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ github.event.inputs.phpversion }}
extensions: mbstring, intl, zip, bcmath
- name: Switch and pull
run: |
#
# Always check out origin/develop, unless its a branch release.
#
BRANCH_TO_PULL=origin/develop
if [[ "$version" == branch* ]]; then
BRANCH_TO_PULL=origin/$version
fi
echo "Version is '$version', check out '$BRANCH_TO_PULL'-branch"
git checkout --track $BRANCH_TO_PULL
git pull
echo "Current branch is $(git branch --show-current)"
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Configure Git
run: |
# do some configuration
sudo timedatectl set-timezone Europe/Amsterdam
git config user.name JC5
git config user.email release@firefly-iii.org
git config advice.addIgnoredFile false
git config push.autoSetupRemote true
- name: crowdin action
uses: crowdin/github-action@v2
with:
@@ -76,15 +88,6 @@ jobs:
env:
FIREFLY_III_ROOT: /github/workspace
GH_TOKEN: ''
- name: Extract changelog
id: extract-changelog
uses: JC5/firefly-iii-dev@main
with:
action: 'ff3:extract-changelog'
output: 'output'
env:
FIREFLY_III_ROOT: /github/workspace
GH_TOKEN: ""
- name: Replace version
id: replace-version
uses: JC5/firefly-iii-dev@main
@@ -134,18 +137,8 @@ jobs:
composer update --no-dev --no-scripts --no-plugins -q
sudo chown -R runner:docker resources/lang
.ci/phpcs.sh || true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Release
- name: Calculate variables
run: |
# do some configuration
sudo timedatectl set-timezone Europe/Amsterdam
git config user.name github-actions
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git config advice.addIgnoredFile false
# set some variables
releaseName=$version
@@ -153,10 +146,6 @@ jobs:
zipName=FireflyIII-$version.zip
tarName=FireflyIII-$version.tar.gz
# update composer (again)
composer update --no-dev --no-scripts --no-plugins
composer dump-autoload
# if this is a develop build, slightly different variable names.
if [[ "develop" == "$version" ]]; then
#[[ -z $(git status --untracked-files=normal --porcelain) ]] && echo "this branch is clean, no need to push..." && exit 0;
@@ -191,35 +180,53 @@ jobs:
tagFound=false
fi
done
echo "Will use tag and release name $releaseName."
# set some variables
echo "Release name is $releaseName."
echo "Original name is $originalName."
echo "Zip name is $zipName."
echo "Tar name is $tarName."
# create a new branch to store the difference in.
BRANCH_NAME=release-$(date +'%s')
git checkout -b $BRANCH_NAME
echo "Temporary branch name is '$BRANCH_NAME'."
# share variables with next step.
echo "releaseName=$releaseName" >> "$GITHUB_ENV"
echo "originalName=$originalName" >> "$GITHUB_ENV"
echo "zipName=$zipName" >> "$GITHUB_ENV"
echo "tarName=$tarName" >> "$GITHUB_ENV"
echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV"
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Commit all changes
run: |
# add all content, except output.txt (this contains the changelog and/or the download instructions)
echo 'Add all and reset output.txt'
echo 'Add all'
git add -A
if test -f "output.txt"; then
git reset output.txt
fi
git commit -m "Auto commit for release '$version' on $(date +'%Y-%m-%d')" || true
# push to a new branch.
echo "Auto commit on branch '$(git branch --show-current)'."
git commit -m "🤖 Auto commit for release '$version' on $(date +'%Y-%m-%d')" || true
git push
# zip and tar everything
echo 'Zip and tar...'
zip -rq $zipName . -x "*.git*" "*.ci*" "*.github*" "*node_modules*" "*output.txt*" "*Procfile*" "*crowdin.yml*" "*sonar-project.properties*"
touch $tarName
tar --exclude=$tarName --exclude=$zipName --exclude='./.git' --exclude='./.ci' --exclude='./.github' --exclude='./node_modules' --exclude='./output.txt' --exclude='./Procfile' --exclude='../crowdin.yml' --exclude='./sonar-project.properties' -czf $tarName .
# add sha256 sum
echo 'Sha sum ...'
sha256sum -b $zipName > $zipName.sha256
sha256sum -b $tarName > $tarName.sha256
# add signatures:
gpg --armor --detach-sign $zipName
gpg --armor --detach-sign $tarName
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Extract changelog
id: extract-changelog
uses: JC5/firefly-iii-dev@main
with:
action: 'ff3:extract-changelog'
output: 'output'
env:
FIREFLY_III_ROOT: /github/workspace
GH_TOKEN: ""
- name: Describe new release
run: |
# describe the development release.
if [[ "develop" == "$version" ]]; then
echo 'Develop release.'
echo 'Describe the latest develop release'
rm -f output.txt
touch output.txt
sudo chown -R runner:docker output.txt
@@ -234,7 +241,7 @@ jobs:
fi
# describe a branch release
if [[ "$version" == branch* ]]; then
echo 'Branch release.'
echo 'Describe a branch release'
rm -f output.txt
touch output.txt
sudo chown -R runner:docker output.txt
@@ -249,8 +256,9 @@ jobs:
fi
# describe the main release
if [[ "develop" != "$version" ]] && [[ "$version" != branch* ]] && [[ "$version" != *alpha* ]] && [[ "$version" != *beta* ]]; then
echo 'Main release.'
echo 'Describe the latest release'
sudo chown -R runner:docker output.txt
touch output.txt
echo '' >> output.txt
echo '### Instructions' >> output.txt
echo '' >> output.txt
@@ -262,7 +270,7 @@ jobs:
# describe alpha release
if [[ "$version" == *alpha* ]]; then
echo 'ALPHA release.'
echo 'Describe an ALPHA release'
rm -f output.txt
touch output.txt
sudo chown -R runner:docker output.txt
@@ -280,7 +288,7 @@ jobs:
# describe beta release
if [[ "$version" == *beta* ]]; then
echo 'BETA release.'
echo 'Describe a BETA release'
rm -f output.txt
touch output.txt
sudo chown -R runner:docker output.txt
@@ -295,55 +303,125 @@ jobs:
echo "* The releases are signed, and you can verify them using the [Firefly III releases PGP key](https://docs.firefly-iii.org/explanation/more-information/signatures/)." >> output.txt
fi
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Merge all into working branch
run: |
MERGE_INTO=develop
if [[ "$version" == branch* ]]; then
MERGE_INTO=$version
fi
echo "Merge all changes from $BRANCH_NAME back into '$MERGE_INTO' using a PR"
PR_URL=$(gh pr create -B $MERGE_INTO -H $BRANCH_NAME --title "🤖 Automatic PR to merge all changes into the '$MERGE_INTO' branch." --body '🤖 Created by GitHub action')
echo "PR URL is '$PR_URL'"
IFS='/' read -ra parts <<< "$PR_URL"
PR_NR=$(printf %s\\n "${parts[@]:(-1)}")
echo "PR number is '$PR_NR'"
gh pr merge $PR_NR -b "🤖 Automatically merge the PR into the $MERGE_INTO branch." -d --merge
# pull the changes from the $MERGE_INTO branch.
git checkout $MERGE_INTO
git merge origin/$MERGE_INTO
git pull
git status
echo "Current branch '$(git branch --show-current)'."
if [[ "develop" != "$version" ]] && [[ "$version" != branch* ]]; then
git checkout main
git merge origin/main
git pull
git status
echo "Also merge everything into main since this is a release."
echo 'create PR'
PR_URL=$(gh pr create -B main -H develop --title "🤖 Automatic PR to merge all changes into the main branch." --body "🤖 Created by GitHub action")
echo "PR URL is '$PR_URL'"
IFS='/' read -ra parts <<< "$PR_URL"
PR_NR=$(printf %s\\n "${parts[@]:(-1)}")
echo "PR number is '$PR_NR'"
echo 'Merge PR'
gh pr merge $PR_NR -b "🤖 Automatically merge the PR into the main branch." --merge
git checkout main
git merge origin/main
git pull
git status
echo "Current branch '$(git branch --show-current)'."
fi
echo "DONE!"
env:
GH_TOKEN: ${{ github.token }}
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Create archives
run: |
echo "Create zip file $zipName"
zip -rq $zipName . -x "*.git*" "*.ci*" "*.github*" "*node_modules*" "*output.txt*" "*Procfile*" "*crowdin.yml*" "*sonar-project.properties*"
touch $tarName
echo "Create tar file $tarName"
tar --exclude=$tarName --exclude=$zipName --exclude='./.git' --exclude='./.ci' --exclude='./.github' --exclude='./node_modules' --exclude='./output.txt' --exclude='./Procfile' --exclude='../crowdin.yml' --exclude='./sonar-project.properties' -czf $tarName .
# add sha256 sum
echo 'Sha sum ...'
sha256sum -b $zipName > $zipName.sha256
sha256sum -b $tarName > $tarName.sha256
# add signatures:
gpg --armor --detach-sign $zipName
gpg --armor --detach-sign $tarName
- name: Create release
run: |
# create a development release:
if [[ "develop" == "$version" ]]; then
# create the release:
echo "Create develop release."
git tag -a $releaseName -m "Development release '$version' on $(date +'%Y-%m-%d')"
# pull the changes from the develop branch.
git checkout develop
git merge origin/develop
git pull
# create the release:
echo "Create develop release under tag '$releaseName'."
git tag -a $releaseName -m "🤖 Development release '$version' on $(date +'%Y-%m-%d')"
git push origin $releaseName
gh release create $releaseName -p --verify-tag \
-t "Development release for $(date +'%Y-%m-%d')" \
--latest=false \
-F output.txt
fi
# create a branch release:
if [[ "$version" == branch* ]]; then
# pull the changes from the branch-* branch.
git checkout $version
git merge origin/$version
git pull
# create the release:
echo "Create branch release."
git tag -a $releaseName -m "Branch release '$version' on $(date +'%Y-%m-%d')"
git push origin $releaseName
gh release create $releaseName -p --verify-tag \
-t "Branch release for $(date +'%Y-%m-%d')" \
--latest=false \
-F output.txt
fi
# create a development (nightly) release:
if [[ "develop" == "$version" ]] || [[ "$version" == branch* ]]; then
# add zip file to release.
gh release upload $releaseName $zipName
gh release upload $releaseName $tarName
# Create a production release.
if [[ "develop" != "$version" ]] && [[ "$version" != branch* ]]; then
git checkout main
git merge origin/main
git pull
git status
# add sha256 sum to release
gh release upload $releaseName $zipName.sha256
gh release upload $releaseName $tarName.sha256
# add signatures to release
gh release upload $releaseName $zipName.asc
gh release upload $releaseName $tarName.asc
# get current HEAD and add as file to the release
HEAD=$(git rev-parse HEAD)
echo $HEAD > HEAD.txt
gh release upload $releaseName HEAD.txt
else
echo 'MAIN (real) release'
git tag -a $releaseName -m "Here be changelog"
echo "Create prod release."
git tag -a $releaseName -m "Release $version"
git push origin $releaseName
# do not tag as latest when alpha or beta.
@@ -355,39 +433,38 @@ jobs:
# tag as latest when NOT alpha or beta.
if [[ "$version" != *alpha* ]] && [[ "$version" != *beta* ]]; then
echo 'Mark prod as the latest.'
gh release create $releaseName -F output.txt -t "$releaseName" --verify-tag
gh release create $releaseName -F output.txt -t "$releaseName" --verify-tag --latest=true
fi
# add archive files to release
gh release upload $releaseName $zipName
gh release upload $releaseName $tarName
# add sha256 sums to release
gh release upload $releaseName $zipName.sha256
gh release upload $releaseName $tarName.sha256
# add signatures to release
gh release upload $releaseName $zipName.asc
gh release upload $releaseName $tarName.asc
# get current HEAD and add as file to the release
HEAD=$(git rev-parse HEAD)
echo $HEAD > HEAD.txt
gh release upload $releaseName HEAD.txt
# remove all temporary files
rm -f output.txt
rm -f HEAD.txt
rm -f $zipName
rm -f $zipName.sha256
rm -f $tarName
rm -f $tarName.sha256
# merge main back into develop
git checkout develop
git merge main
git push
fi
env:
GH_TOKEN: ${{ github.token }}
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Upload artifacts
run: |
# add zip file to release.
gh release upload $releaseName $zipName
gh release upload $releaseName $tarName
# add sha256 sum to release
gh release upload $releaseName $zipName.sha256
gh release upload $releaseName $tarName.sha256
# add signatures to release
gh release upload $releaseName $zipName.asc
gh release upload $releaseName $tarName.asc
# get current HEAD and add as file to the release
HEAD=$(git rev-parse HEAD)
echo $HEAD > HEAD.txt
gh release upload $releaseName HEAD.txt
# remove all temporary files
rm -f output.txt
rm -f HEAD.txt
rm -f $zipName
rm -f $zipName.sha256
rm -f $tarName
rm -f $tarName.sha256
env:
GH_TOKEN: ${{ github.token }}
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}

1
.gitignore vendored
View File

@@ -7,6 +7,7 @@ yarn-error.log
.env
/.ci/php-cs-fixer/vendor
coverage.xml
output.txt
# ignore generated files.
public/build

View File

@@ -4,6 +4,7 @@ Over time, many people have contributed to Firefly III. Their efforts are not al
Please find below all the people who contributed to the Firefly III code. Their names are mentioned in the year of their first contribution.
## 2025
- Lompi
- Jose Diaz-Gonzalez
- SoftBrix

View File

@@ -30,6 +30,7 @@ use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Debug\Timer;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\User;
@@ -82,10 +83,11 @@ class AccountController extends Controller
$query = $data['query'];
$date = $data['date'] ?? today(config('app.timezone'));
$return = [];
Timer::start(sprintf('AC accounts "%s"', $query));
$result = $this->repository->searchAccount((string) $query, $types, $this->parameters->get('limit'));
// set date to subday + end-of-day for account balance. so it is at $date 23:59:59
$date->subDay()->endOfDay();
$date->endOfDay();
/** @var Account $account */
foreach ($result as $account) {
@@ -135,6 +137,7 @@ class AccountController extends Controller
return $posA - $posB;
}
);
Timer::stop(sprintf('AC accounts "%s"', $query));
return response()->api($return);
}

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;

View File

@@ -32,7 +32,7 @@ use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\AbstractTransformer;
use FireflyIII\Transformers\AbstractTransformer;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
@@ -263,7 +263,7 @@ abstract class Controller extends BaseController
// the transformer, at this point, needs to collect information that ALL items in the collection
// require, like meta-data and stuff like that, and save it for later.
$objects = $transformer->collectMetaData($objects);
// $objects = $transformer->collectMetaData($objects);
$paginator->setCollection($objects);
$resource = new FractalCollection($objects, $transformer, $key);
@@ -284,7 +284,7 @@ abstract class Controller extends BaseController
$baseUrl = sprintf('%s/api/v1', request()->getSchemeAndHttpHost());
$manager->setSerializer(new JsonApiSerializer($baseUrl));
$transformer->collectMetaData(new Collection([$object]));
// $transformer->collectMetaData(new Collection([$object]));
$resource = new Item($object, $transformer, $key);

View File

@@ -97,7 +97,6 @@ class ShowController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setConvertToNative($this->convertToNative);
$enrichment->setNative($this->nativeCurrency);
$accounts = $enrichment->enrich($accounts);
@@ -133,7 +132,6 @@ class ShowController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setConvertToNative($this->convertToNative);
$enrichment->setNative($this->nativeCurrency);
$account = $enrichment->enrichSingle($account);

View File

@@ -76,7 +76,6 @@ class StoreController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setConvertToNative($this->convertToNative);
$enrichment->setNative($this->nativeCurrency);
$account = $enrichment->enrichSingle($account);

View File

@@ -80,7 +80,6 @@ class UpdateController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setConvertToNative($this->convertToNative);
$enrichment->setNative($this->nativeCurrency);
$account = $enrichment->enrichSingle($account);

View File

@@ -30,7 +30,7 @@ use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Exceptions\ValidationException;
use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use Illuminate\Http\JsonResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

View File

@@ -25,9 +25,9 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\ExchangeRateTransformer;
use FireflyIII\Transformers\ExchangeRateTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;

View File

@@ -27,9 +27,9 @@ namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\ExchangeRateTransformer;
use FireflyIII\Transformers\ExchangeRateTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;

View File

@@ -26,9 +26,9 @@ namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\StoreRequest;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\ExchangeRateTransformer;
use FireflyIII\Transformers\ExchangeRateTransformer;
use Illuminate\Http\JsonResponse;
class StoreController extends Controller

View File

@@ -27,9 +27,9 @@ namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\UpdateRequest;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\ExchangeRateTransformer;
use FireflyIII\Transformers\ExchangeRateTransformer;
use Illuminate\Http\JsonResponse;
class UpdateController extends Controller

View File

@@ -84,7 +84,6 @@ class ListController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setConvertToNative($this->convertToNative);
$enrichment->setNative($this->nativeCurrency);
$accounts = $enrichment->enrich($accounts);

View File

@@ -28,7 +28,7 @@ use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;

View File

@@ -107,7 +107,6 @@ class ListController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setConvertToNative($this->convertToNative);
$enrichment->setNative($this->nativeCurrency);
$accounts = $enrichment->enrich($accounts);

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\CurrencyTransformer;

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\StoreRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\CurrencyTransformer;

View File

@@ -28,7 +28,7 @@ use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\UpdateRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\CurrencyTransformer;

View File

@@ -88,7 +88,6 @@ class AccountController extends Controller
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setConvertToNative($this->convertToNative);
$enrichment->setNative($this->nativeCurrency);
$accounts = $enrichment->enrich($accounts);

View File

@@ -37,7 +37,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
@@ -213,6 +213,47 @@ class BasicController extends Controller
'sub_title' => '',
];
}
if (0 === count($return)) {
$currency = $this->nativeCurrency;
// create objects for big array.
$return[] = [
'key' => sprintf('balance-in-%s', $currency->code),
'title' => trans('firefly.box_balance_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatAnything($currency, '0', false),
'local_icon' => 'balance-scale',
'sub_title' => app('amount')->formatAnything($currency, '0', false)
.' + '.app('amount')->formatAnything($currency, '0', false),
];
$return[] = [
'key' => sprintf('spent-in-%s', $currency->code),
'title' => trans('firefly.box_spent_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatAnything($currency, '0', false),
'local_icon' => 'balance-scale',
'sub_title' => '',
];
$return[] = [
'key' => sprintf('earned-in-%s', $currency->code),
'title' => trans('firefly.box_earned_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatAnything($currency, '0', false),
'local_icon' => 'balance-scale',
'sub_title' => '',
];
}
return $return;
}
@@ -268,6 +309,37 @@ class BasicController extends Controller
}
app('log')->debug(sprintf('Done with getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-')));
if (0 === count($return)) {
$currency = $this->nativeCurrency;
unset($info, $amount);
$return[] = [
'key' => sprintf('bills-paid-in-%s', $currency->code),
'title' => trans('firefly.box_bill_paid_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatFlat($currency->symbol, $currency->decimal_places, '0', false),
'local_icon' => 'check',
'sub_title' => '',
];
$return[] = [
'key' => sprintf('bills-unpaid-in-%s', $currency->code),
'title' => trans('firefly.box_bill_unpaid_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatFlat($currency->symbol, $currency->decimal_places, '0', false),
'local_icon' => 'calendar-o',
'sub_title' => '',
];
}
return $return;
}
@@ -315,6 +387,26 @@ class BasicController extends Controller
),
];
}
if (0 === count($return)) {
$currency = $this->nativeCurrency;
$return[] = [
'key' => sprintf('left-to-spend-in-%s', $currency->code),
'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatFlat($currency->symbol, $currency->decimal_places, '0', false),
'local_icon' => 'money',
'sub_title' => app('amount')->formatFlat(
$currency->symbol,
$currency->decimal_places,
'0',
false
),
];
}
return $return;
}

View File

@@ -82,7 +82,7 @@ class UpdateRequest extends FormRequest
'accounts' => 'required',
'accounts.*' => 'array|required',
'accounts.*.account_id' => ['required', 'numeric', 'belongsToUser:accounts,id'],
'accounts.*.current_amount' => ['numeric', new IsValidZeroOrMoreAmount()],
'accounts.*.current_amount' => ['numeric', 'nullable', new IsValidZeroOrMoreAmount(true)],
'object_group_id' => 'numeric|belongsToUser:object_groups,id',
'object_group_title' => ['min:1', 'max:255'],
'transaction_currency_id' => 'exists:transaction_currencies,id|nullable',

View File

@@ -30,7 +30,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountBalance;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
@@ -69,7 +69,7 @@ class AccountController extends Controller
public function accounts(AutocompleteRequest $request): JsonResponse
{
$params = $request->getParameters();
$result = $this->repository->searchAccount($params['query'], $params['account_types'], $params['page'], $params['size']);
$result = $this->repository->searchAccount($params['query'], $params['account_types'], $params['size']);
$return = [];
/** @var Account $account */

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Autocomplete;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\UserGroups\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Autocomplete;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\UserGroups\Tag\TagRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Http\JsonResponse;
/**
@@ -59,7 +59,7 @@ class TagController extends Controller
public function tags(AutocompleteRequest $request): JsonResponse
{
$queryParameters = $request->getParameters();
$result = $this->repository->searchTag($queryParameters['query'], $queryParameters['size']);
$result = $this->repository->searchTag($queryParameters['query']);
$filtered = $result->map(
static function (Tag $item) {
return [

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Autocomplete;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\UserGroups\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -29,7 +29,7 @@ use FireflyIII\Api\V2\Request\Chart\ChartRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Chart\ChartData;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Api\CleansChartData;

View File

@@ -30,7 +30,7 @@ use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Chart\ChartData;
use FireflyIII\Support\Http\Api\AccountBalanceGrouped;
use FireflyIII\Support\Http\Api\CleansChartData;

View File

@@ -32,8 +32,8 @@ use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Support\Http\Api\CleansChartData;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;

View File

@@ -31,8 +31,8 @@ use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Api\CleansChartData;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;

View File

@@ -29,7 +29,7 @@ use Carbon\Exceptions\InvalidDateException;
use Carbon\Exceptions\InvalidFormatException;
use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\AbstractTransformer;
use FireflyIII\Transformers\AbstractTransformer;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Routing\Controller as BaseController;
@@ -167,7 +167,7 @@ class Controller extends BaseController
// the transformer, at this point, needs to collect information that ALL items in the collection
// require, like meta-data and stuff like that, and save it for later.
$objects = $transformer->collectMetaData($objects);
// $objects = $transformer->collectMetaData($objects);
$paginator->setCollection($objects);
$resource = new FractalCollection($objects, $transformer, $key);
@@ -188,7 +188,7 @@ class Controller extends BaseController
$baseUrl = request()->getSchemeAndHttpHost().'/api/v2';
$manager->setSerializer(new JsonApiSerializer($baseUrl));
$transformer->collectMetaData(new Collection([$object]));
// $transformer->collectMetaData(new Collection([$object]));
$resource = new Item($object, $transformer, $key);

View File

@@ -27,8 +27,8 @@ namespace FireflyIII\Api\V2\Controllers\Model\Account;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Model\Account\IndexRequest;
use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Transformers\V2\AccountTransformer;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Transformers\AccountTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\Log;
@@ -67,7 +67,7 @@ class IndexController extends Controller
$types = $request->getAccountTypes();
$sorting = $request->getSortInstructions('accounts');
$filters = $request->getFilterInstructions('accounts');
$accounts = $this->repository->getAccountsByType($types, $sorting, $filters);
$accounts = $this->repository->getAccountsByType($types, $sorting);
$pageSize = $this->parameters->get('limit');
$count = $accounts->count();

View File

@@ -27,8 +27,8 @@ namespace FireflyIII\Api\V2\Controllers\Model\Account;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Transformers\V2\AccountTransformer;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Transformers\AccountTransformer;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -27,8 +27,8 @@ namespace FireflyIII\Api\V2\Controllers\Model\Account;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Model\Account\UpdateRequest;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Transformers\V2\AccountTransformer;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Transformers\AccountTransformer;
use Illuminate\Http\JsonResponse;
class UpdateController extends Controller

View File

@@ -25,9 +25,9 @@ declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\Bill;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\BillTransformer;
use FireflyIII\Transformers\BillTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;

View File

@@ -26,9 +26,9 @@ namespace FireflyIII\Api\V2\Controllers\Model\Bill;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\BillTransformer;
use FireflyIII\Transformers\BillTransformer;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Bill;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Generic\DateRequest;
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use Illuminate\Http\JsonResponse;

View File

@@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Budget;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Transformers\V2\BudgetTransformer;
use FireflyIII\Transformers\BudgetTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;

View File

@@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Generic\DateRequest;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Transformers\V2\BudgetTransformer;
use FireflyIII\Transformers\BudgetTransformer;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\BudgetLimit;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Transformers\V2\BudgetLimitTransformer;
use FireflyIII\Transformers\BudgetLimitTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;

View File

@@ -25,8 +25,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\Currency;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Transformers\V2\CurrencyTransformer;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Transformers\CurrencyTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;

View File

@@ -25,9 +25,9 @@ declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\PiggyBank;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\PiggyBankTransformer;
use FireflyIII\Transformers\PiggyBankTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;

View File

@@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Transaction;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\TransactionGroup;
use FireflyIII\Transformers\V2\TransactionGroupTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
use Illuminate\Http\JsonResponse;
class ShowController extends Controller

View File

@@ -32,7 +32,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use FireflyIII\Rules\IsDuplicateTransaction;
use FireflyIII\Transformers\V2\TransactionGroupTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Validator;

View File

@@ -31,7 +31,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionGroup;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use FireflyIII\Transformers\V2\TransactionGroupTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;

View File

@@ -27,8 +27,8 @@ namespace FireflyIII\Api\V2\Controllers\Model\TransactionCurrency;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Model\TransactionCurrency\IndexRequest;
use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Transformers\V2\CurrencyTransformer;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Transformers\CurrencyTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;

View File

@@ -27,8 +27,8 @@ namespace FireflyIII\Api\V2\Controllers\Model\TransactionCurrency;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Transformers\V2\CurrencyTransformer;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Transformers\CurrencyTransformer;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -34,12 +34,12 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Helpers\Report\NetWorthInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\AvailableBudgetRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\Http\Api\SummaryBalanceGrouped;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;

View File

@@ -29,7 +29,7 @@ use FireflyIII\Api\V2\Request\Generic\SingleDateRequest;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Helpers\Report\NetWorthInterface;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use Illuminate\Http\JsonResponse;

View File

@@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\System;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\Preference;
use FireflyIII\Transformers\V2\PreferenceTransformer;
use FireflyIII\Transformers\PreferenceTransformer;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -29,7 +29,7 @@ use FireflyIII\Api\V2\Request\Model\Transaction\ListRequest;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Account;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\V2\TransactionGroupTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;

View File

@@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Model\Transaction\InfiniteListRequest;
use FireflyIII\Api\V2\Request\Model\Transaction\ListRequest;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Transformers\V2\TransactionGroupTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\UserGroup;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Model\Account\IndexRequest;
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
use FireflyIII\Transformers\V2\UserGroupTransformer;
use FireflyIII\Transformers\UserGroupTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\UserGroup;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
use FireflyIII\Transformers\V2\UserGroupTransformer;
use FireflyIII\Transformers\UserGroupTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\UserGroup;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\UserGroup\StoreRequest;
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
use FireflyIII\Transformers\V2\UserGroupTransformer;
use FireflyIII\Transformers\UserGroupTransformer;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -29,7 +29,7 @@ use FireflyIII\Api\V2\Request\UserGroup\UpdateMembershipRequest;
use FireflyIII\Api\V2\Request\UserGroup\UpdateRequest;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
use FireflyIII\Transformers\V2\UserGroupTransformer;
use FireflyIII\Transformers\UserGroupTransformer;
use Illuminate\Http\JsonResponse;
/**

View File

@@ -31,7 +31,7 @@ use FireflyIII\Models\GroupMembership;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;

View File

@@ -39,7 +39,7 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Support\Facades\Preferences;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Console\Command;

View File

@@ -122,7 +122,7 @@ class CorrectsUnevenAmount extends Command
$journals = DB::table('transactions')
->groupBy('transaction_journal_id')
->whereNull('deleted_at')
->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]) // @phpstan-ignore-line
->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')])
;
/** @var \stdClass $entry */

View File

@@ -0,0 +1,104 @@
<?php
declare(strict_types=1);
/*
* ValidatesEnvironmentVariables.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 ValidatesEnvironmentVariables extends Command
{
use ShowsFriendlyMessages;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'integrity:validates-environment-variables';
/**
* The console command description.
*
* @var null|string
*/
protected $description = 'Makes sure you use the correct variables.';
/**
* Execute the console command.
*/
public function handle(): int
{
$this->validateLanguage();
$this->validateGuard();
$this->validateStaticToken();
return Command::SUCCESS;
}
private function validateLanguage(): void
{
$language = config('firefly.default_language');
$locale = config('firefly.default_locale');
$options = array_keys(config('firefly.languages'));
if (!in_array($language, $options, true)) {
$this->friendlyError(sprintf('DEFAULT_LANGUAGE "%s" is not a valid language for Firefly III.', $language));
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
$this->friendlyError(sprintf('Valid languages are: %s', implode(', ', $options)));
exit(1);
}
$options[] = 'equal';
if (!in_array($locale, $options, true)) {
$this->friendlyError(sprintf('DEFAULT_LOCALE "%s" is not a valid local for Firefly III.', $locale));
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
$this->friendlyError(sprintf('Valid locales are: %s', implode(', ', $options)));
exit(1);
}
}
private function validateGuard(): void
{
$guard = config('auth.defaults.guard');
if ('web' !== $guard && 'remote_user_guard' !== $guard) {
$this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard));
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
$this->friendlyError('Valid guards are: web, remote_user_guard');
exit(1);
}
}
private function validateStaticToken(): void
{
$token = (string) config('firefly.static_cron_token');
if ('' !== $token && 32 !== strlen($token)) {
$this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.');
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
exit(1);
}
}
}

View File

@@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
class CreatesFirstUser extends Command
{
@@ -61,11 +62,11 @@ class CreatesFirstUser extends Command
'email' => $this->argument('email'),
'role' => 'owner',
];
$password = \Str::random(24);
$password = Str::random(24);
$user = $this->repository->store($data);
$user->password = Hash::make($password);
$user->save();
$user->setRememberToken(\Str::random(60));
$user->setRememberToken(Str::random(60));
$this->friendlyInfo(sprintf('Created new admin user (ID #%d) with email address "%s" and password "%s".', $user->id, $user->email, $password));
$this->friendlyWarning('Change this password.');

View File

@@ -28,6 +28,8 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Models\Attachment;
use Illuminate\Console\Command;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Storage;
class ScansAttachments extends Command
{
@@ -43,7 +45,7 @@ class ScansAttachments extends Command
public function handle(): int
{
$attachments = Attachment::get();
$disk = \Storage::disk('upload');
$disk = Storage::disk('upload');
/** @var Attachment $attachment */
foreach ($attachments as $attachment) {
@@ -56,7 +58,7 @@ class ScansAttachments extends Command
}
try {
$decryptedContent = \Crypt::decrypt($encryptedContent); // verified
$decryptedContent = Crypt::decrypt($encryptedContent); // verified
} catch (DecryptException $e) {
app('log')->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
$decryptedContent = $encryptedContent;

View File

@@ -27,6 +27,7 @@ namespace FireflyIII\Console\Commands\System;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\FilesystemException;
class VerifySecurityAlerts extends Command
@@ -48,7 +49,7 @@ class VerifySecurityAlerts extends Command
// check for security advisories.
$version = config('firefly.version');
$disk = \Storage::disk('resources');
$disk = Storage::disk('resources');
// Next line is ignored because it's a Laravel Facade.
if (!$disk->has('alerts.json')) { // @phpstan-ignore-line
app('log')->debug('No alerts.json file present.');

View File

@@ -29,6 +29,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Preference;
use Illuminate\Console\Command;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
class RemovesDatabaseDecryption extends Command
@@ -152,7 +153,7 @@ class RemovesDatabaseDecryption extends Command
private function tryDecrypt($value)
{
try {
$value = \Crypt::decrypt($value);
$value = Crypt::decrypt($value);
} catch (DecryptException $e) {
if ('The MAC is invalid.' === $e->getMessage()) {
throw new FireflyException($e->getMessage(), 0, $e);

View File

@@ -129,6 +129,11 @@ class GracefulNotFoundHandler extends ExceptionHandler
return redirect(route('rules.index'));
case 'rule-groups.edit':
$request->session()->reflash();
return redirect(route('rules.index'));
case 'transactions.mass.edit':
case 'transactions.mass.delete':
case 'transactions.bulk.edit':

View File

@@ -55,6 +55,9 @@ class BillFactory
$skip = array_key_exists('skip', $data) ? $data['skip'] : 0;
$active = array_key_exists('active', $data) ? $data['active'] : 0;
$data['extension_date'] ??= null;
$data['end_date'] ??= null;
/** @var Bill $bill */
$bill = Bill::create(
[

View File

@@ -227,12 +227,12 @@ class PiggyBankFactory
// TODO this is a tedious check. Feels like a hack.
$toBeLinked = [];
foreach ($piggyBank->accounts as $account) {
Log::debug(sprintf('Checking account #%d', $account->id));
foreach ($accounts as $info) {
if ($account->id === $info['account_id']) {
if (array_key_exists($account->id, $accounts)) {
$toBeLinked[$account->id] = ['current_amount' => $account->pivot->current_amount ?? '0'];
Log::debug(sprintf('Prefilled for account #%d with amount %s', $account->id, $account->pivot->current_amount ?? '0'));
}
Log::debug(sprintf(' Checking other account #%d', $info['account_id']));
if ((int) $account->id === (int) $info['account_id']) {
$toBeLinked[$account->id] = ['current_amount' => $account->pivot->current_amount ?? '0'];
Log::debug(sprintf('Prefilled for account #%d with amount %s', $account->id, $account->pivot->current_amount ?? '0'));
}
}
}
@@ -244,9 +244,13 @@ class PiggyBankFactory
if (null === $account) {
continue;
}
if (array_key_exists('current_amount', $info)) {
if (array_key_exists('current_amount', $info) && null !== $info['current_amount']) {
$toBeLinked[$account->id] = ['current_amount' => $info['current_amount']];
Log::debug(sprintf('Will link account #%d with amount %s', $account->id, $account->pivot->current_amount ?? '0'));
Log::debug(sprintf('[a] Will link account #%d with amount %s', $account->id, $info['current_amount']));
}
if (array_key_exists('current_amount', $info) && null === $info['current_amount']) {
$toBeLinked[$account->id] = ['current_amount' => $toBeLinked[$account->id]['current_amount'] ?? '0'];
Log::debug(sprintf('[b] Will link account #%d with amount %s', $account->id, $toBeLinked[$account->id]['current_amount'] ?? '0'));
}
if (!array_key_exists('current_amount', $info)) {
$toBeLinked[$account->id] ??= [];

View File

@@ -41,7 +41,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\TransactionType\TransactionTypeRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
use FireflyIII\Services\Internal\Support\JournalServiceTrait;
use FireflyIII\Support\Facades\FireflyConfig;

View File

@@ -28,8 +28,8 @@ use FireflyIII\Events\Preferences\UserGroupChangedDefaultCurrency;
use FireflyIII\Models\Budget;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Support\Facades\Amount;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Facades\Artisan;

View File

@@ -30,7 +30,7 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionGroup;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Support\Facades\DB;
@@ -88,7 +88,8 @@ class AccountObserver
}
$journalIds = Transaction::where('account_id', $account->id)->get(['transactions.transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
$groupIds = TransactionJournal::whereIn('id', $journalIds)->get(['transaction_journals.transaction_group_id'])->pluck('transaction_group_id')->toArray();
$groupIds = TransactionJournal::whereIn('id', $journalIds)->get(['transaction_journals.transaction_group_id'])->pluck('transaction_group_id')->toArray(); // @phpstan-ignore-line
if (count($journalIds) > 0) {
Transaction::whereIn('transaction_journal_id', $journalIds)->delete();
TransactionJournal::whereIn('id', $journalIds)->delete();

View File

@@ -31,6 +31,7 @@ use Illuminate\Contracts\Encryption\EncryptException;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\MessageBag;
@@ -70,7 +71,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$encryptedData = (string) $this->uploadDisk->get(sprintf('at-%d.data', $attachment->id));
try {
$unencryptedData = \Crypt::decrypt($encryptedData); // verified
$unencryptedData = Crypt::decrypt($encryptedData); // verified
} catch (DecryptException $e) {
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
$unencryptedData = $encryptedData;

View File

@@ -30,8 +30,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Facades\Steam;
@@ -48,12 +47,10 @@ use Illuminate\Support\Facades\Log;
*/
class NetWorth implements NetWorthInterface
{
private AccountRepositoryInterface $accountRepository;
private AdminAccountRepositoryInterface $adminAccountRepository;
private AccountRepositoryInterface $accountRepository;
private CurrencyRepositoryInterface $currencyRepos;
private User $user;
private ?UserGroup $userGroup;
private User $user; // @phpstan-ignore-line
private ?UserGroup $userGroup; // @phpstan-ignore-line
/**
* This method collects the user's net worth in ALL the user's currencies
@@ -85,7 +82,7 @@ class NetWorth implements NetWorthInterface
/** @var Account $account */
foreach ($accounts as $account) {
Log::debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name));
$currency = $this->getRepository()->getAccountCurrency($account) ?? $default;
$currency = $this->accountRepository->getAccountCurrency($account) ?? $default;
$useNative = $convertToNative && $default->id !== $currency->id;
$currency = $useNative ? $default : $currency;
$currencyCode = $currency->code;
@@ -118,36 +115,23 @@ class NetWorth implements NetWorthInterface
return $netWorth;
}
private function getRepository(): AccountRepositoryInterface|AdminAccountRepositoryInterface
{
if (null === $this->userGroup) {
return $this->accountRepository;
}
return $this->adminAccountRepository;
}
public function setUser(null|Authenticatable|User $user): void
{
if (!$user instanceof User) {
return;
}
$this->user = $user;
$this->userGroup = null;
// make repository:
$this->accountRepository = app(AccountRepositoryInterface::class);
$this->accountRepository->setUser($this->user);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
$this->currencyRepos->setUser($this->user);
$this->user = $user;
$this->setUserGroup($user->userGroup);
}
public function setUserGroup(UserGroup $userGroup): void
{
$this->userGroup = $userGroup;
$this->adminAccountRepository = app(AdminAccountRepositoryInterface::class);
$this->adminAccountRepository->setUserGroup($userGroup);
$this->userGroup = $userGroup;
$this->accountRepository = app(AccountRepositoryInterface::class);
$this->accountRepository->setUserGroup($userGroup);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
$this->currencyRepos->setUserGroup($this->userGroup);
}
/**
@@ -163,7 +147,7 @@ class NetWorth implements NetWorthInterface
Log::debug(sprintf('SumNetWorth: finalAccountsBalance("%s")', $date->format('Y-m-d H:i:s')));
$balances = Steam::finalAccountsBalance($accounts, $date);
foreach ($accounts as $account) {
$currency = $this->getRepository()->getAccountCurrency($account);
$currency = $this->accountRepository->getAccountCurrency($account);
$balance = $balances[$account->id]['balance'] ?? '0';
// always subtract virtual balance.
@@ -188,14 +172,14 @@ class NetWorth implements NetWorthInterface
private function getAccounts(): Collection
{
$accounts = $this->getRepository()->getAccountsByType(
$accounts = $this->accountRepository->getAccountsByType(
[AccountTypeEnum::ASSET->value, AccountTypeEnum::DEFAULT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]
);
$filtered = new Collection();
/** @var Account $account */
foreach ($accounts as $account) {
if (1 === (int) $this->getRepository()->getMetaValue($account, 'include_net_worth')) {
if (1 === (int) $this->accountRepository->getMetaValue($account, 'include_net_worth')) {
$filtered->push($account);
}
}

View File

@@ -30,7 +30,7 @@ use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Support\Collection;
/**

View File

@@ -29,10 +29,11 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Debug\Timer;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Controllers\PeriodOverview;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
@@ -114,23 +115,47 @@ class ShowController extends Controller
$subTitle = (string) trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
$chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
$firstTransaction = $this->repository->oldestJournalDate($account) ?? $start;
Log::debug('Start period overview');
Timer::start('period-overview');
$periods = $this->getAccountPeriodOverview($account, $firstTransaction, $end);
Log::debug('End period overview');
Timer::stop('period-overview');
// if layout = v2, overrule the page title.
if ('v1' !== config('view.layout')) {
$subTitle = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]);
}
Log::debug('Collect transactions');
Timer::start('collection');
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation()->setRange($start, $end);
$collector
->setAccounts(new Collection([$account]))
->setLimit($pageSize)
->setPage($page)
->withAPIInformation()
->setRange($start, $end)
;
// this search will not include transaction groups where this asset account (or liability)
// is just part of ONE of the journals. To force this:
$collector->setExpandGroupSearch(true);
$groups = $collector->getPaginatedGroups();
Log::debug('End collect transactions');
Timer::stop('collection');
// enrich data in arrays.
// enrich
// $enrichment = new TransactionGroupEnrichment();
// $enrichment->setUser(auth()->user());
// $groups->setCollection($enrichment->enrich($groups->getCollection()));
$groups->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]));
$showAll = false;
// correct

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Http\Controllers\Admin;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Http\Requests\ConfigurationRequest;
use FireflyIII\Support\Facades\FireflyConfig;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Log;
@@ -68,8 +69,8 @@ class ConfigurationController extends Controller
// all available configuration and their default value in case
// they don't exist yet.
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$siteOwner = config('firefly.site_owner');
return view(
@@ -89,8 +90,8 @@ class ConfigurationController extends Controller
Log::channel('audit')->info('User updates global configuration.', $data);
// store config values
app('fireflyconfig')->set('single_user_mode', $data['single_user_mode']);
app('fireflyconfig')->set('is_demo_site', $data['is_demo_site']);
FireflyConfig::set('single_user_mode', $data['single_user_mode']);
FireflyConfig::set('is_demo_site', $data['is_demo_site']);
// flash message
session()->flash('success', (string) trans('firefly.configuration_updated'));

View File

@@ -28,6 +28,7 @@ use FireflyIII\Events\Test\OwnerTestNotificationChannel;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\NotificationRequest;
use FireflyIII\Notifications\Notifiables\OwnerNotifiable;
use FireflyIII\Support\Facades\FireflyConfig;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
@@ -44,14 +45,14 @@ class NotificationController extends Controller
$subTitleIcon = 'envelope-o';
// notification settings:
$slackUrl = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data;
$pushoverAppToken = app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data;
$pushoverUserToken = app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data;
$ntfyServer = app('fireflyconfig')->getEncrypted('ntfy_server', 'https://ntfy.sh')->data;
$ntfyTopic = app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data;
$ntfyAuth = app('fireflyconfig')->get('ntfy_auth', false)->data;
$ntfyUser = app('fireflyconfig')->getEncrypted('ntfy_user', '')->data;
$ntfyPass = app('fireflyconfig')->getEncrypted('ntfy_pass', '')->data;
$slackUrl = FireflyConfig::getEncrypted('slack_webhook_url', '')->data;
$pushoverAppToken = FireflyConfig::getEncrypted('pushover_app_token', '')->data;
$pushoverUserToken = FireflyConfig::getEncrypted('pushover_user_token', '')->data;
$ntfyServer = FireflyConfig::getEncrypted('ntfy_server', 'https://ntfy.sh')->data;
$ntfyTopic = FireflyConfig::getEncrypted('ntfy_topic', '')->data;
$ntfyAuth = FireflyConfig::get('ntfy_auth', false)->data;
$ntfyUser = FireflyConfig::getEncrypted('ntfy_user', '')->data;
$ntfyPass = FireflyConfig::getEncrypted('ntfy_pass', '')->data;
$channels = config('notifications.channels');
$forcedAvailability = [];
@@ -59,7 +60,7 @@ class NotificationController extends Controller
$notifications = [];
foreach (config('notifications.notifications.owner') as $key => $info) {
if (true === $info['enabled']) {
$notifications[$key] = app('fireflyconfig')->get(sprintf('notification_%s', $key), true)->data;
$notifications[$key] = FireflyConfig::get(sprintf('notification_%s', $key), true)->data;
}
}
@@ -98,19 +99,19 @@ class NotificationController extends Controller
foreach (config('notifications.notifications.owner') as $key => $info) {
if (array_key_exists($key, $all)) {
app('fireflyconfig')->set(sprintf('notification_%s', $key), $all[$key]);
FireflyConfig::set(sprintf('notification_%s', $key), $all[$key]);
}
}
$variables = ['slack_webhook_url', 'pushover_app_token', 'pushover_user_token', 'ntfy_server', 'ntfy_topic', 'ntfy_user', 'ntfy_pass'];
foreach ($variables as $variable) {
if ('' === $all[$variable]) {
app('fireflyconfig')->delete($variable);
FireflyConfig::delete($variable);
}
if ('' !== $all[$variable]) {
app('fireflyconfig')->setEncrypted($variable, $all[$variable]);
FireflyConfig::setEncrypted($variable, $all[$variable]);
}
}
app('fireflyconfig')->set('ntfy_auth', $all['ntfy_auth'] ?? false);
FireflyConfig::set('ntfy_auth', $all['ntfy_auth'] ?? false);
session()->flash('success', (string) trans('firefly.notification_settings_saved'));

View File

@@ -33,7 +33,7 @@ use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Controllers\DateCalculation;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;

View File

@@ -35,7 +35,7 @@ use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use FireflyIII\Support\Http\Controllers\DateCalculation;
use Illuminate\Contracts\View\Factory;

View File

@@ -33,7 +33,7 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Facades\Steam;

View File

@@ -29,7 +29,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Controllers\GetConfigurationData;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

View File

@@ -31,7 +31,7 @@ use FireflyIII\Helpers\Report\NetWorthInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Http\Controllers\DateCalculation;

View File

@@ -27,7 +27,7 @@ use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Requests\NewUserFormRequest;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Controllers\CreateStuff;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;

View File

@@ -148,7 +148,6 @@ class IndexController extends Controller
// enrich each account.
$enrichment = new AccountEnrichment();
$enrichment->setUser(auth()->user());
$enrichment->setConvertToNative($this->convertToNative);
$enrichment->setNative($this->defaultCurrency);
$return = [];
@@ -158,6 +157,7 @@ class IndexController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
/** @var Account $account */
$account = $enrichment->enrichSingle($account);
$array = $accountTransformer->transform($account);
$accountId = (int) $array['id'];

View File

@@ -28,7 +28,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\CurrencyFormRequest;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Http\Controllers\TransactionCurrency;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;

View File

@@ -28,7 +28,7 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\CurrencyFormRequest;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Http\Controllers\TransactionCurrency;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;

View File

@@ -50,13 +50,19 @@ class AcceptHeaders
throw new BadHttpHeaderException(sprintf('Accept header "%s" is not something this server can provide.', $request->header('Accept')));
}
// if bad 'Content-Type' header, refuse service.
if (('POST' === $method || 'PUT' === $method) && !$request->hasHeader('Content-Type')) {
// some routes are exempt from this.
$exempt = [
'api.v1.data.bulk.transactions',
];
if (('POST' === $method || 'PUT' === $method) && !$request->hasHeader('Content-Type') && !in_array($request->route()->getName(), $exempt, true)) {
$error = new BadHttpHeaderException('Content-Type header cannot be empty.');
$error->statusCode = 415;
throw $error;
}
if (('POST' === $method || 'PUT' === $method) && !$this->acceptsHeader($submitted, $contentTypes)) {
if (('POST' === $method || 'PUT' === $method) && !$this->acceptsHeader($submitted, $contentTypes) && !in_array($request->route()->getName(), $exempt, true)) {
$error = new BadHttpHeaderException(sprintf('Content-Type cannot be "%s"', $submitted));
$error->statusCode = 415;

View File

@@ -74,7 +74,7 @@ class TagFormRequest extends FormRequest
'tag' => $tagRule,
'id' => $idRule,
'description' => 'max:32768|min:1|nullable',
'date' => 'date|nullable',
'date' => 'date|nullable|after:1984-09-17',
];
return Location::requestRules($rules);

View File

@@ -55,7 +55,7 @@ class ReturnsSettings
if ('user' === $type && null !== $user) {
$settings['ntfy_server'] = Preferences::getEncryptedForUser($user, 'ntfy_server', 'https://ntfy.sh')->data;
$settings['ntfy_topic'] = Preferences::getEncryptedForUser($user, 'ntfy_topic', '')->data;
$settings['ntfy_auth'] = Preferences::getForUser($user, 'ntfy_auth', false)->data;
$settings['ntfy_auth'] = '1' === Preferences::getForUser($user, 'ntfy_auth', false)->data;
$settings['ntfy_user'] = Preferences::getEncryptedForUser($user, 'ntfy_user', '')->data;
$settings['ntfy_pass'] = Preferences::getEncryptedForUser($user, 'ntfy_pass', '')->data;
Log::debug(sprintf('Auth is %s, user = "%s"', var_export($settings['ntfy_auth'], true), $settings['ntfy_user']));

View File

@@ -29,8 +29,6 @@ use FireflyIII\Repositories\Account\AccountTasker;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use FireflyIII\Repositories\Account\OperationsRepository;
use FireflyIII\Repositories\Account\OperationsRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Account\AccountRepository as AdminAccountRepository;
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -73,21 +71,6 @@ class AccountServiceProvider extends ServiceProvider
}
);
$this->app->bind(
AdminAccountRepositoryInterface::class,
static function (Application $app) {
/** @var AdminAccountRepositoryInterface $repository */
$repository = app(AdminAccountRepository::class);
// phpstan thinks auth does not exist.
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());
}
return $repository;
}
);
$this->app->bind(
OperationsRepositoryInterface::class,
static function (Application $app) {

View File

@@ -25,8 +25,6 @@ namespace FireflyIII\Providers;
use FireflyIII\Repositories\Bill\BillRepository;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Bill\BillRepository as AdminBillRepository;
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface as AdminBillRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -60,20 +58,5 @@ class BillServiceProvider extends ServiceProvider
}
);
// administration variant
$this->app->bind(
AdminBillRepositoryInterface::class,
static function (Application $app) {
/** @var AdminBillRepositoryInterface $repository */
$repository = app(AdminBillRepository::class);
// reference to auth is not understood by phpstan.
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());
}
return $repository;
}
);
}
}

View File

@@ -33,12 +33,6 @@ use FireflyIII\Repositories\Budget\NoBudgetRepository;
use FireflyIII\Repositories\Budget\NoBudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepository;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\AvailableBudgetRepository as AdminAbRepository;
use FireflyIII\Repositories\UserGroups\Budget\AvailableBudgetRepositoryInterface as AdminAbRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\BudgetRepository as AdminBudgetRepository;
use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface as AdminBudgetRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Budget\OperationsRepository as AdminOperationsRepository;
use FireflyIII\Repositories\UserGroups\Budget\OperationsRepositoryInterface as AdminOperationsRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -73,19 +67,6 @@ class BudgetServiceProvider extends ServiceProvider
}
);
$this->app->bind(
AdminBudgetRepositoryInterface::class,
static function (Application $app) {
/** @var AdminBudgetRepositoryInterface $repository */
$repository = app(AdminBudgetRepository::class);
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());
}
return $repository;
}
);
// available budget repos
$this->app->bind(
AvailableBudgetRepositoryInterface::class,
@@ -100,20 +81,6 @@ class BudgetServiceProvider extends ServiceProvider
}
);
// available budget repos
$this->app->bind(
AdminAbRepositoryInterface::class,
static function (Application $app) {
/** @var AdminAbRepositoryInterface $repository */
$repository = app(AdminAbRepository::class);
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());
}
return $repository;
}
);
// budget limit repository.
$this->app->bind(
BudgetLimitRepositoryInterface::class,
@@ -152,18 +119,6 @@ class BudgetServiceProvider extends ServiceProvider
$repository->setUser(auth()->user());
}
return $repository;
}
);
$this->app->bind(
AdminOperationsRepositoryInterface::class,
static function (Application $app) {
/** @var AdminOperationsRepositoryInterface $repository */
$repository = app(AdminOperationsRepository::class);
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());
}
return $repository;
}
);

View File

@@ -29,8 +29,6 @@ use FireflyIII\Repositories\Category\NoCategoryRepository;
use FireflyIII\Repositories\Category\NoCategoryRepositoryInterface;
use FireflyIII\Repositories\Category\OperationsRepository;
use FireflyIII\Repositories\Category\OperationsRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Category\CategoryRepository as UserGroupCategoryRepository;
use FireflyIII\Repositories\UserGroups\Category\CategoryRepositoryInterface as UserGroupCategoryRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -63,20 +61,6 @@ class CategoryServiceProvider extends ServiceProvider
}
);
// phpstan does not understand reference to 'auth'.
$this->app->bind(
UserGroupCategoryRepositoryInterface::class,
static function (Application $app) {
/** @var UserGroupCategoryRepository $repository */
$repository = app(UserGroupCategoryRepository::class);
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());
}
return $repository;
}
);
$this->app->bind(
OperationsRepositoryInterface::class,
static function (Application $app) {

View File

@@ -25,10 +25,10 @@ namespace FireflyIII\Providers;
use FireflyIII\Repositories\Currency\CurrencyRepository;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepository as GroupCurrencyRepository;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface as GroupCurrencyRepositoryInterface;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepository;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepository as GroupCurrencyRepository;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface as GroupCurrencyRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepository;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -77,9 +77,16 @@ class CurrencyServiceProvider extends ServiceProvider
$this->app->bind(
ExchangeRateRepositoryInterface::class,
static function (Application $app) {
/** @var ExchangeRateRepository */
return app(ExchangeRateRepository::class);
/** @var ExchangeRateRepository $repository */
$repository = app(ExchangeRateRepository::class);
// phpstan does not get the reference to auth
if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUserGroup(auth()->user()->userGroup);
}
return $repository;
}
);
}
}

Some files were not shown because too many files have changed in this diff Show More