mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-11-03 20:55:05 +00:00 
			
		
		
		
	Compare commits
	
		
			156 Commits
		
	
	
		
			develop-20
			...
			develop-20
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					ebf7f5932a | ||
| 
						 | 
					4427f2fb99 | ||
| 
						 | 
					6626dfbac3 | ||
| 
						 | 
					093a6387a2 | ||
| 
						 | 
					e34e53eeb3 | ||
| 
						 | 
					07fb45bb34 | ||
| 
						 | 
					d381669733 | ||
| 
						 | 
					fb9eb15ae1 | ||
| 
						 | 
					a2127c382b | ||
| 
						 | 
					e10d39c093 | ||
| 
						 | 
					a933b49e7c | ||
| 
						 | 
					38bcd610df | ||
| 
						 | 
					5beb476a28 | ||
| 
						 | 
					3a43ce6546 | ||
| 
						 | 
					c11fddb097 | ||
| 
						 | 
					98f79cd9bf | ||
| 
						 | 
					a3d3fe758b | ||
| 
						 | 
					93587cf1b6 | ||
| 
						 | 
					361e95f102 | ||
| 
						 | 
					be212e7d1d | ||
| 
						 | 
					003a30727f | ||
| 
						 | 
					27b662e2dc | ||
| 
						 | 
					0b4d7ad95e | ||
| 
						 | 
					7acbfb230a | ||
| 
						 | 
					b974310798 | ||
| 
						 | 
					e391725eed | ||
| 
						 | 
					f505580b33 | ||
| 
						 | 
					270f932a48 | ||
| 
						 | 
					b9afa908e3 | ||
| 
						 | 
					6dcc78b9e5 | ||
| 
						 | 
					7b0e7e8612 | ||
| 
						 | 
					1ece4abd9d | ||
| 
						 | 
					07c03b672b | ||
| 
						 | 
					27ea50ec16 | ||
| 
						 | 
					e1195e6663 | ||
| 
						 | 
					faeb17f319 | ||
| 
						 | 
					db91b1b127 | ||
| 
						 | 
					b5b511c86b | ||
| 
						 | 
					8c805fe0c9 | ||
| 
						 | 
					b0672eb294 | ||
| 
						 | 
					750019808c | ||
| 
						 | 
					7f4510467f | ||
| 
						 | 
					a46f8430df | ||
| 
						 | 
					5e1ecb2b11 | ||
| 
						 | 
					4fff59f16b | ||
| 
						 | 
					eea8f5e07e | ||
| 
						 | 
					a3fcd636e7 | ||
| 
						 | 
					de6dc19077 | ||
| 
						 | 
					7a8e3aca03 | ||
| 
						 | 
					076047ad24 | ||
| 
						 | 
					a4e1c8c24f | ||
| 
						 | 
					3bf1c0075e | ||
| 
						 | 
					1821ade319 | ||
| 
						 | 
					dcd4f072d5 | ||
| 
						 | 
					1734c7f545 | ||
| 
						 | 
					aef3d340ae | ||
| 
						 | 
					e39d4bc288 | ||
| 
						 | 
					ed35b0f81a | ||
| 
						 | 
					4805c9e1c9 | ||
| 
						 | 
					eebcbe0f67 | ||
| 
						 | 
					61e2b79357 | ||
| 
						 | 
					fd3b03d3de | ||
| 
						 | 
					9423a28158 | ||
| 
						 | 
					55062068fd | ||
| 
						 | 
					542b6f670d | ||
| 
						 | 
					5b163b42b4 | ||
| 
						 | 
					613dce51fb | ||
| 
						 | 
					40adb5b203 | ||
| 
						 | 
					fba796fa84 | ||
| 
						 | 
					db4c3f9bfa | ||
| 
						 | 
					d960cc6ad7 | ||
| 
						 | 
					c620ec1f24 | ||
| 
						 | 
					2d78bba6f4 | ||
| 
						 | 
					b7a3f5d740 | ||
| 
						 | 
					96def3c5d4 | ||
| 
						 | 
					e1941d9d87 | ||
| 
						 | 
					a30cf03678 | ||
| 
						 | 
					aa0dcd3b7e | ||
| 
						 | 
					810e92f7a3 | ||
| 
						 | 
					5dd49fc1e1 | ||
| 
						 | 
					8517af105d | ||
| 
						 | 
					442cf7f9b3 | ||
| 
						 | 
					82878b5214 | ||
| 
						 | 
					b0f1102540 | ||
| 
						 | 
					2efee7e6de | ||
| 
						 | 
					abcecc7476 | ||
| 
						 | 
					c28005f649 | ||
| 
						 | 
					a369e61f18 | ||
| 
						 | 
					05d82b6c05 | ||
| 
						 | 
					68ca8fd250 | ||
| 
						 | 
					b55b565ee5 | ||
| 
						 | 
					fc98d66ef4 | ||
| 
						 | 
					f6642c075d | ||
| 
						 | 
					458a337521 | ||
| 
						 | 
					37d2299a1d | ||
| 
						 | 
					f69cffc50b | ||
| 
						 | 
					fd77a17ba5 | ||
| 
						 | 
					b481cf53e7 | ||
| 
						 | 
					a4a4590c45 | ||
| 
						 | 
					9e398beb07 | ||
| 
						 | 
					38ae3df423 | ||
| 
						 | 
					2f17701b68 | ||
| 
						 | 
					4c797c1d4c | ||
| 
						 | 
					a8e1c22c93 | ||
| 
						 | 
					b60021e0ce | ||
| 
						 | 
					453ccd3271 | ||
| 
						 | 
					08f13aebe3 | ||
| 
						 | 
					26df1be871 | ||
| 
						 | 
					fe2def9684 | ||
| 
						 | 
					db2cab3cef | ||
| 
						 | 
					d84405191f | ||
| 
						 | 
					349d32a268 | ||
| 
						 | 
					30b7e17b6f | ||
| 
						 | 
					2d3d3bc0a4 | ||
| 
						 | 
					a4f887921a | ||
| 
						 | 
					710732d7f5 | ||
| 
						 | 
					cd08c16dee | ||
| 
						 | 
					a8f36a2490 | ||
| 
						 | 
					7f12d06989 | ||
| 
						 | 
					8eb0313841 | ||
| 
						 | 
					113eb84461 | ||
| 
						 | 
					cdf42e50f0 | ||
| 
						 | 
					e59cf03d80 | ||
| 
						 | 
					0bd0e6caeb | ||
| 
						 | 
					605623a7af | ||
| 
						 | 
					042d055d85 | ||
| 
						 | 
					cc29d0a850 | ||
| 
						 | 
					7dede49aee | ||
| 
						 | 
					775282ae02 | ||
| 
						 | 
					e49806078a | ||
| 
						 | 
					71d8c0d219 | ||
| 
						 | 
					0031c5a5ad | ||
| 
						 | 
					3ce111550e | ||
| 
						 | 
					58af83cc8c | ||
| 
						 | 
					422a23e700 | ||
| 
						 | 
					8c2672cdf8 | ||
| 
						 | 
					764e49985b | ||
| 
						 | 
					84251f8f10 | ||
| 
						 | 
					3d878cb5dd | ||
| 
						 | 
					8b4740d28c | ||
| 
						 | 
					0845e265c2 | ||
| 
						 | 
					b4455a3802 | ||
| 
						 | 
					8d12d47691 | ||
| 
						 | 
					3dc01b0d5c | ||
| 
						 | 
					b442645280 | ||
| 
						 | 
					eda2b5f822 | ||
| 
						 | 
					d9593db5e2 | ||
| 
						 | 
					9dcb8e2680 | ||
| 
						 | 
					56bac9fc97 | ||
| 
						 | 
					f7ad9c56c8 | ||
| 
						 | 
					0086a0ddc8 | ||
| 
						 | 
					25ebfd6978 | ||
| 
						 | 
					de8149137a | ||
| 
						 | 
					79ae110368 | ||
| 
						 | 
					60aef0de1a | ||
| 
						 | 
					8d464962a8 | 
							
								
								
									
										61
									
								
								.ci/php-cs-fixer/composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										61
									
								
								.ci/php-cs-fixer/composer.lock
									
									
									
										generated
									
									
									
								
							@@ -406,16 +406,16 @@
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "friendsofphp/php-cs-fixer",
 | 
			
		||||
            "version": "v3.69.1",
 | 
			
		||||
            "version": "v3.75.0",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
 | 
			
		||||
                "reference": "13b0c0eede38c11cd674b080f2b485d0f14ffa9f"
 | 
			
		||||
                "reference": "399a128ff2fdaf4281e4e79b755693286cdf325c"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/13b0c0eede38c11cd674b080f2b485d0f14ffa9f",
 | 
			
		||||
                "reference": "13b0c0eede38c11cd674b080f2b485d0f14ffa9f",
 | 
			
		||||
                "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/399a128ff2fdaf4281e4e79b755693286cdf325c",
 | 
			
		||||
                "reference": "399a128ff2fdaf4281e4e79b755693286cdf325c",
 | 
			
		||||
                "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.69.1"
 | 
			
		||||
                "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.75.0"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
@@ -505,7 +506,7 @@
 | 
			
		||||
                    "type": "github"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2025-02-18T23:57:43+00:00"
 | 
			
		||||
            "time": "2025-03-31T18:40:42+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "psr/container",
 | 
			
		||||
@@ -1255,16 +1256,16 @@
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "symfony/console",
 | 
			
		||||
            "version": "v7.2.1",
 | 
			
		||||
            "version": "v7.2.5",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/symfony/console.git",
 | 
			
		||||
                "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3"
 | 
			
		||||
                "reference": "e51498ea18570c062e7df29d05a7003585b19b88"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3",
 | 
			
		||||
                "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/console/zipball/e51498ea18570c062e7df29d05a7003585b19b88",
 | 
			
		||||
                "reference": "e51498ea18570c062e7df29d05a7003585b19b88",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
@@ -1328,7 +1329,7 @@
 | 
			
		||||
                "terminal"
 | 
			
		||||
            ],
 | 
			
		||||
            "support": {
 | 
			
		||||
                "source": "https://github.com/symfony/console/tree/v7.2.1"
 | 
			
		||||
                "source": "https://github.com/symfony/console/tree/v7.2.5"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
@@ -1344,7 +1345,7 @@
 | 
			
		||||
                    "type": "tidelift"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2024-12-11T03:49:26+00:00"
 | 
			
		||||
            "time": "2025-03-12T08:11:12+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "symfony/deprecation-contracts",
 | 
			
		||||
@@ -2242,16 +2243,16 @@
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "symfony/process",
 | 
			
		||||
            "version": "v7.2.0",
 | 
			
		||||
            "version": "v7.2.5",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/symfony/process.git",
 | 
			
		||||
                "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e"
 | 
			
		||||
                "reference": "87b7c93e57df9d8e39a093d32587702380ff045d"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e",
 | 
			
		||||
                "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/process/zipball/87b7c93e57df9d8e39a093d32587702380ff045d",
 | 
			
		||||
                "reference": "87b7c93e57df9d8e39a093d32587702380ff045d",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
@@ -2283,7 +2284,7 @@
 | 
			
		||||
            "description": "Executes commands in sub-processes",
 | 
			
		||||
            "homepage": "https://symfony.com",
 | 
			
		||||
            "support": {
 | 
			
		||||
                "source": "https://github.com/symfony/process/tree/v7.2.0"
 | 
			
		||||
                "source": "https://github.com/symfony/process/tree/v7.2.5"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
@@ -2299,7 +2300,7 @@
 | 
			
		||||
                    "type": "tidelift"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2024-11-06T14:24:19+00:00"
 | 
			
		||||
            "time": "2025-03-13T12:21:46+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "symfony/service-contracts",
 | 
			
		||||
@@ -2386,16 +2387,16 @@
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "symfony/stopwatch",
 | 
			
		||||
            "version": "v7.2.2",
 | 
			
		||||
            "version": "v7.2.4",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/symfony/stopwatch.git",
 | 
			
		||||
                "reference": "e46690d5b9d7164a6d061cab1e8d46141b9f49df"
 | 
			
		||||
                "reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/stopwatch/zipball/e46690d5b9d7164a6d061cab1e8d46141b9f49df",
 | 
			
		||||
                "reference": "e46690d5b9d7164a6d061cab1e8d46141b9f49df",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd",
 | 
			
		||||
                "reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
@@ -2428,7 +2429,7 @@
 | 
			
		||||
            "description": "Provides a way to profile code",
 | 
			
		||||
            "homepage": "https://symfony.com",
 | 
			
		||||
            "support": {
 | 
			
		||||
                "source": "https://github.com/symfony/stopwatch/tree/v7.2.2"
 | 
			
		||||
                "source": "https://github.com/symfony/stopwatch/tree/v7.2.4"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
@@ -2444,7 +2445,7 @@
 | 
			
		||||
                    "type": "tidelift"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2024-12-18T14:28:33+00:00"
 | 
			
		||||
            "time": "2025-02-24T10:49:57+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "symfony/string",
 | 
			
		||||
 
 | 
			
		||||
@@ -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
									
									
								
							
							
						
						
									
										8
									
								
								.github/mergify.yml
									
									
									
									
										vendored
									
									
								
							@@ -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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/close-duplicates.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/close-duplicates.yml
									
									
									
									
										vendored
									
									
								
							@@ -13,7 +13,7 @@ jobs:
 | 
			
		||||
  close_duplicates:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: github/command@v1.3.0
 | 
			
		||||
      - uses: github/command@v2.0.0
 | 
			
		||||
        id: command
 | 
			
		||||
        with:
 | 
			
		||||
          allowed_contexts: "issue"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										329
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										329
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							@@ -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,11 @@ 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 "Welcome to release $version of Firefly III. It contains the the latest fixes, translations and features. Docker users can find this release under the \`latest\` tag." >> output.txt
 | 
			
		||||
            echo '' >> output.txt
 | 
			
		||||
            echo '### Instructions' >> output.txt
 | 
			
		||||
            echo '' >> output.txt
 | 
			
		||||
@@ -262,7 +272,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 +290,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 +305,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 +435,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
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -7,6 +7,7 @@ yarn-error.log
 | 
			
		||||
.env
 | 
			
		||||
/.ci/php-cs-fixer/vendor
 | 
			
		||||
coverage.xml
 | 
			
		||||
output.txt
 | 
			
		||||
 | 
			
		||||
# ignore generated files.
 | 
			
		||||
public/build
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,8 @@ 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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,13 +27,16 @@ namespace FireflyIII\Api\V1\Controllers\Chart;
 | 
			
		||||
use Carbon\Carbon;
 | 
			
		||||
use FireflyIII\Api\V1\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Api\V1\Requests\Data\DateRequest;
 | 
			
		||||
use FireflyIII\Api\V1\Requests\Chart\ChartRequest;
 | 
			
		||||
use FireflyIII\Enums\AccountTypeEnum;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Models\Account;
 | 
			
		||||
use FireflyIII\Models\Preference;
 | 
			
		||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Chart\ChartData;
 | 
			
		||||
use FireflyIII\Support\Facades\Steam;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ApiSupport;
 | 
			
		||||
use FireflyIII\Support\Http\Api\CollectsAccountsFromFilter;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
 | 
			
		||||
@@ -43,8 +46,10 @@ use Illuminate\Http\JsonResponse;
 | 
			
		||||
class AccountController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    use ApiSupport;
 | 
			
		||||
    use CollectsAccountsFromFilter;
 | 
			
		||||
 | 
			
		||||
    private AccountRepositoryInterface $repository;
 | 
			
		||||
    private ChartData                  $chartData;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * AccountController constructor.
 | 
			
		||||
@@ -56,6 +61,7 @@ class AccountController extends Controller
 | 
			
		||||
            function ($request, $next) {
 | 
			
		||||
                /** @var User $user */
 | 
			
		||||
                $user             = auth()->user();
 | 
			
		||||
                $this->chartData  = new ChartData();
 | 
			
		||||
                $this->repository = app(AccountRepositoryInterface::class);
 | 
			
		||||
                $this->repository->setUser($user);
 | 
			
		||||
 | 
			
		||||
@@ -64,6 +70,29 @@ class AccountController extends Controller
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * TODO fix documentation
 | 
			
		||||
     *
 | 
			
		||||
     * @throws FireflyException
 | 
			
		||||
     */
 | 
			
		||||
    public function dashboard(ChartRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $queryParameters = $request->getParameters();
 | 
			
		||||
        $accounts        = $this->getAccountList($queryParameters);
 | 
			
		||||
 | 
			
		||||
        // move date to end of day
 | 
			
		||||
        $queryParameters['start']->startOfDay();
 | 
			
		||||
        $queryParameters['end']->endOfDay();
 | 
			
		||||
 | 
			
		||||
        // loop each account, and collect info:
 | 
			
		||||
        /** @var Account $account */
 | 
			
		||||
        foreach ($accounts as $account) {
 | 
			
		||||
            $this->renderAccountData($queryParameters, $account);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return response()->json($this->chartData->render());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This endpoint is documented at:
 | 
			
		||||
     * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/charts/getChartAccountOverview
 | 
			
		||||
@@ -133,4 +162,45 @@ class AccountController extends Controller
 | 
			
		||||
 | 
			
		||||
        return response()->json($chartData);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @throws FireflyException
 | 
			
		||||
     */
 | 
			
		||||
    private function renderAccountData(array $params, Account $account): void
 | 
			
		||||
    {
 | 
			
		||||
        $currency     = $this->repository->getAccountCurrency($account);
 | 
			
		||||
        if (null === $currency) {
 | 
			
		||||
            $currency = $this->default;
 | 
			
		||||
        }
 | 
			
		||||
        $currentSet   = [
 | 
			
		||||
            'label'                          => $account->name,
 | 
			
		||||
 | 
			
		||||
            // the currency that belongs to the account.
 | 
			
		||||
            'currency_id'                    => (string) $currency->id,
 | 
			
		||||
            'currency_code'                  => $currency->code,
 | 
			
		||||
            'currency_symbol'                => $currency->symbol,
 | 
			
		||||
            'currency_decimal_places'        => $currency->decimal_places,
 | 
			
		||||
 | 
			
		||||
            // the default currency of the user (could be the same!)
 | 
			
		||||
            'date'                           => $params['start']->toAtomString(),
 | 
			
		||||
            'start'                          => $params['start']->toAtomString(),
 | 
			
		||||
            'end'                            => $params['end']->toAtomString(),
 | 
			
		||||
            'period'                         => '1D',
 | 
			
		||||
            'entries'                        => [],
 | 
			
		||||
        ];
 | 
			
		||||
        $currentStart = clone $params['start'];
 | 
			
		||||
        $range        = Steam::finalAccountBalanceInRange($account, $params['start'], clone $params['end'], $this->convertToNative);
 | 
			
		||||
 | 
			
		||||
        $previous     = array_values($range)[0]['balance'];
 | 
			
		||||
        while ($currentStart <= $params['end']) {
 | 
			
		||||
            $format                        = $currentStart->format('Y-m-d');
 | 
			
		||||
            $label                         = $currentStart->toAtomString();
 | 
			
		||||
            $balance                       = array_key_exists($format, $range) ? $range[$format]['balance'] : $previous;
 | 
			
		||||
            $previous                      = $balance;
 | 
			
		||||
 | 
			
		||||
            $currentStart->addDay();
 | 
			
		||||
            $currentSet['entries'][$label] = $balance;
 | 
			
		||||
        }
 | 
			
		||||
        $this->chartData->add($currentSet);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										260
									
								
								app/Api/V1/Controllers/Chart/BudgetController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										260
									
								
								app/Api/V1/Controllers/Chart/BudgetController.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,260 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * BudgetController.php
 | 
			
		||||
 * Copyright (c) 2023 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace FireflyIII\Api\V1\Controllers\Chart;
 | 
			
		||||
 | 
			
		||||
use Carbon\Carbon;
 | 
			
		||||
use FireflyIII\Api\V1\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Api\V1\Requests\Generic\DateRequest;
 | 
			
		||||
use FireflyIII\Enums\UserRoleEnum;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Models\Budget;
 | 
			
		||||
use FireflyIII\Models\BudgetLimit;
 | 
			
		||||
use FireflyIII\Models\TransactionCurrency;
 | 
			
		||||
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\CleansChartData;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Illuminate\Support\Collection;
 | 
			
		||||
use Illuminate\Support\Facades\Log;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class BudgetController
 | 
			
		||||
 */
 | 
			
		||||
class BudgetController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    use CleansChartData;
 | 
			
		||||
    use ValidatesUserGroupTrait;
 | 
			
		||||
 | 
			
		||||
    protected array $acceptedRoles                      = [UserRoleEnum::READ_ONLY];
 | 
			
		||||
 | 
			
		||||
    protected OperationsRepositoryInterface $opsRepository;
 | 
			
		||||
    private BudgetLimitRepositoryInterface  $blRepository;
 | 
			
		||||
    private array                           $currencies = [];
 | 
			
		||||
    private TransactionCurrency             $currency;
 | 
			
		||||
    private BudgetRepositoryInterface       $repository;
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
        $this->middleware(
 | 
			
		||||
            function ($request, $next) {
 | 
			
		||||
                $this->repository    = app(BudgetRepositoryInterface::class);
 | 
			
		||||
                $this->blRepository  = app(BudgetLimitRepositoryInterface::class);
 | 
			
		||||
                $this->opsRepository = app(OperationsRepositoryInterface::class);
 | 
			
		||||
                $userGroup           = $this->validateUserGroup($request);
 | 
			
		||||
                $this->repository->setUserGroup($userGroup);
 | 
			
		||||
                $this->opsRepository->setUserGroup($userGroup);
 | 
			
		||||
                $this->blRepository->setUserGroup($userGroup);
 | 
			
		||||
 | 
			
		||||
                return $next($request);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * TODO see autocomplete/accountcontroller
 | 
			
		||||
     */
 | 
			
		||||
    public function dashboard(DateRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $params  = $request->getAll();
 | 
			
		||||
 | 
			
		||||
        /** @var Carbon $start */
 | 
			
		||||
        $start   = $params['start'];
 | 
			
		||||
 | 
			
		||||
        /** @var Carbon $end */
 | 
			
		||||
        $end     = $params['end'];
 | 
			
		||||
 | 
			
		||||
        // code from FrontpageChartGenerator, but not in separate class
 | 
			
		||||
        $budgets = $this->repository->getActiveBudgets();
 | 
			
		||||
        $data    = [];
 | 
			
		||||
 | 
			
		||||
        /** @var Budget $budget */
 | 
			
		||||
        foreach ($budgets as $budget) {
 | 
			
		||||
            // could return multiple arrays, so merge.
 | 
			
		||||
            $data = array_merge($data, $this->processBudget($budget, $start, $end));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return response()->json($this->clean($data));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @throws FireflyException
 | 
			
		||||
     */
 | 
			
		||||
    private function processBudget(Budget $budget, Carbon $start, Carbon $end): array
 | 
			
		||||
    {
 | 
			
		||||
        // get all limits:
 | 
			
		||||
        $limits = $this->blRepository->getBudgetLimits($budget, $start, $end);
 | 
			
		||||
        $rows   = [];
 | 
			
		||||
 | 
			
		||||
        // if no limits
 | 
			
		||||
        if (0 === $limits->count()) {
 | 
			
		||||
            // return as a single item in an array
 | 
			
		||||
            $rows = $this->noBudgetLimits($budget, $start, $end);
 | 
			
		||||
        }
 | 
			
		||||
        if ($limits->count() > 0) {
 | 
			
		||||
            $rows = $this->budgetLimits($budget, $limits);
 | 
			
		||||
        }
 | 
			
		||||
        // is always an array
 | 
			
		||||
        $return = [];
 | 
			
		||||
        foreach ($rows as $row) {
 | 
			
		||||
            $current  = [
 | 
			
		||||
                'label'                   => $budget->name,
 | 
			
		||||
                'currency_id'             => (string) $row['currency_id'],
 | 
			
		||||
                'currency_code'           => $row['currency_code'],
 | 
			
		||||
                'currency_name'           => $row['currency_name'],
 | 
			
		||||
                'currency_decimal_places' => $row['currency_decimal_places'],
 | 
			
		||||
                'period'                  => null,
 | 
			
		||||
                'start'                   => $row['start'],
 | 
			
		||||
                'end'                     => $row['end'],
 | 
			
		||||
                'entries'                 => [
 | 
			
		||||
                    'spent'     => $row['spent'],
 | 
			
		||||
                    'left'      => $row['left'],
 | 
			
		||||
                    'overspent' => $row['overspent'],
 | 
			
		||||
                ],
 | 
			
		||||
            ];
 | 
			
		||||
            $return[] = $current;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * When no budget limits are present, the expenses of the whole period are collected and grouped.
 | 
			
		||||
     * This is grouped per currency. Because there is no limit set, "left to spend" and "overspent" are empty.
 | 
			
		||||
     *
 | 
			
		||||
     * @throws FireflyException
 | 
			
		||||
     */
 | 
			
		||||
    private function noBudgetLimits(Budget $budget, Carbon $start, Carbon $end): array
 | 
			
		||||
    {
 | 
			
		||||
        $spent = $this->opsRepository->listExpenses($start, $end, null, new Collection([$budget]));
 | 
			
		||||
 | 
			
		||||
        return $this->processExpenses($budget->id, $spent, $start, $end);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Shared between the "noBudgetLimits" function and "processLimit". Will take a single set of expenses and return
 | 
			
		||||
     * its info.
 | 
			
		||||
     *
 | 
			
		||||
     * @param array<int, array<int, string>> $array
 | 
			
		||||
     *
 | 
			
		||||
     * @throws FireflyException
 | 
			
		||||
     */
 | 
			
		||||
    private function processExpenses(int $budgetId, array $array, Carbon $start, Carbon $end): array
 | 
			
		||||
    {
 | 
			
		||||
        $return = [];
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * This array contains the expenses in this budget. Grouped per currency.
 | 
			
		||||
         * The grouping is on the main currency only.
 | 
			
		||||
         *
 | 
			
		||||
         * @var int   $currencyId
 | 
			
		||||
         * @var array $block
 | 
			
		||||
         */
 | 
			
		||||
        foreach ($array as $currencyId => $block) {
 | 
			
		||||
            $this->currencies[$currencyId] ??= TransactionCurrency::find($currencyId);
 | 
			
		||||
            $return[$currencyId]           ??= [
 | 
			
		||||
                'currency_id'             => (string) $currencyId,
 | 
			
		||||
                'currency_code'           => $block['currency_code'],
 | 
			
		||||
                'currency_name'           => $block['currency_name'],
 | 
			
		||||
                'currency_symbol'         => $block['currency_symbol'],
 | 
			
		||||
                'currency_decimal_places' => (int) $block['currency_decimal_places'],
 | 
			
		||||
                'start'                   => $start->toAtomString(),
 | 
			
		||||
                'end'                     => $end->toAtomString(),
 | 
			
		||||
                'spent'                   => '0',
 | 
			
		||||
                'left'                    => '0',
 | 
			
		||||
                'overspent'               => '0',
 | 
			
		||||
            ];
 | 
			
		||||
            $currentBudgetArray = $block['budgets'][$budgetId];
 | 
			
		||||
 | 
			
		||||
            // var_dump($return);
 | 
			
		||||
            /** @var array $journal */
 | 
			
		||||
            foreach ($currentBudgetArray['transaction_journals'] as $journal) {
 | 
			
		||||
                $return[$currencyId]['spent'] = bcadd($return[$currencyId]['spent'], $journal['amount']);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Function that processes each budget limit (per budget).
 | 
			
		||||
     *
 | 
			
		||||
     * If you have a budget limit in EUR, only transactions in EUR will be considered.
 | 
			
		||||
     * If you have a budget limit in GBP, only transactions in GBP will be considered.
 | 
			
		||||
     *
 | 
			
		||||
     * If you have a budget limit in EUR, and a transaction in GBP, it will not be considered for the EUR budget limit.
 | 
			
		||||
     *
 | 
			
		||||
     * @throws FireflyException
 | 
			
		||||
     */
 | 
			
		||||
    private function budgetLimits(Budget $budget, Collection $limits): array
 | 
			
		||||
    {
 | 
			
		||||
        app('log')->debug(sprintf('Now in budgetLimits(#%d)', $budget->id));
 | 
			
		||||
        $data = [];
 | 
			
		||||
 | 
			
		||||
        /** @var BudgetLimit $limit */
 | 
			
		||||
        foreach ($limits as $limit) {
 | 
			
		||||
            $data = array_merge($data, $this->processLimit($budget, $limit));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @throws FireflyException
 | 
			
		||||
     */
 | 
			
		||||
    private function processLimit(Budget $budget, BudgetLimit $limit): array
 | 
			
		||||
    {
 | 
			
		||||
        Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
 | 
			
		||||
        $end             = clone $limit->end_date;
 | 
			
		||||
        $end->endOfDay();
 | 
			
		||||
        $spent           = $this->opsRepository->listExpenses($limit->start_date, $end, null, new Collection([$budget]));
 | 
			
		||||
        $limitCurrencyId = $limit->transaction_currency_id;
 | 
			
		||||
        $filtered        = [];
 | 
			
		||||
 | 
			
		||||
        /** @var array $entry */
 | 
			
		||||
        foreach ($spent as $currencyId => $entry) {
 | 
			
		||||
            // only spent the entry where the entry's currency matches the budget limit's currency
 | 
			
		||||
            // so $filtered will only have 1 or 0 entries
 | 
			
		||||
            if ($entry['currency_id'] === $limitCurrencyId) {
 | 
			
		||||
                $filtered[$currencyId] = $entry;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        $result          = $this->processExpenses($budget->id, $filtered, $limit->start_date, $end);
 | 
			
		||||
        if (1 === count($result)) {
 | 
			
		||||
            $compare = bccomp($limit->amount, app('steam')->positive($result[$limitCurrencyId]['spent']));
 | 
			
		||||
            if (1 === $compare) {
 | 
			
		||||
                // convert this amount into the native currency:
 | 
			
		||||
                $result[$limitCurrencyId]['left'] = bcadd($limit->amount, $result[$limitCurrencyId]['spent']);
 | 
			
		||||
            }
 | 
			
		||||
            if ($compare <= 0) {
 | 
			
		||||
                $result[$limitCurrencyId]['overspent'] = app('steam')->positive(bcadd($limit->amount, $result[$limitCurrencyId]['spent']));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $result;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										128
									
								
								app/Api/V1/Controllers/Chart/CategoryController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								app/Api/V1/Controllers/Chart/CategoryController.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,128 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * CategoryController.php
 | 
			
		||||
 * Copyright (c) 2023 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace FireflyIII\Api\V1\Controllers\Chart;
 | 
			
		||||
 | 
			
		||||
use Carbon\Carbon;
 | 
			
		||||
use FireflyIII\Api\V2\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Api\V2\Request\Generic\DateRequest;
 | 
			
		||||
use FireflyIII\Enums\AccountTypeEnum;
 | 
			
		||||
use FireflyIII\Enums\TransactionTypeEnum;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
 | 
			
		||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\CleansChartData;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class BudgetController
 | 
			
		||||
 */
 | 
			
		||||
class CategoryController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    use CleansChartData;
 | 
			
		||||
    use ValidatesUserGroupTrait;
 | 
			
		||||
 | 
			
		||||
    private AccountRepositoryInterface  $accountRepos;
 | 
			
		||||
    private CurrencyRepositoryInterface $currencyRepos;
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
        $this->middleware(
 | 
			
		||||
            function ($request, $next) {
 | 
			
		||||
                $this->accountRepos  = app(AccountRepositoryInterface::class);
 | 
			
		||||
                $this->currencyRepos = app(CurrencyRepositoryInterface::class);
 | 
			
		||||
                $userGroup           = $this->validateUserGroup($request);
 | 
			
		||||
                $this->accountRepos->setUserGroup($userGroup);
 | 
			
		||||
                $this->currencyRepos->setUserGroup($userGroup);
 | 
			
		||||
 | 
			
		||||
                return $next($request);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * TODO may be worth to move to a handler but the data is simple enough.
 | 
			
		||||
     * TODO see autoComplete/account controller
 | 
			
		||||
     *
 | 
			
		||||
     * @throws FireflyException
 | 
			
		||||
     *
 | 
			
		||||
     * @SuppressWarnings("PHPMD.UnusedFormalParameter")
 | 
			
		||||
     */
 | 
			
		||||
    public function dashboard(DateRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        /** @var Carbon $start */
 | 
			
		||||
        $start      = $this->parameters->get('start');
 | 
			
		||||
 | 
			
		||||
        /** @var Carbon $end */
 | 
			
		||||
        $end        = $this->parameters->get('end');
 | 
			
		||||
        $accounts   = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::DEFAULT->value]);
 | 
			
		||||
        $currencies = [];
 | 
			
		||||
        $return     = [];
 | 
			
		||||
 | 
			
		||||
        // get journals for entire period:
 | 
			
		||||
        /** @var GroupCollectorInterface $collector */
 | 
			
		||||
        $collector  = app(GroupCollectorInterface::class);
 | 
			
		||||
        $collector->setRange($start, $end)->withAccountInformation();
 | 
			
		||||
        $collector->setXorAccounts($accounts)->withCategoryInformation();
 | 
			
		||||
        $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::RECONCILIATION->value]);
 | 
			
		||||
        $journals   = $collector->getExtractedJournals();
 | 
			
		||||
 | 
			
		||||
        /** @var array $journal */
 | 
			
		||||
        foreach ($journals as $journal) {
 | 
			
		||||
            $currencyId              = (int) $journal['currency_id'];
 | 
			
		||||
            $currency                = $currencies[$currencyId] ?? $this->currencyRepos->find($currencyId);
 | 
			
		||||
            $currencies[$currencyId] = $currency;
 | 
			
		||||
            $categoryName            = null === $journal['category_name'] ? (string) trans('firefly.no_category') : $journal['category_name'];
 | 
			
		||||
            $amount                  = app('steam')->positive($journal['amount']);
 | 
			
		||||
            $key                     = sprintf('%s-%s', $categoryName, $currency->code);
 | 
			
		||||
            // create arrays
 | 
			
		||||
            $return[$key] ??= [
 | 
			
		||||
                'label'                   => $categoryName,
 | 
			
		||||
                'currency_id'             => (string) $currency->id,
 | 
			
		||||
                'currency_code'           => $currency->code,
 | 
			
		||||
                'currency_name'           => $currency->name,
 | 
			
		||||
                'currency_symbol'         => $currency->symbol,
 | 
			
		||||
                'currency_decimal_places' => $currency->decimal_places,
 | 
			
		||||
                'period'                  => null,
 | 
			
		||||
                'start'                   => $start->toAtomString(),
 | 
			
		||||
                'end'                     => $end->toAtomString(),
 | 
			
		||||
                'amount'                  => '0',
 | 
			
		||||
            ];
 | 
			
		||||
 | 
			
		||||
            // add monies
 | 
			
		||||
            $return[$key]['amount']  = bcadd($return[$key]['amount'], $amount);
 | 
			
		||||
        }
 | 
			
		||||
        $return     = array_values($return);
 | 
			
		||||
 | 
			
		||||
        // order by amount
 | 
			
		||||
        usort($return, static function (array $a, array $b) {
 | 
			
		||||
            return (float) $a['amount'] < (float) $b['amount'] ? 1 : -1;
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        return response()->json($this->clean($return));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,8 +37,10 @@ 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\Support\Http\Api\ExchangeRateConverter;
 | 
			
		||||
use FireflyIII\Support\Report\Summarizer\TransactionSummarizer;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Illuminate\Support\Facades\Log;
 | 
			
		||||
@@ -100,7 +102,7 @@ class BasicController extends Controller
 | 
			
		||||
 | 
			
		||||
        // balance information:
 | 
			
		||||
        $balanceData  = $this->getBalanceInformation($start, $end);
 | 
			
		||||
        $billData     = $this->getBillInformation($start, $end);
 | 
			
		||||
        $billData     = $this->getSubscriptionInformation($start, $end);
 | 
			
		||||
        $spentData    = $this->getLeftToSpendInfo($start, $end);
 | 
			
		||||
        $netWorthData = $this->getNetWorthInfo($end);
 | 
			
		||||
        //                $balanceData  = [];
 | 
			
		||||
@@ -122,6 +124,7 @@ class BasicController extends Controller
 | 
			
		||||
 | 
			
		||||
    private function getBalanceInformation(Carbon $start, Carbon $end): array
 | 
			
		||||
    {
 | 
			
		||||
        Log::debug('getBalanceInformation');
 | 
			
		||||
        // some config settings
 | 
			
		||||
        $convertToNative = Amount::convertToNative();
 | 
			
		||||
        $default         = Amount::getNativeCurrency();
 | 
			
		||||
@@ -130,47 +133,110 @@ class BasicController extends Controller
 | 
			
		||||
        $expenses        = [];
 | 
			
		||||
        $sums            = [];
 | 
			
		||||
        $return          = [];
 | 
			
		||||
        $currencies      = [
 | 
			
		||||
            $default->id => $default,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        // collect income of user using the new group collector.
 | 
			
		||||
        /** @var GroupCollectorInterface $collector */
 | 
			
		||||
        $collector       = app(GroupCollectorInterface::class);
 | 
			
		||||
        $collector->setRange($start, $end)->setPage($this->parameters->get('page'))->setTypes([TransactionTypeEnum::DEPOSIT->value]);
 | 
			
		||||
        $summarizer      = new TransactionSummarizer();
 | 
			
		||||
        $set             = $collector->setRange($start, $end)->setTypes([TransactionTypeEnum::DEPOSIT->value])->getExtractedJournals();
 | 
			
		||||
        $incomes         = $summarizer->groupByCurrencyId($set, 'positive', false);
 | 
			
		||||
 | 
			
		||||
        $set             = $collector->getExtractedJournals();
 | 
			
		||||
 | 
			
		||||
        /** @var array $journal */
 | 
			
		||||
        foreach ($set as $journal) {
 | 
			
		||||
            $currencyId           = $convertToNative ? $default->id : (int) $journal['currency_id'];
 | 
			
		||||
            $amount               = Amount::getAmountFromJournal($journal);
 | 
			
		||||
            $incomes[$currencyId] ??= '0';
 | 
			
		||||
            $incomes[$currencyId] = bcadd(
 | 
			
		||||
                $incomes[$currencyId],
 | 
			
		||||
                bcmul($amount, '-1')
 | 
			
		||||
            );
 | 
			
		||||
            $sums[$currencyId]    ??= '0';
 | 
			
		||||
            $sums[$currencyId]    = bcadd($sums[$currencyId], bcmul($amount, '-1'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // collect expenses of user.
 | 
			
		||||
        // collect expenses of user using the new group collector.
 | 
			
		||||
        /** @var GroupCollectorInterface $collector */
 | 
			
		||||
        $collector       = app(GroupCollectorInterface::class);
 | 
			
		||||
        $collector->setRange($start, $end)->setPage($this->parameters->get('page'))->setTypes([TransactionTypeEnum::WITHDRAWAL->value]);
 | 
			
		||||
        $set             = $collector->getExtractedJournals();
 | 
			
		||||
        $set             = $collector->setRange($start, $end)->setPage($this->parameters->get('page'))->setTypes([TransactionTypeEnum::WITHDRAWAL->value])->getExtractedJournals();
 | 
			
		||||
        $expenses        = $summarizer->groupByCurrencyId($set, 'negative', false);
 | 
			
		||||
 | 
			
		||||
        /** @var array $journal */
 | 
			
		||||
        foreach ($set as $journal) {
 | 
			
		||||
            $currencyId            = $convertToNative ? $default->id : (int) $journal['currency_id'];
 | 
			
		||||
            $amount                = Amount::getAmountFromJournal($journal);
 | 
			
		||||
            $expenses[$currencyId] ??= '0';
 | 
			
		||||
            $expenses[$currencyId] = bcadd($expenses[$currencyId], $amount);
 | 
			
		||||
            $sums[$currencyId]     ??= '0';
 | 
			
		||||
            $sums[$currencyId]     = bcadd($sums[$currencyId], $amount);
 | 
			
		||||
        // if convert to native, do so right now.
 | 
			
		||||
        if ($convertToNative) {
 | 
			
		||||
            $newExpenses = [
 | 
			
		||||
                $default->id => [
 | 
			
		||||
                    'currency_id'             => $default->id,
 | 
			
		||||
                    'currency_code'           => $default->code,
 | 
			
		||||
                    'currency_symbol'         => $default->symbol,
 | 
			
		||||
                    'currency_decimal_places' => $default->decimal_places,
 | 
			
		||||
                    'sum'                     => '0',
 | 
			
		||||
                ],
 | 
			
		||||
            ];
 | 
			
		||||
            $newIncomes  = [
 | 
			
		||||
                $default->id => [
 | 
			
		||||
                    'currency_id'             => $default->id,
 | 
			
		||||
                    'currency_code'           => $default->code,
 | 
			
		||||
                    'currency_symbol'         => $default->symbol,
 | 
			
		||||
                    'currency_decimal_places' => $default->decimal_places,
 | 
			
		||||
                    'sum'                     => '0',
 | 
			
		||||
                ],
 | 
			
		||||
            ];
 | 
			
		||||
            $sums        = [
 | 
			
		||||
                $default->id => [
 | 
			
		||||
                    'currency_id'             => $default->id,
 | 
			
		||||
                    'currency_code'           => $default->code,
 | 
			
		||||
                    'currency_symbol'         => $default->symbol,
 | 
			
		||||
                    'currency_decimal_places' => $default->decimal_places,
 | 
			
		||||
                    'sum'                     => '0',
 | 
			
		||||
                ],
 | 
			
		||||
            ];
 | 
			
		||||
 | 
			
		||||
            $converter   = new ExchangeRateConverter();
 | 
			
		||||
            // loop over income and expenses
 | 
			
		||||
            foreach ([$expenses, $incomes] as $index => $array) {
 | 
			
		||||
 | 
			
		||||
                // loop over either one.
 | 
			
		||||
                foreach ($array as $entry) {
 | 
			
		||||
 | 
			
		||||
                    // if it is the native currency already.
 | 
			
		||||
                    if ($entry['currency_id'] === $default->id) {
 | 
			
		||||
                        $sums[$default->id]['sum'] = bcadd($entry['sum'], $sums[$default->id]['sum']);
 | 
			
		||||
 | 
			
		||||
                        // don't forget to add it to newExpenses and newIncome
 | 
			
		||||
                        if (0 === $index) {
 | 
			
		||||
                            $newExpenses[$default->id]['sum'] = bcadd($newExpenses[$default->id]['sum'], $entry['sum']);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (1 === $index) {
 | 
			
		||||
                            $newIncomes[$default->id]['sum'] = bcadd($newIncomes[$default->id]['sum'], $entry['sum']);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    $currencies[$entry['currency_id']] ??= $this->currencyRepos->find($entry['currency_id']);
 | 
			
		||||
                    $convertedSum              = $converter->convert($currencies[$entry['currency_id']], $default, $start, $entry['sum']);
 | 
			
		||||
                    $sums[$default->id]['sum'] = bcadd($sums[$default->id]['sum'], $convertedSum);
 | 
			
		||||
                    if (0 === $index) {
 | 
			
		||||
                        $newExpenses[$default->id]['sum'] = bcadd($newExpenses[$default->id]['sum'], $convertedSum);
 | 
			
		||||
                    }
 | 
			
		||||
                    if (1 === $index) {
 | 
			
		||||
                        $newIncomes[$default->id]['sum'] = bcadd($newIncomes[$default->id]['sum'], $convertedSum);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            $incomes     = $newIncomes;
 | 
			
		||||
            $expenses    = $newExpenses;
 | 
			
		||||
        }
 | 
			
		||||
        if (!$convertToNative) {
 | 
			
		||||
            foreach ([$expenses, $incomes] as $array) {
 | 
			
		||||
                foreach ($array as $entry) {
 | 
			
		||||
                    $currencyId               = $entry['currency_id'];
 | 
			
		||||
                    $sums[$currencyId] ??= [
 | 
			
		||||
                        'currency_id'             => $entry['currency_id'],
 | 
			
		||||
                        'currency_code'           => $entry['currency_code'],
 | 
			
		||||
                        'currency_symbol'         => $entry['currency_symbol'],
 | 
			
		||||
                        'currency_decimal_places' => $entry['currency_decimal_places'],
 | 
			
		||||
                        'sum'                     => '0',
 | 
			
		||||
                    ];
 | 
			
		||||
                    $sums[$currencyId]['sum'] = bcadd($sums[$currencyId]['sum'], $entry['sum']);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // format amounts:
 | 
			
		||||
        $keys            = array_keys($sums);
 | 
			
		||||
        foreach ($keys as $currencyId) {
 | 
			
		||||
            $currency = $this->currencyRepos->find($currencyId);
 | 
			
		||||
            $currency = $currencies[$currencyId] ?? $this->currencyRepos->find($currencyId);
 | 
			
		||||
            if (null === $currency) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
@@ -178,37 +244,78 @@ class BasicController extends Controller
 | 
			
		||||
            $return[] = [
 | 
			
		||||
                'key'                     => sprintf('balance-in-%s', $currency->code),
 | 
			
		||||
                'title'                   => trans('firefly.box_balance_in_currency', ['currency' => $currency->symbol]),
 | 
			
		||||
                'monetary_value'          => $sums[$currencyId] ?? '0',
 | 
			
		||||
                'monetary_value'          => $sums[$currencyId]['sum'] ?? '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, $sums[$currencyId] ?? '0', false),
 | 
			
		||||
                'value_parsed'            => app('amount')->formatAnything($currency, $sums[$currencyId]['sum'] ?? '0', false),
 | 
			
		||||
                'local_icon'              => 'balance-scale',
 | 
			
		||||
                'sub_title'               => app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false).
 | 
			
		||||
                                             ' + '.app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false),
 | 
			
		||||
                'sub_title'               => app('amount')->formatAnything($currency, $expenses[$currencyId]['sum'] ?? '0', false)
 | 
			
		||||
                                             .' + '.app('amount')->formatAnything($currency, $incomes[$currencyId]['sum'] ?? '0', false),
 | 
			
		||||
            ];
 | 
			
		||||
            $return[] = [
 | 
			
		||||
                'key'                     => sprintf('spent-in-%s', $currency->code),
 | 
			
		||||
                'title'                   => trans('firefly.box_spent_in_currency', ['currency' => $currency->symbol]),
 | 
			
		||||
                'monetary_value'          => $expenses[$currencyId] ?? '0',
 | 
			
		||||
                'monetary_value'          => $expenses[$currencyId]['sum'] ?? '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, $expenses[$currencyId] ?? '0', false),
 | 
			
		||||
                'value_parsed'            => app('amount')->formatAnything($currency, $expenses[$currencyId]['sum'] ?? '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'          => $incomes[$currencyId] ?? '0',
 | 
			
		||||
                'monetary_value'          => $incomes[$currencyId]['sum'] ?? '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, $incomes[$currencyId] ?? '0', false),
 | 
			
		||||
                'value_parsed'            => app('amount')->formatAnything($currency, $incomes[$currencyId]['sum'] ?? '0', false),
 | 
			
		||||
                'local_icon'              => 'balance-scale',
 | 
			
		||||
                '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'               => '',
 | 
			
		||||
            ];
 | 
			
		||||
@@ -217,15 +324,72 @@ class BasicController extends Controller
 | 
			
		||||
        return $return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function getBillInformation(Carbon $start, Carbon $end): array
 | 
			
		||||
    private function getSubscriptionInformation(Carbon $start, Carbon $end): array
 | 
			
		||||
    {
 | 
			
		||||
        app('log')->debug(sprintf('Now in getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-')));
 | 
			
		||||
        Log::debug(sprintf('Now in getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-')));
 | 
			
		||||
        /*
 | 
			
		||||
         * Since both this method and the chart use the exact same data, we can suffice
 | 
			
		||||
         * with calling the one method in the bill repository that will get this amount.
 | 
			
		||||
         */
 | 
			
		||||
        $paidAmount   = $this->billRepository->sumPaidInRange($start, $end);
 | 
			
		||||
        $unpaidAmount = $this->billRepository->sumUnpaidInRange($start, $end);
 | 
			
		||||
        $currencies   = [
 | 
			
		||||
            $this->nativeCurrency->id => $this->nativeCurrency,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        if ($this->convertToNative) {
 | 
			
		||||
            $converter       = new ExchangeRateConverter();
 | 
			
		||||
            $newPaidAmount   = [[
 | 
			
		||||
                'id'             => $this->nativeCurrency->id,
 | 
			
		||||
                'name'           => $this->nativeCurrency->name,
 | 
			
		||||
                'symbol'         => $this->nativeCurrency->symbol,
 | 
			
		||||
                'code'           => $this->nativeCurrency->code,
 | 
			
		||||
                'decimal_places' => $this->nativeCurrency->decimal_places,
 | 
			
		||||
                'sum'            => '0',
 | 
			
		||||
            ]];
 | 
			
		||||
 | 
			
		||||
            $newUnpaidAmount = [[
 | 
			
		||||
                'id'             => $this->nativeCurrency->id,
 | 
			
		||||
                'name'           => $this->nativeCurrency->name,
 | 
			
		||||
                'symbol'         => $this->nativeCurrency->symbol,
 | 
			
		||||
                'code'           => $this->nativeCurrency->code,
 | 
			
		||||
                'decimal_places' => $this->nativeCurrency->decimal_places,
 | 
			
		||||
                'sum'            => '0',
 | 
			
		||||
            ]];
 | 
			
		||||
            foreach ([$paidAmount, $unpaidAmount] as $index => $array) {
 | 
			
		||||
                foreach ($array as $item) {
 | 
			
		||||
                    $currencyId                = (int) $item['id'];
 | 
			
		||||
                    if (0 === $index) {
 | 
			
		||||
                        // paid amount
 | 
			
		||||
                        if ($currencyId === $this->nativeCurrency->id) {
 | 
			
		||||
                            $newPaidAmount[0]['sum'] = bcadd($newPaidAmount[0]['sum'], $item['sum']);
 | 
			
		||||
 | 
			
		||||
                            continue;
 | 
			
		||||
                        }
 | 
			
		||||
                        $currencies[$currencyId] ??= $this->currencyRepos->find($currencyId);
 | 
			
		||||
                        $convertedAmount         = $converter->convert($currencies[$currencyId], $this->nativeCurrency, $start, $item['sum']);
 | 
			
		||||
                        $newPaidAmount[0]['sum'] = bcadd($newPaidAmount[0]['sum'], $convertedAmount);
 | 
			
		||||
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    // unpaid amount
 | 
			
		||||
                    if ($currencyId === $this->nativeCurrency->id) {
 | 
			
		||||
                        $newUnpaidAmount[0]['sum'] = bcadd($newUnpaidAmount[0]['sum'], $item['sum']);
 | 
			
		||||
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    $currencies[$currencyId] ??= $this->currencyRepos->find($currencyId);
 | 
			
		||||
                    $convertedAmount           = $converter->convert($currencies[$currencyId], $this->nativeCurrency, $start, $item['sum']);
 | 
			
		||||
                    $newUnpaidAmount[0]['sum'] = bcadd($newUnpaidAmount[0]['sum'], $convertedAmount);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            $paidAmount      = $newPaidAmount;
 | 
			
		||||
            $unpaidAmount    = $newUnpaidAmount;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //        var_dump($paidAmount);
 | 
			
		||||
        //        var_dump($unpaidAmount);
 | 
			
		||||
        //        exit;
 | 
			
		||||
 | 
			
		||||
        $return       = [];
 | 
			
		||||
 | 
			
		||||
@@ -266,7 +430,38 @@ class BasicController extends Controller
 | 
			
		||||
                'sub_title'               => '',
 | 
			
		||||
            ];
 | 
			
		||||
        }
 | 
			
		||||
        app('log')->debug(sprintf('Done with getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-')));
 | 
			
		||||
        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 +510,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;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										91
									
								
								app/Api/V1/Requests/Chart/ChartRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								app/Api/V1/Requests/Chart/ChartRequest.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,91 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * DashboardChartRequest.php
 | 
			
		||||
 * Copyright (c) 2023 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace FireflyIII\Api\V1\Requests\Chart;
 | 
			
		||||
 | 
			
		||||
use FireflyIII\Enums\UserRoleEnum;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use FireflyIII\Support\Request\ChecksLogin;
 | 
			
		||||
use FireflyIII\Support\Request\ConvertsDataTypes;
 | 
			
		||||
use Illuminate\Foundation\Http\FormRequest;
 | 
			
		||||
use Illuminate\Support\Facades\Log;
 | 
			
		||||
use Illuminate\Validation\Validator;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class ChartRequest
 | 
			
		||||
 */
 | 
			
		||||
class ChartRequest extends FormRequest
 | 
			
		||||
{
 | 
			
		||||
    use ChecksLogin;
 | 
			
		||||
    use ConvertsDataTypes;
 | 
			
		||||
    use ValidatesUserGroupTrait;
 | 
			
		||||
 | 
			
		||||
    protected array $acceptedRoles = [UserRoleEnum::READ_ONLY];
 | 
			
		||||
 | 
			
		||||
    public function getParameters(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'start'       => $this->convertDateTime('start')?->startOfDay(),
 | 
			
		||||
            'end'         => $this->convertDateTime('end')?->endOfDay(),
 | 
			
		||||
            'preselected' => $this->convertString('preselected', 'empty'),
 | 
			
		||||
            'period'      => $this->convertString('period', '1M'),
 | 
			
		||||
            'accounts'    => $this->arrayFromValue($this->get('accounts')),
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The rules that the incoming request must be matched against.
 | 
			
		||||
     */
 | 
			
		||||
    public function rules(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'start'       => 'required|date|after:1900-01-01|before:2099-12-31|before_or_equal:end',
 | 
			
		||||
            'end'         => 'required|date|after:1900-01-01|before:2099-12-31|after_or_equal:start',
 | 
			
		||||
            'preselected' => sprintf('nullable|in:%s', implode(',', config('firefly.preselected_accounts'))),
 | 
			
		||||
            'period'      => sprintf('nullable|in:%s', implode(',', config('firefly.valid_view_ranges'))),
 | 
			
		||||
            'accounts.*'  => 'exists:accounts,id',
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function withValidator(Validator $validator): void
 | 
			
		||||
    {
 | 
			
		||||
        $validator->after(
 | 
			
		||||
            static function (Validator $validator): void {
 | 
			
		||||
                // validate transaction query data.
 | 
			
		||||
                $data = $validator->getData();
 | 
			
		||||
                if (!array_key_exists('accounts', $data)) {
 | 
			
		||||
                    // $validator->errors()->add('accounts', trans('validation.filled', ['attribute' => 'accounts']));
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                if (!is_array($data['accounts'])) {
 | 
			
		||||
                    $validator->errors()->add('accounts', trans('validation.filled', ['attribute' => 'accounts']));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
        if ($validator->fails()) {
 | 
			
		||||
            Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -49,9 +49,9 @@ class DestroyRequest extends FormRequest
 | 
			
		||||
     */
 | 
			
		||||
    public function rules(): array
 | 
			
		||||
    {
 | 
			
		||||
        $valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups'.
 | 
			
		||||
                 ',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers'.
 | 
			
		||||
                 ',not_assets_liabilities';
 | 
			
		||||
        $valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups'
 | 
			
		||||
                 .',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers'
 | 
			
		||||
                 .',not_assets_liabilities';
 | 
			
		||||
 | 
			
		||||
        return [
 | 
			
		||||
            'objects' => sprintf('required|max:255|min:1|string|in:%s', $valid),
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										62
									
								
								app/Api/V1/Requests/Generic/DateRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								app/Api/V1/Requests/Generic/DateRequest.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * DateRequest.php
 | 
			
		||||
 * Copyright (c) 2021 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace FireflyIII\Api\V1\Requests\Generic;
 | 
			
		||||
 | 
			
		||||
use FireflyIII\Support\Request\ChecksLogin;
 | 
			
		||||
use FireflyIII\Support\Request\ConvertsDataTypes;
 | 
			
		||||
use Illuminate\Foundation\Http\FormRequest;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Request class for end points that require date parameters.
 | 
			
		||||
 *
 | 
			
		||||
 * Class DateRequest
 | 
			
		||||
 */
 | 
			
		||||
class DateRequest extends FormRequest
 | 
			
		||||
{
 | 
			
		||||
    use ChecksLogin;
 | 
			
		||||
    use ConvertsDataTypes;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get all data from the request.
 | 
			
		||||
     */
 | 
			
		||||
    public function getAll(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'start' => $this->getCarbonDate('start')->startOfDay(),
 | 
			
		||||
            'end'   => $this->getCarbonDate('end')->endOfDay(),
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The rules that the incoming request must be matched against.
 | 
			
		||||
     */
 | 
			
		||||
    public function rules(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'start' => 'required|date|after:1900-01-01|before:2099-12-31',
 | 
			
		||||
            'end'   => 'required|date|after_or_equal:start|before:2099-12-31|after:1900-01-01',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										59
									
								
								app/Api/V1/Requests/Generic/SingleDateRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								app/Api/V1/Requests/Generic/SingleDateRequest.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * DateRequest.php
 | 
			
		||||
 * Copyright (c) 2021 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/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace FireflyIII\Api\V1\Requests\Generic;
 | 
			
		||||
 | 
			
		||||
use Carbon\Carbon;
 | 
			
		||||
use FireflyIII\Support\Request\ChecksLogin;
 | 
			
		||||
use FireflyIII\Support\Request\ConvertsDataTypes;
 | 
			
		||||
use Illuminate\Foundation\Http\FormRequest;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Request class for end points that require a date parameter.
 | 
			
		||||
 *
 | 
			
		||||
 * Class SingleDateRequest
 | 
			
		||||
 */
 | 
			
		||||
class SingleDateRequest extends FormRequest
 | 
			
		||||
{
 | 
			
		||||
    use ChecksLogin;
 | 
			
		||||
    use ConvertsDataTypes;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get all data from the request.
 | 
			
		||||
     */
 | 
			
		||||
    public function getDate(): Carbon
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getCarbonDate('date');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The rules that the incoming request must be matched against.
 | 
			
		||||
     */
 | 
			
		||||
    public function rules(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'date' => 'required|date|after:1900-01-01|before:2099-12-31',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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',
 | 
			
		||||
 
 | 
			
		||||
@@ -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 */
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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 [
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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 */
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										104
									
								
								app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php
									
									
									
									
									
										Normal 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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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.');
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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.');
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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':
 | 
			
		||||
 
 | 
			
		||||
@@ -48,13 +48,16 @@ class BillFactory
 | 
			
		||||
    {
 | 
			
		||||
        app('log')->debug(sprintf('Now in %s', __METHOD__), $data);
 | 
			
		||||
        $factory          = app(TransactionCurrencyFactory::class);
 | 
			
		||||
        $currency         = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null)) ??
 | 
			
		||||
                    app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
 | 
			
		||||
        $currency         = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null))
 | 
			
		||||
                    ?? app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup);
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            $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(
 | 
			
		||||
                [
 | 
			
		||||
 
 | 
			
		||||
@@ -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] ??= [];
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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'));
 | 
			
		||||
 
 | 
			
		||||
@@ -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'));
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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'];
 | 
			
		||||
 
 | 
			
		||||
@@ -141,8 +141,8 @@ class MassController extends Controller
 | 
			
		||||
        // reverse amounts
 | 
			
		||||
        foreach ($journals as $index => $journal) {
 | 
			
		||||
            $journals[$index]['amount']         = app('steam')->bcround(app('steam')->positive($journal['amount']), $journal['currency_decimal_places']);
 | 
			
		||||
            $journals[$index]['foreign_amount'] = null === $journal['foreign_amount'] ?
 | 
			
		||||
                null : app('steam')->positive($journal['foreign_amount']);
 | 
			
		||||
            $journals[$index]['foreign_amount'] = null === $journal['foreign_amount']
 | 
			
		||||
                ? null : app('steam')->positive($journal['foreign_amount']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->rememberPreviousUrl('transactions.mass-edit.url');
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user