mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-11-03 20:55:05 +00:00 
			
		
		
		
	Compare commits
	
		
			136 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					a3490e97c0 | ||
| 
						 | 
					85b1768908 | ||
| 
						 | 
					6ab462a795 | ||
| 
						 | 
					70f46338db | ||
| 
						 | 
					461b5ad859 | ||
| 
						 | 
					6af62c6be0 | ||
| 
						 | 
					78153c2aa4 | ||
| 
						 | 
					62458885ce | ||
| 
						 | 
					83d64262c8 | ||
| 
						 | 
					0133a7c5db | ||
| 
						 | 
					fa920fed4e | ||
| 
						 | 
					1d138eed8d | ||
| 
						 | 
					9e94b9e57e | ||
| 
						 | 
					c4c690f44f | ||
| 
						 | 
					902cc21ff0 | ||
| 
						 | 
					106471877f | ||
| 
						 | 
					ccaace707e | ||
| 
						 | 
					cc14a4ac57 | ||
| 
						 | 
					3ca1e6d197 | ||
| 
						 | 
					531a6c17de | ||
| 
						 | 
					4b7e1fcdb0 | ||
| 
						 | 
					5f35bc5ee6 | ||
| 
						 | 
					8100f68020 | ||
| 
						 | 
					32a36bbb12 | ||
| 
						 | 
					64b9234207 | ||
| 
						 | 
					a9d490263b | ||
| 
						 | 
					8c5a3c9b3e | ||
| 
						 | 
					dd2f8d4404 | ||
| 
						 | 
					ea82cff0ce | ||
| 
						 | 
					66ef9a919a | ||
| 
						 | 
					73b912ee8b | ||
| 
						 | 
					5960258a89 | ||
| 
						 | 
					ea7d1f481a | ||
| 
						 | 
					d81a0ebba4 | ||
| 
						 | 
					e90fb98613 | ||
| 
						 | 
					2c34bd36a5 | ||
| 
						 | 
					a86a582d0f | ||
| 
						 | 
					c7778ce8cb | ||
| 
						 | 
					5eaf1f4438 | ||
| 
						 | 
					691682bc0c | ||
| 
						 | 
					8627ee391a | ||
| 
						 | 
					41089a0a0a | ||
| 
						 | 
					2072a3dd94 | ||
| 
						 | 
					8eec325e0a | ||
| 
						 | 
					7ae88b42cf | ||
| 
						 | 
					24e0839c34 | ||
| 
						 | 
					c3398d4d51 | ||
| 
						 | 
					80237d8bc3 | ||
| 
						 | 
					4cec0a9f97 | ||
| 
						 | 
					a810eb2cb5 | ||
| 
						 | 
					7feb4b4aaf | ||
| 
						 | 
					840fd61b04 | ||
| 
						 | 
					5425dac180 | ||
| 
						 | 
					0d65e396d4 | ||
| 
						 | 
					704fc24d20 | ||
| 
						 | 
					9b22c16f14 | ||
| 
						 | 
					2923d1b449 | ||
| 
						 | 
					9d5b028a5f | ||
| 
						 | 
					97dfdd5c5d | ||
| 
						 | 
					eb5ee4d147 | ||
| 
						 | 
					d97581325d | ||
| 
						 | 
					2a1e53f32a | ||
| 
						 | 
					b5e4ac0038 | ||
| 
						 | 
					b032210a33 | ||
| 
						 | 
					24a1d61560 | ||
| 
						 | 
					d632c1c7fc | ||
| 
						 | 
					9c5b3fc030 | ||
| 
						 | 
					90e407b9d0 | ||
| 
						 | 
					dc0a2a2a10 | ||
| 
						 | 
					b6aa76477e | ||
| 
						 | 
					068191e08c | ||
| 
						 | 
					533cd1dbed | ||
| 
						 | 
					028ef63f6e | ||
| 
						 | 
					127b6ea515 | ||
| 
						 | 
					ab546865a8 | ||
| 
						 | 
					d6a2f2959d | ||
| 
						 | 
					58848caf30 | ||
| 
						 | 
					c1107fe854 | ||
| 
						 | 
					c3debb1a17 | ||
| 
						 | 
					0c841a12d2 | ||
| 
						 | 
					64ed9376fe | ||
| 
						 | 
					1966e12703 | ||
| 
						 | 
					289ccc7d89 | ||
| 
						 | 
					590c33c0af | ||
| 
						 | 
					4e7236a338 | ||
| 
						 | 
					63b7626aab | ||
| 
						 | 
					78b88949d8 | ||
| 
						 | 
					40a7abf9e8 | ||
| 
						 | 
					cd62dfd8f4 | ||
| 
						 | 
					4445ad8fe5 | ||
| 
						 | 
					ed29721677 | ||
| 
						 | 
					e587f6ec37 | ||
| 
						 | 
					f98f4b00ba | ||
| 
						 | 
					78bbcb324b | ||
| 
						 | 
					d646ab0232 | ||
| 
						 | 
					1fe36044f1 | ||
| 
						 | 
					2ea9369f99 | ||
| 
						 | 
					802e1dbf2d | ||
| 
						 | 
					b6aca26d8c | ||
| 
						 | 
					ef653f7b00 | ||
| 
						 | 
					8e183d8cad | ||
| 
						 | 
					0ce34048cd | ||
| 
						 | 
					d46041f22e | ||
| 
						 | 
					94cf424bbd | ||
| 
						 | 
					778d700ba8 | ||
| 
						 | 
					8c1cbd77dd | ||
| 
						 | 
					954bf779eb | ||
| 
						 | 
					7fbed452bb | ||
| 
						 | 
					e32023bb97 | ||
| 
						 | 
					664a08d42f | ||
| 
						 | 
					854c7f090b | ||
| 
						 | 
					a29d056a9b | ||
| 
						 | 
					7d3ee9f0c4 | ||
| 
						 | 
					e26d39ab63 | ||
| 
						 | 
					ecf465958f | ||
| 
						 | 
					8fa6030341 | ||
| 
						 | 
					1f6f6dadfa | ||
| 
						 | 
					ed81eb4edf | ||
| 
						 | 
					06ff4b808a | ||
| 
						 | 
					fe5999d5b8 | ||
| 
						 | 
					9331796dc3 | ||
| 
						 | 
					0a18c948bc | ||
| 
						 | 
					595a1fbe34 | ||
| 
						 | 
					f12db3b8d9 | ||
| 
						 | 
					2c1da7af31 | ||
| 
						 | 
					0f9535bfd5 | ||
| 
						 | 
					961d3c26fc | ||
| 
						 | 
					bd8e003db8 | ||
| 
						 | 
					619eb60dd1 | ||
| 
						 | 
					15948303ec | ||
| 
						 | 
					ccec203910 | ||
| 
						 | 
					78122a7d4b | ||
| 
						 | 
					272c73054e | ||
| 
						 | 
					aa629523a0 | ||
| 
						 | 
					3e6aca4cd1 | ||
| 
						 | 
					891883c8c2 | 
							
								
								
									
										50
									
								
								.ci/php-cs-fixer/composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										50
									
								
								.ci/php-cs-fixer/composer.lock
									
									
									
										generated
									
									
									
								
							@@ -8,16 +8,16 @@
 | 
			
		||||
    "packages": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "composer/pcre",
 | 
			
		||||
            "version": "3.1.0",
 | 
			
		||||
            "version": "3.1.1",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/composer/pcre.git",
 | 
			
		||||
                "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2"
 | 
			
		||||
                "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2",
 | 
			
		||||
                "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2",
 | 
			
		||||
                "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9",
 | 
			
		||||
                "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
@@ -59,7 +59,7 @@
 | 
			
		||||
            ],
 | 
			
		||||
            "support": {
 | 
			
		||||
                "issues": "https://github.com/composer/pcre/issues",
 | 
			
		||||
                "source": "https://github.com/composer/pcre/tree/3.1.0"
 | 
			
		||||
                "source": "https://github.com/composer/pcre/tree/3.1.1"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
@@ -75,7 +75,7 @@
 | 
			
		||||
                    "type": "tidelift"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2022-11-17T09:50:14+00:00"
 | 
			
		||||
            "time": "2023-10-11T07:11:09+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "composer/semver",
 | 
			
		||||
@@ -226,16 +226,16 @@
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "friendsofphp/php-cs-fixer",
 | 
			
		||||
            "version": "v3.28.0",
 | 
			
		||||
            "version": "v3.37.0",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
 | 
			
		||||
                "reference": "113e09fea3d2306319ffaa2423fe3de768b28cff"
 | 
			
		||||
                "reference": "d5ccc3807fd496ac2b448e8e5e57aa0772f0d18b"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/113e09fea3d2306319ffaa2423fe3de768b28cff",
 | 
			
		||||
                "reference": "113e09fea3d2306319ffaa2423fe3de768b28cff",
 | 
			
		||||
                "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d5ccc3807fd496ac2b448e8e5e57aa0772f0d18b",
 | 
			
		||||
                "reference": "d5ccc3807fd496ac2b448e8e5e57aa0772f0d18b",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
@@ -268,8 +268,6 @@
 | 
			
		||||
                "phpspec/prophecy": "^1.16",
 | 
			
		||||
                "phpspec/prophecy-phpunit": "^2.0",
 | 
			
		||||
                "phpunit/phpunit": "^9.5",
 | 
			
		||||
                "phpunitgoodpractices/polyfill": "^1.6",
 | 
			
		||||
                "phpunitgoodpractices/traits": "^1.9.2",
 | 
			
		||||
                "symfony/phpunit-bridge": "^6.2.3",
 | 
			
		||||
                "symfony/yaml": "^5.4 || ^6.0"
 | 
			
		||||
            },
 | 
			
		||||
@@ -309,7 +307,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.28.0"
 | 
			
		||||
                "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.37.0"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
@@ -317,7 +315,7 @@
 | 
			
		||||
                    "type": "github"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2023-09-22T20:43:40+00:00"
 | 
			
		||||
            "time": "2023-10-28T14:49:50+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "psr/container",
 | 
			
		||||
@@ -917,16 +915,16 @@
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "symfony/finder",
 | 
			
		||||
            "version": "v6.3.3",
 | 
			
		||||
            "version": "v6.3.5",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/symfony/finder.git",
 | 
			
		||||
                "reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e"
 | 
			
		||||
                "reference": "a1b31d88c0e998168ca7792f222cbecee47428c4"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/finder/zipball/9915db259f67d21eefee768c1abcf1cc61b1fc9e",
 | 
			
		||||
                "reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/finder/zipball/a1b31d88c0e998168ca7792f222cbecee47428c4",
 | 
			
		||||
                "reference": "a1b31d88c0e998168ca7792f222cbecee47428c4",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
@@ -961,7 +959,7 @@
 | 
			
		||||
            "description": "Finds files and directories via an intuitive fluent interface",
 | 
			
		||||
            "homepage": "https://symfony.com",
 | 
			
		||||
            "support": {
 | 
			
		||||
                "source": "https://github.com/symfony/finder/tree/v6.3.3"
 | 
			
		||||
                "source": "https://github.com/symfony/finder/tree/v6.3.5"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
@@ -977,7 +975,7 @@
 | 
			
		||||
                    "type": "tidelift"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2023-07-31T08:31:44+00:00"
 | 
			
		||||
            "time": "2023-09-26T12:56:25+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "symfony/options-resolver",
 | 
			
		||||
@@ -1745,16 +1743,16 @@
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "symfony/string",
 | 
			
		||||
            "version": "v6.3.2",
 | 
			
		||||
            "version": "v6.3.5",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/symfony/string.git",
 | 
			
		||||
                "reference": "53d1a83225002635bca3482fcbf963001313fb68"
 | 
			
		||||
                "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68",
 | 
			
		||||
                "reference": "53d1a83225002635bca3482fcbf963001313fb68",
 | 
			
		||||
                "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339",
 | 
			
		||||
                "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
@@ -1811,7 +1809,7 @@
 | 
			
		||||
                "utf8"
 | 
			
		||||
            ],
 | 
			
		||||
            "support": {
 | 
			
		||||
                "source": "https://github.com/symfony/string/tree/v6.3.2"
 | 
			
		||||
                "source": "https://github.com/symfony/string/tree/v6.3.5"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
@@ -1827,7 +1825,7 @@
 | 
			
		||||
                    "type": "tidelift"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2023-07-05T08:41:27+00:00"
 | 
			
		||||
            "time": "2023-09-18T10:38:32+00:00"
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "packages-dev": [],
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								.env.example
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								.env.example
									
									
									
									
									
								
							@@ -195,6 +195,16 @@ MAP_DEFAULT_LAT=51.983333
 | 
			
		||||
MAP_DEFAULT_LONG=5.916667
 | 
			
		||||
MAP_DEFAULT_ZOOM=6
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Some objects have room for an URL, like transactions and webhooks.
 | 
			
		||||
# By default, the following protocols are allowed:
 | 
			
		||||
# http, https, ftp, ftps, mailto
 | 
			
		||||
#
 | 
			
		||||
# To change this, set your preferred comma separated set below.
 | 
			
		||||
# Be sure to include http, https and other default ones if you need to.
 | 
			
		||||
#
 | 
			
		||||
VALID_URL_PROTOCOLS=
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Firefly III authentication settings
 | 
			
		||||
#
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								.github/label-actions.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								.github/label-actions.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
# Configuration for Label Actions - https://github.com/dessant/label-actions
 | 
			
		||||
 | 
			
		||||
# The `feature` label is added to issues
 | 
			
		||||
feature:
 | 
			
		||||
  issues:
 | 
			
		||||
    # Post a comment, `{issue-author}` is an optional placeholder
 | 
			
		||||
    comment: |
 | 
			
		||||
      Hi there! This is an automatic reply. `Share and enjoy`
 | 
			
		||||
 | 
			
		||||
      This issue has been marked as a feature request. The requested (new) feature will become a part of Firefly III or the data importer in due course.
 | 
			
		||||
 | 
			
		||||
      If you come across this issue, please be aware there is NO need to reply with "+1" or "me too" or "I need this too" or whatever. Such comments are not helpful, and do not influence [the roadmap](https://roadmap.firefly-iii.org/). Your comment may be :skull: deleted. You can subscribe to this issue to get updates.
 | 
			
		||||
 | 
			
		||||
      Thank you for your contributions.
 | 
			
		||||
 | 
			
		||||
enhancement:
 | 
			
		||||
  issues:
 | 
			
		||||
    # Post a comment, `{issue-author}` is an optional placeholder
 | 
			
		||||
    comment: |
 | 
			
		||||
      Hi there! This is an automatic reply. `Share and enjoy`
 | 
			
		||||
 | 
			
		||||
      This issue has been marked as an enhancement. The requested enhancement to an existing feature will become a part of Firefly III or the data importer in due course.
 | 
			
		||||
 | 
			
		||||
      If you come across this issue, please be aware there is NO need to reply with "+1" or "me too" or "I need this too" or whatever. Such comments are not helpful, and do not influence [the roadmap](https://roadmap.firefly-iii.org/). Your comment may be :skull: deleted. You can subscribe to this issue to get updates.
 | 
			
		||||
 | 
			
		||||
      Thank you for your contributions.
 | 
			
		||||
 | 
			
		||||
# The `solved` label is added to discussions
 | 
			
		||||
triage:
 | 
			
		||||
  issues:
 | 
			
		||||
    # Post a comment, `{issue-author}` is an optional placeholder
 | 
			
		||||
    comment: |
 | 
			
		||||
      Hi there! This is an automatic reply. `Share and enjoy`
 | 
			
		||||
 | 
			
		||||
      This issue has been marked as being in triage. The root cause is not known yet, or the issue needs more investigation. You can help by sharing debug information (from `/debug`) if you also have this issue or when you haven't already done so.
 | 
			
		||||
 | 
			
		||||
      Thank you for your contributions.
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/cleanup.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/cleanup.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,6 +1,6 @@
 | 
			
		||||
# This workflow prunes old workflow runs for an entire repository.
 | 
			
		||||
 | 
			
		||||
name: Prune old builds
 | 
			
		||||
name: "Chore - prune old builds"
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  schedule:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/closed-issues.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/closed-issues.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
name: "Reply to closed issue"
 | 
			
		||||
name: "Issues - reply to closed issue"
 | 
			
		||||
on:
 | 
			
		||||
  issues:
 | 
			
		||||
    types:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/depsreview.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/depsreview.yaml
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
name: 'Dependency Review'
 | 
			
		||||
name: 'Code - dependency review'
 | 
			
		||||
on: [ pull_request ]
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								.github/workflows/label-actions.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								.github/workflows/label-actions.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
name: 'Issues - reply to specific labels'
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  issues:
 | 
			
		||||
    types: [labeled, unlabeled]
 | 
			
		||||
  pull_request_target:
 | 
			
		||||
    types: [labeled, unlabeled]
 | 
			
		||||
  discussion:
 | 
			
		||||
    types: [labeled, unlabeled]
 | 
			
		||||
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: read
 | 
			
		||||
  issues: write
 | 
			
		||||
  pull-requests: write
 | 
			
		||||
  discussions: write
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  action:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: dessant/label-actions@v3
 | 
			
		||||
							
								
								
									
										146
									
								
								.github/workflows/laravel.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										146
									
								
								.github/workflows/laravel.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,146 +0,0 @@
 | 
			
		||||
name: Firefly III
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches-ignore:
 | 
			
		||||
      - '**'
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  prepare:
 | 
			
		||||
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - name: Copy .env
 | 
			
		||||
        run: test -f .env || cp .ci/.env.ci .env
 | 
			
		||||
      - name: Prepare dependencies
 | 
			
		||||
        run: |
 | 
			
		||||
          set -euxo pipefail
 | 
			
		||||
          export PATH=$PATH:$HOME/.composer/vendor/bin/
 | 
			
		||||
          composer global require hirak/prestissimo --no-plugins --no-scripts
 | 
			
		||||
          composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
 | 
			
		||||
 | 
			
		||||
          touch ./storage/database/database.sqlite
 | 
			
		||||
      - name: Prepare Firefly III
 | 
			
		||||
        run: |
 | 
			
		||||
          chmod -R 777 storage bootstrap/cache
 | 
			
		||||
          php artisan migrate --seed
 | 
			
		||||
          php artisan firefly-iii:upgrade-database
 | 
			
		||||
      - name: Upload database
 | 
			
		||||
        uses: actions/upload-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: database
 | 
			
		||||
          path: storage/database/database.sqlite
 | 
			
		||||
      - name: Upload cache
 | 
			
		||||
        uses: actions/upload-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: cache
 | 
			
		||||
          path: bootstrap/cache/
 | 
			
		||||
      - name: Upload composer cache
 | 
			
		||||
        uses: actions/upload-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: composer
 | 
			
		||||
          path: ~/.composer
 | 
			
		||||
 | 
			
		||||
  laravel-tests:
 | 
			
		||||
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    needs:
 | 
			
		||||
      - prepare
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - name: Copy .env
 | 
			
		||||
        run: test -f .env || cp .ci/.env.ci .env
 | 
			
		||||
      - name: Download database
 | 
			
		||||
        uses: actions/download-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: database
 | 
			
		||||
          path: storage/database/database.sqlite
 | 
			
		||||
      - name: Download cache
 | 
			
		||||
        uses: actions/download-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: cache
 | 
			
		||||
          path: bootstrap/cache/
 | 
			
		||||
      - name: Download vendor
 | 
			
		||||
        uses: actions/download-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: composer
 | 
			
		||||
          path: ~/.composer
 | 
			
		||||
      - name: Install composer
 | 
			
		||||
        run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
 | 
			
		||||
 | 
			
		||||
      - name: PHPUnit tests
 | 
			
		||||
        uses: php-actions/phpunit@v1
 | 
			
		||||
        with:
 | 
			
		||||
          config: phpunit.xml
 | 
			
		||||
          memory: 512M
 | 
			
		||||
 | 
			
		||||
  coding-standards:
 | 
			
		||||
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    needs:
 | 
			
		||||
      - prepare
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - name: Copy .env
 | 
			
		||||
        run: test -f .env || cp .ci/.env.ci .env
 | 
			
		||||
      - name: Download database
 | 
			
		||||
        uses: actions/download-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: database
 | 
			
		||||
          path: storage/database/database.sqlite
 | 
			
		||||
      - name: Download cache
 | 
			
		||||
        uses: actions/download-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: cache
 | 
			
		||||
          path: bootstrap/cache/
 | 
			
		||||
      - name: Download vendor
 | 
			
		||||
        uses: actions/download-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: composer
 | 
			
		||||
          path: ~/.composer
 | 
			
		||||
      - name: install depenencies
 | 
			
		||||
        run: |
 | 
			
		||||
          composer global require nette/coding-standard
 | 
			
		||||
          composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
 | 
			
		||||
 | 
			
		||||
      - name: Execute code standard
 | 
			
		||||
        run: /home/runner/.composer/vendor/bin/ecs check app tests --config ./.ci/firefly-iii-standard.yml
 | 
			
		||||
 | 
			
		||||
  phpstan:
 | 
			
		||||
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    needs:
 | 
			
		||||
      - prepare
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - name: Copy .env
 | 
			
		||||
        run: test -f .env || cp .ci/.env.ci .env
 | 
			
		||||
      - name: Download database
 | 
			
		||||
        uses: actions/download-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: database
 | 
			
		||||
          path: storage/database/database.sqlite
 | 
			
		||||
      - name: Download cache
 | 
			
		||||
        uses: actions/download-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: cache
 | 
			
		||||
          path: bootstrap/cache/
 | 
			
		||||
      - name: Download vendor
 | 
			
		||||
        uses: actions/download-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          name: composer
 | 
			
		||||
          path: ~/.composer
 | 
			
		||||
      - name: Install depenencies
 | 
			
		||||
        run: |
 | 
			
		||||
          composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
 | 
			
		||||
 | 
			
		||||
      - name: Execute PHPStan
 | 
			
		||||
        run: vendor/bin/phpstan analyse -c .ci/phpstan.neon
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/lock.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/lock.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
name: Lock old issues
 | 
			
		||||
name: 'Issues - Lock old issues'
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								.github/workflows/qodana.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								.github/workflows/qodana.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,35 +0,0 @@
 | 
			
		||||
name: Qodana
 | 
			
		||||
on:
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
      - develop
 | 
			
		||||
jobs:
 | 
			
		||||
  qodana:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    name: 'Qodana Scan'
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Setup PHP with no coverage driver
 | 
			
		||||
        uses: shivammathur/setup-php@v2
 | 
			
		||||
        with:
 | 
			
		||||
          php-version: '8.2'
 | 
			
		||||
          coverage: none
 | 
			
		||||
          extensions: bcmath, intl
 | 
			
		||||
        env:
 | 
			
		||||
          update: true
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
        with:
 | 
			
		||||
          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: |
 | 
			
		||||
          composer install --no-scripts
 | 
			
		||||
          cp .env.example .env
 | 
			
		||||
          php artisan key:generate
 | 
			
		||||
          php artisan clear-compiled
 | 
			
		||||
          php artisan ide-helper:generate;
 | 
			
		||||
 | 
			
		||||
      - name: 'Qodana Scan'
 | 
			
		||||
        uses: JetBrains/qodana-action@main
 | 
			
		||||
        env:
 | 
			
		||||
          QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
 | 
			
		||||
							
								
								
									
										60
									
								
								.github/workflows/sonarcloud.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										60
									
								
								.github/workflows/sonarcloud.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,14 +1,37 @@
 | 
			
		||||
name: Sonarcloud
 | 
			
		||||
name: 'Code - Run Sonarcloud'
 | 
			
		||||
on:
 | 
			
		||||
  pull_request:
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
      - develop
 | 
			
		||||
env:
 | 
			
		||||
  DB_CONNECTION: mysql
 | 
			
		||||
  DB_HOST: "127.0.0.1"
 | 
			
		||||
  DB_DATABASE: firefly
 | 
			
		||||
  DB_USER: firefly
 | 
			
		||||
  DB_PASSWORD: secret_firefly_password
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  sonarcloud:
 | 
			
		||||
    name: SonarCloud
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    services:
 | 
			
		||||
      mariadb:
 | 
			
		||||
        image: mariadb:latest
 | 
			
		||||
        ports:
 | 
			
		||||
          - 3306:3306
 | 
			
		||||
        env:
 | 
			
		||||
          MYSQL_ROOT_PASSWORD: yes
 | 
			
		||||
          MYSQL_USER: ${{ env.DB_USER }}
 | 
			
		||||
          MYSQL_PASSWORD: ${{ env.DB_PASSWORD }}
 | 
			
		||||
          MYSQL_DATABASE: ${{ env.DB_DATABASE }}
 | 
			
		||||
        options: >-
 | 
			
		||||
          --health-cmd="healthcheck.sh --connect --innodb_initialized"
 | 
			
		||||
          --health-interval=10s
 | 
			
		||||
          --health-timeout=5s
 | 
			
		||||
          --health-retries=3
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
        with:
 | 
			
		||||
@@ -24,16 +47,49 @@ jobs:
 | 
			
		||||
        with:
 | 
			
		||||
          php-version: '8.2'
 | 
			
		||||
          coverage: xdebug
 | 
			
		||||
          extensions: >-
 | 
			
		||||
            bcmath
 | 
			
		||||
            curl
 | 
			
		||||
            fileinfo
 | 
			
		||||
            iconv
 | 
			
		||||
            intl
 | 
			
		||||
            json
 | 
			
		||||
            mbstring
 | 
			
		||||
            openssl
 | 
			
		||||
            pdo
 | 
			
		||||
            session
 | 
			
		||||
            simplexml
 | 
			
		||||
            sodium
 | 
			
		||||
            tokenizer
 | 
			
		||||
            xml
 | 
			
		||||
            xmlwriter
 | 
			
		||||
 | 
			
		||||
      - name: Install Composer dependencies
 | 
			
		||||
        run: composer install --prefer-dist --no-interaction --no-progress --no-scripts
 | 
			
		||||
 | 
			
		||||
      - name: Verify Database connection
 | 
			
		||||
        env:
 | 
			
		||||
          PORT: ${{ job.services.mariadb.ports[3306] }}
 | 
			
		||||
        run: |
 | 
			
		||||
          while ! mysqladmin ping -h"${{env.DB_HOST}}" -P"${PORT}" --silent; do
 | 
			
		||||
            sleep 1
 | 
			
		||||
          done
 | 
			
		||||
 | 
			
		||||
      - name: Copy environment file
 | 
			
		||||
        run: cp .env.example .env
 | 
			
		||||
        run: sed 's@DB_HOST=.*@DB_HOST=${{env.DB_HOST}}@g' .env.example > .env
 | 
			
		||||
 | 
			
		||||
      - name: Generate app key
 | 
			
		||||
        run: php artisan key:generate
 | 
			
		||||
 | 
			
		||||
      - name: "Create the database"
 | 
			
		||||
        run: php artisan firefly-iii:create-database
 | 
			
		||||
 | 
			
		||||
      - name: "Upgrades the database to the latest version"
 | 
			
		||||
        run: php artisan firefly-iii:upgrade-database
 | 
			
		||||
 | 
			
		||||
      - name: "Integrity Database Report"
 | 
			
		||||
        run: php artisan firefly-iii:report-integrity
 | 
			
		||||
 | 
			
		||||
      - name: "Run tests with coverage"
 | 
			
		||||
        run: composer coverage
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/stale.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/stale.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
name: "Close stale issues"
 | 
			
		||||
name: "Issues - close stale issues"
 | 
			
		||||
on:
 | 
			
		||||
  schedule:
 | 
			
		||||
    - cron: "30 1 * * *"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,8 +1,6 @@
 | 
			
		||||
/node_modules
 | 
			
		||||
/frontend/node_modules
 | 
			
		||||
/storage/*.key
 | 
			
		||||
/vendor
 | 
			
		||||
/.vagrant
 | 
			
		||||
npm-debug.log
 | 
			
		||||
yarn-error.log
 | 
			
		||||
.env
 | 
			
		||||
 
 | 
			
		||||
@@ -82,7 +82,8 @@ class AccountController extends Controller
 | 
			
		||||
        $date  = $data['date'] ?? today(config('app.timezone'));
 | 
			
		||||
 | 
			
		||||
        $return = [];
 | 
			
		||||
        $result = $this->repository->searchAccount((string)$query, $types, $data['limit']);
 | 
			
		||||
 | 
			
		||||
        $result = $this->repository->searchAccount((string)$query, $types, $this->parameters->get('limit'));
 | 
			
		||||
        // TODO this code is duplicated in the V2 Autocomplete controller, which means this code is due to be deprecated.
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrency();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,6 @@ class BillController extends Controller
 | 
			
		||||
    /**
 | 
			
		||||
     * Documentation for this endpoint is at:
 | 
			
		||||
     * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getBillsAC
 | 
			
		||||
     * TODO expand API to add active field.
 | 
			
		||||
     *
 | 
			
		||||
     * @param AutocompleteRequest $request
 | 
			
		||||
     *
 | 
			
		||||
@@ -67,7 +66,7 @@ class BillController extends Controller
 | 
			
		||||
    public function bills(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data     = $request->getData();
 | 
			
		||||
        $result   = $this->repository->searchBill($data['query'], $data['limit']);
 | 
			
		||||
        $result   = $this->repository->searchBill($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $filtered = $result->map(
 | 
			
		||||
            static function (Bill $item) {
 | 
			
		||||
                return [
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ class BudgetController extends Controller
 | 
			
		||||
    public function budgets(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data     = $request->getData();
 | 
			
		||||
        $result   = $this->repository->searchBudget($data['query'], $data['limit']);
 | 
			
		||||
        $result   = $this->repository->searchBudget($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $filtered = $result->map(
 | 
			
		||||
            static function (Budget $item) {
 | 
			
		||||
                return [
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ class CategoryController extends Controller
 | 
			
		||||
    public function categories(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data     = $request->getData();
 | 
			
		||||
        $result   = $this->repository->searchCategory($data['query'], $data['limit']);
 | 
			
		||||
        $result   = $this->repository->searchCategory($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $filtered = $result->map(
 | 
			
		||||
            static function (Category $item) {
 | 
			
		||||
                return [
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,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\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
 | 
			
		||||
@@ -66,7 +66,7 @@ class CurrencyController extends Controller
 | 
			
		||||
    public function currencies(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data       = $request->getData();
 | 
			
		||||
        $collection = $this->repository->searchCurrency($data['query'], $data['limit']);
 | 
			
		||||
        $collection = $this->repository->searchCurrency($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $result     = [];
 | 
			
		||||
 | 
			
		||||
        /** @var TransactionCurrency $currency */
 | 
			
		||||
@@ -95,7 +95,7 @@ class CurrencyController extends Controller
 | 
			
		||||
    public function currenciesWithCode(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data       = $request->getData();
 | 
			
		||||
        $collection = $this->repository->searchCurrency($data['query'], $data['limit']);
 | 
			
		||||
        $collection = $this->repository->searchCurrency($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $result     = [];
 | 
			
		||||
 | 
			
		||||
        /** @var TransactionCurrency $currency */
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,7 @@ class ObjectGroupController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $data   = $request->getData();
 | 
			
		||||
        $return = [];
 | 
			
		||||
        $result = $this->repository->search($data['query'], $data['limit']);
 | 
			
		||||
        $result = $this->repository->search($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
 | 
			
		||||
        /** @var ObjectGroup $objectGroup */
 | 
			
		||||
        foreach ($result as $objectGroup) {
 | 
			
		||||
 
 | 
			
		||||
@@ -70,7 +70,7 @@ class PiggyBankController extends Controller
 | 
			
		||||
    public function piggyBanks(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data            = $request->getData();
 | 
			
		||||
        $piggies         = $this->piggyRepository->searchPiggyBank($data['query'], $data['limit']);
 | 
			
		||||
        $piggies         = $this->piggyRepository->searchPiggyBank($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrency();
 | 
			
		||||
        $response        = [];
 | 
			
		||||
 | 
			
		||||
@@ -105,7 +105,7 @@ class PiggyBankController extends Controller
 | 
			
		||||
    public function piggyBanksWithBalance(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data            = $request->getData();
 | 
			
		||||
        $piggies         = $this->piggyRepository->searchPiggyBank($data['query'], $data['limit']);
 | 
			
		||||
        $piggies         = $this->piggyRepository->searchPiggyBank($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrency();
 | 
			
		||||
        $response        = [];
 | 
			
		||||
        /** @var PiggyBank $piggy */
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ class RecurrenceController extends Controller
 | 
			
		||||
    public function recurring(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data        = $request->getData();
 | 
			
		||||
        $recurrences = $this->repository->searchRecurrence($data['query'], $data['limit']);
 | 
			
		||||
        $recurrences = $this->repository->searchRecurrence($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $response    = [];
 | 
			
		||||
 | 
			
		||||
        /** @var Recurrence $recurrence */
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ class RuleController extends Controller
 | 
			
		||||
    public function rules(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data     = $request->getData();
 | 
			
		||||
        $rules    = $this->repository->searchRule($data['query'], $data['limit']);
 | 
			
		||||
        $rules    = $this->repository->searchRule($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $response = [];
 | 
			
		||||
 | 
			
		||||
        /** @var Rule $rule */
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ class RuleGroupController extends Controller
 | 
			
		||||
    public function ruleGroups(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data     = $request->getData();
 | 
			
		||||
        $groups   = $this->repository->searchRuleGroup($data['query'], $data['limit']);
 | 
			
		||||
        $groups   = $this->repository->searchRuleGroup($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $response = [];
 | 
			
		||||
 | 
			
		||||
        /** @var RuleGroup $group */
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,7 @@ class TagController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $data = $request->getData();
 | 
			
		||||
 | 
			
		||||
        $result = $this->repository->searchTags($data['query'], $data['limit']);
 | 
			
		||||
        $result = $this->repository->searchTags($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $array  = [];
 | 
			
		||||
        /** @var Tag $tag */
 | 
			
		||||
        foreach ($result as $tag) {
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@ class TransactionController extends Controller
 | 
			
		||||
    public function transactions(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data   = $request->getData();
 | 
			
		||||
        $result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']);
 | 
			
		||||
        $result = $this->repository->searchJournalDescriptions($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
 | 
			
		||||
        // limit and unique
 | 
			
		||||
        $filtered = $result->unique('description');
 | 
			
		||||
@@ -113,7 +113,7 @@ class TransactionController extends Controller
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (!is_numeric($data['query'])) {
 | 
			
		||||
            $result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']);
 | 
			
		||||
            $result = $this->repository->searchJournalDescriptions($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // limit and unique
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ class TransactionTypeController extends Controller
 | 
			
		||||
    public function transactionTypes(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data  = $request->getData();
 | 
			
		||||
        $types = $this->repository->searchTypes($data['query'], $data['limit']);
 | 
			
		||||
        $types = $this->repository->searchTypes($data['query'], $this->parameters->get('limit'));
 | 
			
		||||
        $array = [];
 | 
			
		||||
 | 
			
		||||
        /** @var TransactionType $type */
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,6 @@ use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Models\Account;
 | 
			
		||||
use FireflyIII\Models\AccountType;
 | 
			
		||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ApiSupport;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
@@ -46,7 +45,6 @@ class AccountController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    use ApiSupport;
 | 
			
		||||
 | 
			
		||||
    private CurrencyRepositoryInterface $currencyRepository;
 | 
			
		||||
    private AccountRepositoryInterface $repository;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -64,9 +62,6 @@ class AccountController extends Controller
 | 
			
		||||
                $this->repository = app(AccountRepositoryInterface::class);
 | 
			
		||||
                $this->repository->setUser($user);
 | 
			
		||||
 | 
			
		||||
                $this->currencyRepository = app(CurrencyRepositoryInterface::class);
 | 
			
		||||
                $this->currencyRepository->setUser($user);
 | 
			
		||||
 | 
			
		||||
                return $next($request);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
 
 | 
			
		||||
@@ -61,9 +61,9 @@ abstract class Controller extends BaseController
 | 
			
		||||
    {
 | 
			
		||||
        // get global parameters
 | 
			
		||||
        $this->allowedSort = config('firefly.allowed_sort_parameters');
 | 
			
		||||
        $this->parameters  = $this->getParameters();
 | 
			
		||||
        $this->middleware(
 | 
			
		||||
            function ($request, $next) {
 | 
			
		||||
                $this->parameters = $this->getParameters();
 | 
			
		||||
                if (auth()->check()) {
 | 
			
		||||
                    $language = app('steam')->getLanguage();
 | 
			
		||||
                    app()->setLocale($language);
 | 
			
		||||
@@ -137,6 +137,11 @@ abstract class Controller extends BaseController
 | 
			
		||||
            if (null !== $value) {
 | 
			
		||||
                $bag->set($integer, (int)$value);
 | 
			
		||||
            }
 | 
			
		||||
            if (null === $value && 'limit' === $integer && auth()->check()) {
 | 
			
		||||
                // set default for user:
 | 
			
		||||
                $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
                $bag->set($integer, $pageSize);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // sort fields:
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
 | 
			
		||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Account\OperationsRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ApiSupport;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
 | 
			
		||||
@@ -43,7 +42,6 @@ class AccountController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    use ApiSupport;
 | 
			
		||||
 | 
			
		||||
    private CurrencyRepositoryInterface   $currencyRepository;
 | 
			
		||||
    private OperationsRepositoryInterface $opsRepository;
 | 
			
		||||
    private AccountRepositoryInterface    $repository;
 | 
			
		||||
 | 
			
		||||
@@ -61,9 +59,6 @@ class AccountController extends Controller
 | 
			
		||||
                $this->repository = app(AccountRepositoryInterface::class);
 | 
			
		||||
                $this->repository->setUser($user);
 | 
			
		||||
 | 
			
		||||
                $this->currencyRepository = app(CurrencyRepositoryInterface::class);
 | 
			
		||||
                $this->currencyRepository->setUser($user);
 | 
			
		||||
 | 
			
		||||
                $this->opsRepository = app(OperationsRepositoryInterface::class);
 | 
			
		||||
                $this->opsRepository->setUser($user);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
 | 
			
		||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Account\OperationsRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ApiSupport;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
 | 
			
		||||
@@ -43,7 +42,6 @@ class AccountController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    use ApiSupport;
 | 
			
		||||
 | 
			
		||||
    private CurrencyRepositoryInterface   $currencyRepository;
 | 
			
		||||
    private OperationsRepositoryInterface $opsRepository;
 | 
			
		||||
    private AccountRepositoryInterface    $repository;
 | 
			
		||||
 | 
			
		||||
@@ -61,9 +59,6 @@ class AccountController extends Controller
 | 
			
		||||
                $this->repository = app(AccountRepositoryInterface::class);
 | 
			
		||||
                $this->repository->setUser($user);
 | 
			
		||||
 | 
			
		||||
                $this->currencyRepository = app(CurrencyRepositoryInterface::class);
 | 
			
		||||
                $this->currencyRepository->setUser($user);
 | 
			
		||||
 | 
			
		||||
                $this->opsRepository = app(OperationsRepositoryInterface::class);
 | 
			
		||||
                $this->opsRepository->setUser($user);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,7 @@ class ListController extends Controller
 | 
			
		||||
    public function attachments(Account $account): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = $this->repository->getAttachments($account);
 | 
			
		||||
 | 
			
		||||
        $count       = $collection->count();
 | 
			
		||||
@@ -116,7 +116,7 @@ class ListController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->getPiggyBanks($account);
 | 
			
		||||
@@ -152,15 +152,9 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function transactions(Request $request, Account $account): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $type     = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
 | 
			
		||||
        // user can overrule page size with limit parameter.
 | 
			
		||||
        $limit = $this->parameters->get('limit');
 | 
			
		||||
        if (null !== $limit && $limit > 0) {
 | 
			
		||||
            $pageSize = $limit;
 | 
			
		||||
        }
 | 
			
		||||
        $types   = $this->mapTransactionTypes($this->parameters->get('type'));
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        /** @var User $admin */
 | 
			
		||||
@@ -172,8 +166,11 @@ class ListController extends Controller
 | 
			
		||||
        $collector->setUser($admin)->setAccounts(new Collection([$account]))
 | 
			
		||||
                  ->withAPIInformation()->setLimit($pageSize)->setPage($this->parameters->get('page'))->setTypes($types);
 | 
			
		||||
 | 
			
		||||
        if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        if (null !== $this->parameters->get('start')) {
 | 
			
		||||
            $collector->setStart($this->parameters->get('start'));
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setEnd($this->parameters->get('end'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ class ShowController extends Controller
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $types    = $this->mapAccountTypes($this->parameters->get('type'));
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of accounts. Count it and split it.
 | 
			
		||||
        $this->repository->resetAccountOrder();
 | 
			
		||||
 
 | 
			
		||||
@@ -123,7 +123,7 @@ class ShowController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of attachments. Count it and split it.
 | 
			
		||||
        $collection  = $this->repository->get();
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ class ShowController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        $start = $this->parameters->get('start');
 | 
			
		||||
        $end   = $this->parameters->get('end');
 | 
			
		||||
 
 | 
			
		||||
@@ -80,7 +80,7 @@ class ListController extends Controller
 | 
			
		||||
    public function attachments(Bill $bill): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = $this->repository->getAttachments($bill);
 | 
			
		||||
 | 
			
		||||
        $count       = $collection->count();
 | 
			
		||||
@@ -116,7 +116,7 @@ class ListController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->getRulesForBill($bill);
 | 
			
		||||
@@ -151,7 +151,7 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function transactions(Request $request, Bill $bill): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $type     = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
 | 
			
		||||
@@ -177,9 +177,11 @@ class ListController extends Controller
 | 
			
		||||
            // set types of transactions to return.
 | 
			
		||||
            ->setTypes($types);
 | 
			
		||||
 | 
			
		||||
        // do parameter stuff on new group collector.
 | 
			
		||||
        if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        if (null !== $this->parameters->get('start')) {
 | 
			
		||||
            $collector->setStart($this->parameters->get('start'));
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setEnd($this->parameters->get('end'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // get paginator.
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ class ShowController extends Controller
 | 
			
		||||
        $this->repository->correctOrder();
 | 
			
		||||
        $bills     = $this->repository->getBills();
 | 
			
		||||
        $manager   = $this->getManager();
 | 
			
		||||
        $pageSize  = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize  = $this->parameters->get('limit');
 | 
			
		||||
        $count     = $bills->count();
 | 
			
		||||
        $bills     = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
        $paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
 | 
			
		||||
 
 | 
			
		||||
@@ -82,7 +82,7 @@ class ListController extends Controller
 | 
			
		||||
    public function attachments(Budget $budget): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = $this->repository->getAttachments($budget);
 | 
			
		||||
 | 
			
		||||
        $count       = $collection->count();
 | 
			
		||||
@@ -116,7 +116,7 @@ class ListController extends Controller
 | 
			
		||||
    public function budgetLimits(Budget $budget): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager  = $this->getManager();
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $this->parameters->set('budget_id', $budget->id);
 | 
			
		||||
        $collection   = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        $count        = $collection->count();
 | 
			
		||||
@@ -148,13 +148,7 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function transactions(Request $request, Budget $budget): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
 | 
			
		||||
        // user can overrule page size with limit parameter.
 | 
			
		||||
        $limit = $this->parameters->get('limit');
 | 
			
		||||
        if (null !== $limit && $limit > 0) {
 | 
			
		||||
            $pageSize = $limit;
 | 
			
		||||
        }
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        $type = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
@@ -181,8 +175,11 @@ class ListController extends Controller
 | 
			
		||||
            // set types of transactions to return.
 | 
			
		||||
            ->setTypes($types);
 | 
			
		||||
 | 
			
		||||
        if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        if (null !== $this->parameters->get('start')) {
 | 
			
		||||
            $collector->setStart($this->parameters->get('start'));
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setEnd($this->parameters->get('end'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
@@ -211,13 +208,7 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function withoutBudget(Request $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
 | 
			
		||||
        // user can overrule page size with limit parameter.
 | 
			
		||||
        $limit = $this->parameters->get('limit');
 | 
			
		||||
        if (null !== $limit && $limit > 0) {
 | 
			
		||||
            $pageSize = $limit;
 | 
			
		||||
        }
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        $type = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
@@ -244,8 +235,11 @@ class ListController extends Controller
 | 
			
		||||
            // set types of transactions to return.
 | 
			
		||||
            ->setTypes($types);
 | 
			
		||||
 | 
			
		||||
        if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        if (null !== $this->parameters->get('start')) {
 | 
			
		||||
            $collector->setStart($this->parameters->get('start'));
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setEnd($this->parameters->get('end'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ class ShowController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->getBudgets();
 | 
			
		||||
 
 | 
			
		||||
@@ -80,7 +80,7 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function transactions(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $type     = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@ class ShowController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        $manager->parseIncludes('budget');
 | 
			
		||||
        $pageSize     = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize     = $this->parameters->get('limit');
 | 
			
		||||
        $collection   = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        $count        = $collection->count();
 | 
			
		||||
        $budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
@@ -117,7 +117,7 @@ class ShowController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        $manager->parseIncludes('budget');
 | 
			
		||||
        $pageSize     = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize     = $this->parameters->get('limit');
 | 
			
		||||
        $collection   = $this->blRepository->getAllBudgetLimits($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        $count        = $collection->count();
 | 
			
		||||
        $budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ class ListController extends Controller
 | 
			
		||||
    public function attachments(Category $category): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = $this->repository->getAttachments($category);
 | 
			
		||||
 | 
			
		||||
        $count       = $collection->count();
 | 
			
		||||
@@ -112,7 +112,7 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function transactions(Request $request, Category $category): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $type     = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
 | 
			
		||||
@@ -138,8 +138,11 @@ class ListController extends Controller
 | 
			
		||||
            // set types of transactions to return.
 | 
			
		||||
            ->setTypes($types);
 | 
			
		||||
 | 
			
		||||
        if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        if (null !== $this->parameters->get('start')) {
 | 
			
		||||
            $collector->setStart($this->parameters->get('start'));
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setEnd($this->parameters->get('end'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ class ShowController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->getCategories();
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ class ListController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        // get list of piggy banks. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->getBills($objectGroup);
 | 
			
		||||
        $count      = $collection->count();
 | 
			
		||||
@@ -114,7 +114,7 @@ class ListController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of piggy banks. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->getPiggyBanks($objectGroup);
 | 
			
		||||
 
 | 
			
		||||
@@ -79,7 +79,7 @@ class ShowController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        $this->repository->resetOrder();
 | 
			
		||||
        $collection   = $this->repository->get();
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@ class ListController extends Controller
 | 
			
		||||
    public function attachments(PiggyBank $piggyBank): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = $this->repository->getAttachments($piggyBank);
 | 
			
		||||
 | 
			
		||||
        $count       = $collection->count();
 | 
			
		||||
@@ -105,7 +105,7 @@ class ListController extends Controller
 | 
			
		||||
    public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $manager  = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        $collection = $this->repository->getEvents($piggyBank);
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ class ShowController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->getPiggyBanks();
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function transactions(Request $request, Recurrence $recurrence): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $type     = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
 | 
			
		||||
@@ -105,9 +105,13 @@ class ListController extends Controller
 | 
			
		||||
            // set types of transactions to return.
 | 
			
		||||
            ->setTypes($types);
 | 
			
		||||
 | 
			
		||||
        if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        if (null !== $this->parameters->get('start')) {
 | 
			
		||||
            $collector->setStart($this->parameters->get('start'));
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setEnd($this->parameters->get('end'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
        $paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
 | 
			
		||||
        $transactions = $paginator->getCollection();
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ class ShowController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->get();
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ class ShowController extends Controller
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        $collection = $this->ruleRepository->getAll();
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ class ListController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        $collection = $this->ruleGroupRepository->getRules($group);
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ class ShowController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of rule groups. Count it and split it.
 | 
			
		||||
        $collection = $this->ruleGroupRepository->get();
 | 
			
		||||
 
 | 
			
		||||
@@ -80,7 +80,7 @@ class ListController extends Controller
 | 
			
		||||
    public function attachments(Tag $tag): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = $this->repository->getAttachments($tag);
 | 
			
		||||
 | 
			
		||||
        $count       = $collection->count();
 | 
			
		||||
@@ -114,7 +114,7 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function transactions(Request $request, Tag $tag): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $type     = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
 | 
			
		||||
@@ -139,8 +139,11 @@ class ListController extends Controller
 | 
			
		||||
            // set types of transactions to return.
 | 
			
		||||
            ->setTypes($types);
 | 
			
		||||
 | 
			
		||||
        if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        if (null !== $this->parameters->get('start')) {
 | 
			
		||||
            $collector->setStart($this->parameters->get('start'));
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setEnd($this->parameters->get('end'));
 | 
			
		||||
        }
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
        $paginator->setPath(route('api.v1.tags.transactions', [$tag->id]) . $this->buildParams());
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ class ShowController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->get();
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@ class ListController extends Controller
 | 
			
		||||
    public function attachments(TransactionGroup $transactionGroup): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = new Collection();
 | 
			
		||||
        foreach ($transactionGroup->transactionJournals as $transactionJournal) {
 | 
			
		||||
            $collection = $this->journalAPIRepository->getAttachments($transactionJournal)->merge($collection);
 | 
			
		||||
@@ -114,7 +114,7 @@ class ListController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $collection = new Collection();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        foreach ($transactionGroup->transactionJournals as $transactionJournal) {
 | 
			
		||||
            $collection = $this->journalAPIRepository->getPiggyBankEvents($transactionJournal)->merge($collection);
 | 
			
		||||
        }
 | 
			
		||||
@@ -152,7 +152,7 @@ class ListController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager      = $this->getManager();
 | 
			
		||||
        $collection   = $this->journalAPIRepository->getJournalLinks($transactionJournal);
 | 
			
		||||
        $pageSize     = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize     = $this->parameters->get('limit');
 | 
			
		||||
        $count        = $collection->count();
 | 
			
		||||
        $journalLinks = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ class ShowController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function index(Request $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $type     = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,8 +27,8 @@ namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency;
 | 
			
		||||
use FireflyIII\Api\V1\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Models\TransactionCurrency;
 | 
			
		||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Validator;
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\AccountFilter;
 | 
			
		||||
@@ -65,26 +64,6 @@ class ListController extends Controller
 | 
			
		||||
    use AccountFilter;
 | 
			
		||||
    use TransactionFilter;
 | 
			
		||||
 | 
			
		||||
    private CurrencyRepositoryInterface $repository;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * CurrencyRepository constructor.
 | 
			
		||||
     *
 | 
			
		||||
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
        $this->middleware(
 | 
			
		||||
            function ($request, $next) {
 | 
			
		||||
                $this->repository = app(CurrencyRepositoryInterface::class);
 | 
			
		||||
                $this->repository->setUser(auth()->user());
 | 
			
		||||
 | 
			
		||||
                return $next($request);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This endpoint is documented at:
 | 
			
		||||
     * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/listAccountByCurrency
 | 
			
		||||
@@ -106,7 +85,7 @@ class ListController extends Controller
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $types    = $this->mapAccountTypes($this->parameters->get('type'));
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of accounts. Count it and split it.
 | 
			
		||||
        /** @var AccountRepositoryInterface $accountRepository */
 | 
			
		||||
@@ -153,7 +132,7 @@ class ListController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of available budgets. Count it and split it.
 | 
			
		||||
        /** @var AvailableBudgetRepositoryInterface $abRepository */
 | 
			
		||||
@@ -193,7 +172,7 @@ class ListController extends Controller
 | 
			
		||||
 | 
			
		||||
        /** @var BillRepositoryInterface $billRepos */
 | 
			
		||||
        $billRepos  = app(BillRepositoryInterface::class);
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $unfiltered = $billRepos->getBills();
 | 
			
		||||
 | 
			
		||||
        // filter and paginate list:
 | 
			
		||||
@@ -236,7 +215,7 @@ class ListController extends Controller
 | 
			
		||||
        $blRepository = app(BudgetLimitRepositoryInterface::class);
 | 
			
		||||
 | 
			
		||||
        $manager      = $this->getManager();
 | 
			
		||||
        $pageSize     = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize     = $this->parameters->get('limit');
 | 
			
		||||
        $collection   = $blRepository->getAllBudgetLimitsByCurrency($currency, $this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        $count        = $collection->count();
 | 
			
		||||
        $budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
@@ -268,7 +247,7 @@ class ListController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        /** @var RecurringRepositoryInterface $recurringRepos */
 | 
			
		||||
@@ -319,7 +298,7 @@ class ListController extends Controller
 | 
			
		||||
    public function rules(TransactionCurrency $currency): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager  = $this->getManager();
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of budgets. Count it and split it.
 | 
			
		||||
        /** @var RuleRepositoryInterface $ruleRepos */
 | 
			
		||||
@@ -371,7 +350,7 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function transactions(Request $request, TransactionCurrency $currency): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $type     = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
 | 
			
		||||
@@ -396,8 +375,11 @@ class ListController extends Controller
 | 
			
		||||
            ->setPage($this->parameters->get('page'))
 | 
			
		||||
            // set types of transactions to return.
 | 
			
		||||
            ->setTypes($types);
 | 
			
		||||
        if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        if (null !== $this->parameters->get('start')) {
 | 
			
		||||
            $collector->setStart($this->parameters->get('start'));
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setEnd($this->parameters->get('end'));
 | 
			
		||||
        }
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
        $paginator->setPath(route('api.v1.currencies.transactions', [$currency->code]) . $this->buildParams());
 | 
			
		||||
 
 | 
			
		||||
@@ -27,10 +27,11 @@ namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency;
 | 
			
		||||
use FireflyIII\Api\V1\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Models\TransactionCurrency;
 | 
			
		||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\AccountFilter;
 | 
			
		||||
use FireflyIII\Support\Http\Api\TransactionFilter;
 | 
			
		||||
use FireflyIII\Transformers\CurrencyTransformer;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Illuminate\Pagination\LengthAwarePaginator;
 | 
			
		||||
use JsonException;
 | 
			
		||||
@@ -78,16 +79,15 @@ class ShowController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function index(): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = $this->repository->getAll();
 | 
			
		||||
        $count      = $collection->count();
 | 
			
		||||
 | 
			
		||||
        // slice them:
 | 
			
		||||
        $currencies = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
        $paginator  = new LengthAwarePaginator($currencies, $count, $pageSize, $this->parameters->get('page'));
 | 
			
		||||
        $paginator->setPath(route('api.v1.currencies.index') . $this->buildParams());
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
 | 
			
		||||
        $this->parameters->set('defaultCurrency', $defaultCurrency);
 | 
			
		||||
 | 
			
		||||
        /** @var CurrencyTransformer $transformer */
 | 
			
		||||
        $transformer = app(CurrencyTransformer::class);
 | 
			
		||||
@@ -113,10 +113,15 @@ class ShowController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function show(TransactionCurrency $currency): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        /** @var User $user */
 | 
			
		||||
        $user            = auth()->user();
 | 
			
		||||
        $manager         = $this->getManager();
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
 | 
			
		||||
        $this->parameters->set('defaultCurrency', $defaultCurrency);
 | 
			
		||||
 | 
			
		||||
        // update fields with user info.
 | 
			
		||||
        $currency->refreshForUser($user);
 | 
			
		||||
 | 
			
		||||
        /** @var CurrencyTransformer $transformer */
 | 
			
		||||
        $transformer = app(CurrencyTransformer::class);
 | 
			
		||||
        $transformer->setParameters($this->parameters);
 | 
			
		||||
@@ -138,9 +143,13 @@ class ShowController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function showDefault(): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        /** @var User $user */
 | 
			
		||||
        $user     = auth()->user();
 | 
			
		||||
        $manager  = $this->getManager();
 | 
			
		||||
        $currency = app('amount')->getDefaultCurrencyByUser(auth()->user());
 | 
			
		||||
        $this->parameters->set('defaultCurrency', $currency);
 | 
			
		||||
        $currency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
 | 
			
		||||
 | 
			
		||||
        // update fields with user info.
 | 
			
		||||
        $currency->refreshForUser($user);
 | 
			
		||||
 | 
			
		||||
        /** @var CurrencyTransformer $transformer */
 | 
			
		||||
        $transformer = app(CurrencyTransformer::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -27,10 +27,11 @@ 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\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\AccountFilter;
 | 
			
		||||
use FireflyIII\Support\Http\Api\TransactionFilter;
 | 
			
		||||
use FireflyIII\Transformers\CurrencyTransformer;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use JsonException;
 | 
			
		||||
use League\Fractal\Resource\Item;
 | 
			
		||||
@@ -79,12 +80,14 @@ class StoreController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $currency = $this->repository->store($request->getAll());
 | 
			
		||||
        if (true === $request->boolean('default')) {
 | 
			
		||||
            app('preferences')->set('currencyPreference', $currency->code);
 | 
			
		||||
            $this->repository->makeDefault($currency);
 | 
			
		||||
            app('preferences')->mark();
 | 
			
		||||
        }
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
 | 
			
		||||
        $this->parameters->set('defaultCurrency', $defaultCurrency);
 | 
			
		||||
 | 
			
		||||
        /** @var User $user */
 | 
			
		||||
        $user = auth()->user();
 | 
			
		||||
        $currency->refreshForUser($user);
 | 
			
		||||
 | 
			
		||||
        /** @var CurrencyTransformer $transformer */
 | 
			
		||||
        $transformer = app(CurrencyTransformer::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -28,10 +28,11 @@ 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\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\AccountFilter;
 | 
			
		||||
use FireflyIII\Support\Http\Api\TransactionFilter;
 | 
			
		||||
use FireflyIII\Transformers\CurrencyTransformer;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use JsonException;
 | 
			
		||||
use League\Fractal\Resource\Item;
 | 
			
		||||
@@ -82,11 +83,16 @@ class UpdateController extends Controller
 | 
			
		||||
        if ($this->repository->currencyInUse($currency)) {
 | 
			
		||||
            return response()->json([], 409);
 | 
			
		||||
        }
 | 
			
		||||
        // must not be the only one in use:
 | 
			
		||||
        if (1 === $this->repository->get()->count()) {
 | 
			
		||||
            return response()->json([], 409);
 | 
			
		||||
        }
 | 
			
		||||
        /** @var User $user */
 | 
			
		||||
        $user = auth()->user();
 | 
			
		||||
        $this->repository->disable($currency);
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
 | 
			
		||||
        $this->parameters->set('defaultCurrency', $defaultCurrency);
 | 
			
		||||
        $currency->refreshForUser($user);
 | 
			
		||||
 | 
			
		||||
        /** @var CurrencyTransformer $transformer */
 | 
			
		||||
        $transformer = app(CurrencyTransformer::class);
 | 
			
		||||
@@ -110,14 +116,15 @@ class UpdateController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function makeDefault(TransactionCurrency $currency): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        /** @var User $user */
 | 
			
		||||
        $user = auth()->user();
 | 
			
		||||
        $this->repository->enable($currency);
 | 
			
		||||
        $this->repository->makeDefault($currency);
 | 
			
		||||
 | 
			
		||||
        app('preferences')->set('currencyPreference', $currency->code);
 | 
			
		||||
        app('preferences')->mark();
 | 
			
		||||
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        $this->parameters->set('defaultCurrency', $currency);
 | 
			
		||||
        $currency->refreshForUser($user);
 | 
			
		||||
 | 
			
		||||
        /** @var CurrencyTransformer $transformer */
 | 
			
		||||
        $transformer = app(CurrencyTransformer::class);
 | 
			
		||||
@@ -144,9 +151,10 @@ class UpdateController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $this->repository->enable($currency);
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
        /** @var User $user */
 | 
			
		||||
        $user = auth()->user();
 | 
			
		||||
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
 | 
			
		||||
        $this->parameters->set('defaultCurrency', $defaultCurrency);
 | 
			
		||||
        $currency->refreshForUser($user);
 | 
			
		||||
 | 
			
		||||
        /** @var CurrencyTransformer $transformer */
 | 
			
		||||
        $transformer = app(CurrencyTransformer::class);
 | 
			
		||||
@@ -173,17 +181,22 @@ class UpdateController extends Controller
 | 
			
		||||
    public function update(UpdateRequest $request, TransactionCurrency $currency): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data = $request->getAll();
 | 
			
		||||
 | 
			
		||||
        /** @var User $user */
 | 
			
		||||
        $user = auth()->user();
 | 
			
		||||
 | 
			
		||||
        // safety catch on currency disablement.
 | 
			
		||||
        $set = $this->repository->get();
 | 
			
		||||
        if (array_key_exists('enabled', $data) && false === $data['enabled'] && 1 === count($set) && $set->first()->id === $currency->id) {
 | 
			
		||||
            return response()->json([], 409);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        $currency = $this->repository->update($currency, $data);
 | 
			
		||||
 | 
			
		||||
        if (true === $request->boolean('default')) {
 | 
			
		||||
            app('preferences')->set('currencyPreference', $currency->code);
 | 
			
		||||
        app('preferences')->mark();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $manager = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
 | 
			
		||||
        $this->parameters->set('defaultCurrency', $defaultCurrency);
 | 
			
		||||
        $currency->refreshForUser($user);
 | 
			
		||||
 | 
			
		||||
        /** @var CurrencyTransformer $transformer */
 | 
			
		||||
        $transformer = app(CurrencyTransformer::class);
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@ class ShowController extends Controller
 | 
			
		||||
        $name = $request->get('name');
 | 
			
		||||
 | 
			
		||||
        // types to get, page size:
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $linkType = $this->repository->findByName($name);
 | 
			
		||||
 | 
			
		||||
        // get list of transaction links. Count it and split it.
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function transactions(Request $request, LinkType $linkType): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $type     = $request->get('type') ?? 'default';
 | 
			
		||||
        $this->parameters->set('type', $type);
 | 
			
		||||
 | 
			
		||||
@@ -106,8 +106,11 @@ class ListController extends Controller
 | 
			
		||||
            ->setPage($this->parameters->get('page'))
 | 
			
		||||
            // set types of transactions to return.
 | 
			
		||||
            ->setTypes($types);
 | 
			
		||||
        if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
 | 
			
		||||
        if (null !== $this->parameters->get('start')) {
 | 
			
		||||
            $collector->setStart($this->parameters->get('start'));
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $this->parameters->get('end')) {
 | 
			
		||||
            $collector->setEnd($this->parameters->get('end'));
 | 
			
		||||
        }
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
        $paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@ class ShowController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        // create some objects:
 | 
			
		||||
        $manager  = $this->getManager();
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
        // get list of accounts. Count it and split it.
 | 
			
		||||
        $collection = $this->repository->get();
 | 
			
		||||
 
 | 
			
		||||
@@ -53,8 +53,7 @@ class TransactionController extends Controller
 | 
			
		||||
        $manager   = $this->getManager();
 | 
			
		||||
        $fullQuery = (string)$request->get('query');
 | 
			
		||||
        $page      = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
 | 
			
		||||
        $pageSize  = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize  = 0 === (int)$request->get('limit') ? $pageSize : (int)$request->get('limit');
 | 
			
		||||
        $pageSize  = $this->parameters->get('limit');
 | 
			
		||||
        $searcher->parseQuery($fullQuery);
 | 
			
		||||
        $searcher->setPage($page);
 | 
			
		||||
        $searcher->setLimit($pageSize);
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@ 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\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
 | 
			
		||||
@@ -236,6 +236,7 @@ class BasicController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    private function getBillInformation(Carbon $start, Carbon $end): array
 | 
			
		||||
    {
 | 
			
		||||
        app('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.
 | 
			
		||||
@@ -281,7 +282,7 @@ 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-')));
 | 
			
		||||
        return $return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -101,7 +101,7 @@ class UserController extends Controller
 | 
			
		||||
    public function index(): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        // user preferences
 | 
			
		||||
        $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $manager  = $this->getManager();
 | 
			
		||||
 | 
			
		||||
        // build collection
 | 
			
		||||
 
 | 
			
		||||
@@ -58,7 +58,7 @@ class PreferencesController extends Controller
 | 
			
		||||
        $collection  = app('preferences')->all();
 | 
			
		||||
        $manager     = $this->getManager();
 | 
			
		||||
        $count       = $collection->count();
 | 
			
		||||
        $pageSize    = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize    = $this->parameters->get('limit');
 | 
			
		||||
        $preferences = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
 | 
			
		||||
        // make paginator:
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ class AttemptController extends Controller
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = $this->repository->getAttempts($message);
 | 
			
		||||
        $count      = $collection->count();
 | 
			
		||||
        $attempts   = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
 
 | 
			
		||||
@@ -70,7 +70,7 @@ class MessageController extends Controller
 | 
			
		||||
    public function index(Webhook $webhook): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $collection = $this->repository->getMessages($webhook);
 | 
			
		||||
 | 
			
		||||
        $count    = $collection->count();
 | 
			
		||||
 
 | 
			
		||||
@@ -74,7 +74,7 @@ class ShowController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $manager    = $this->getManager();
 | 
			
		||||
        $collection = $this->repository->all();
 | 
			
		||||
        $pageSize   = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $count      = $collection->count();
 | 
			
		||||
        $webhooks   = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -46,8 +46,6 @@ class AutocompleteRequest extends FormRequest
 | 
			
		||||
        if ('' !== $types) {
 | 
			
		||||
            $array = explode(',', $types);
 | 
			
		||||
        }
 | 
			
		||||
        $limit = $this->convertInteger('limit');
 | 
			
		||||
        $limit = 0 === $limit ? 10 : $limit;
 | 
			
		||||
 | 
			
		||||
        // remove 'initial balance' from allowed types. its internal
 | 
			
		||||
        $array = array_diff($array, [AccountType::INITIAL_BALANCE, AccountType::RECONCILIATION]);
 | 
			
		||||
@@ -56,7 +54,6 @@ class AutocompleteRequest extends FormRequest
 | 
			
		||||
            'types' => $array,
 | 
			
		||||
            'query' => $this->convertString('query'),
 | 
			
		||||
            'date'  => $this->getCarbonDate('date'),
 | 
			
		||||
            'limit' => $limit,
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -66,7 +63,6 @@ class AutocompleteRequest extends FormRequest
 | 
			
		||||
    public function rules(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'limit' => 'min:0|max:1337',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -174,7 +174,7 @@ class StoreRequest extends FormRequest
 | 
			
		||||
    public function rules(): array
 | 
			
		||||
    {
 | 
			
		||||
        Log::debug('Collect rules of TransactionStoreRequest');
 | 
			
		||||
 | 
			
		||||
        $validProtocols = config('firefly.valid_url_protocols');
 | 
			
		||||
        return [
 | 
			
		||||
            // basic fields for group:
 | 
			
		||||
            'group_title'                          => 'between:1,1000|nullable',
 | 
			
		||||
@@ -233,7 +233,7 @@ class StoreRequest extends FormRequest
 | 
			
		||||
            'transactions.*.external_id'           => 'min:1|max:255|nullable',
 | 
			
		||||
            'transactions.*.recurrence_id'         => 'min:1|max:255|nullable',
 | 
			
		||||
            'transactions.*.bunq_payment_id'       => 'min:1|max:255|nullable',
 | 
			
		||||
            'transactions.*.external_url'          => 'min:1|max:255|nullable|url',
 | 
			
		||||
            'transactions.*.external_url'          => sprintf('min:1|max:255|nullable|url:%s', $validProtocols),
 | 
			
		||||
 | 
			
		||||
            // SEPA fields:
 | 
			
		||||
            'transactions.*.sepa_cc'               => 'min:1|max:255|nullable',
 | 
			
		||||
 
 | 
			
		||||
@@ -321,7 +321,7 @@ class UpdateRequest extends FormRequest
 | 
			
		||||
    public function rules(): array
 | 
			
		||||
    {
 | 
			
		||||
        Log::debug(sprintf('Now in %s', __METHOD__));
 | 
			
		||||
 | 
			
		||||
        $validProtocols = config('firefly.valid_url_protocols');
 | 
			
		||||
        return [
 | 
			
		||||
            // basic fields for group:
 | 
			
		||||
            'group_title'                           => 'between:1,1000|nullable',
 | 
			
		||||
@@ -375,7 +375,7 @@ class UpdateRequest extends FormRequest
 | 
			
		||||
            'transactions.*.external_id'            => 'min:1|max:255|nullable',
 | 
			
		||||
            'transactions.*.recurrence_id'          => 'min:1|max:255|nullable',
 | 
			
		||||
            'transactions.*.bunq_payment_id'        => 'min:1|max:255|nullable',
 | 
			
		||||
            'transactions.*.external_url'           => 'min:1|max:255|nullable|url',
 | 
			
		||||
            'transactions.*.external_url'           => sprintf('min:1|max:255|nullable|url:%s', $validProtocols),
 | 
			
		||||
 | 
			
		||||
            // SEPA fields:
 | 
			
		||||
            'transactions.*.sepa_cc'                => 'min:1|max:255|nullable',
 | 
			
		||||
@@ -417,15 +417,22 @@ class UpdateRequest extends FormRequest
 | 
			
		||||
                // all transaction types must be equal:
 | 
			
		||||
                $this->validateTransactionTypesForUpdate($validator);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                // user wants to update a reconciled transaction.
 | 
			
		||||
                // source, destination, amount + foreign_amount cannot be changed
 | 
			
		||||
                // and must be omitted from the request.
 | 
			
		||||
                $this->preventUpdateReconciled($validator, $transactionGroup);
 | 
			
		||||
 | 
			
		||||
                // validate source/destination is equal, depending on the transaction journal type.
 | 
			
		||||
                $this->validateEqualAccountsForUpdate($validator, $transactionGroup);
 | 
			
		||||
 | 
			
		||||
                // a catch when users submit splits with no source or destination info at all.
 | 
			
		||||
                $this->preventNoAccountInfo($validator, );
 | 
			
		||||
                // see method:
 | 
			
		||||
                //$this->preventNoAccountInfo($validator, );
 | 
			
		||||
 | 
			
		||||
                // validate that the currency fits the source and/or destination account.
 | 
			
		||||
                // validate all account info
 | 
			
		||||
                $this->validateAccountInformationUpdate($validator, $transactionGroup);
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,6 @@ class UpdateRequest extends FormRequest
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        return $this->getAllData($fields);
 | 
			
		||||
        //        return $return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -74,14 +74,14 @@ class CreateRequest extends FormRequest
 | 
			
		||||
        $triggers       = implode(',', array_keys(Webhook::getTriggersForValidation()));
 | 
			
		||||
        $responses      = implode(',', array_keys(Webhook::getResponsesForValidation()));
 | 
			
		||||
        $deliveries     = implode(',', array_keys(Webhook::getDeliveriesForValidation()));
 | 
			
		||||
 | 
			
		||||
        $validProtocols = config('firefly.valid_url_protocols');
 | 
			
		||||
        return [
 | 
			
		||||
            'title'    => 'required|between:1,512|uniqueObjectForUser:webhooks,title',
 | 
			
		||||
            'active'   => [new IsBoolean()],
 | 
			
		||||
            'trigger'  => sprintf('required|in:%s', $triggers),
 | 
			
		||||
            'response' => sprintf('required|in:%s', $responses),
 | 
			
		||||
            'delivery' => sprintf('required|in:%s', $deliveries),
 | 
			
		||||
            'url'      => ['required', 'url', 'uniqueWebhook'],
 | 
			
		||||
            'url'      => ['required', sprintf('url:%s', $validProtocols), 'uniqueWebhook'],
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ class UpdateRequest extends FormRequest
 | 
			
		||||
        $triggers       = implode(',', array_keys(Webhook::getTriggersForValidation()));
 | 
			
		||||
        $responses      = implode(',', array_keys(Webhook::getResponsesForValidation()));
 | 
			
		||||
        $deliveries     = implode(',', array_keys(Webhook::getDeliveriesForValidation()));
 | 
			
		||||
 | 
			
		||||
        $validProtocols = config('firefly.valid_url_protocols');
 | 
			
		||||
        /** @var Webhook $webhook */
 | 
			
		||||
        $webhook = $this->route()->parameter('webhook');
 | 
			
		||||
 | 
			
		||||
@@ -94,7 +94,7 @@ class UpdateRequest extends FormRequest
 | 
			
		||||
            'trigger'  => sprintf('in:%s', $triggers),
 | 
			
		||||
            'response' => sprintf('in:%s', $responses),
 | 
			
		||||
            'delivery' => sprintf('in:%s', $deliveries),
 | 
			
		||||
            'url'      => ['url', sprintf('uniqueExistingWebhook:%d', $webhook->id)],
 | 
			
		||||
            'url'      => [sprintf('url:%s', $validProtocols), sprintf('uniqueExistingWebhook:%d', $webhook->id)],
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,6 @@ use FireflyIII\Models\AccountType;
 | 
			
		||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\AccountFilter;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -41,7 +40,6 @@ use Illuminate\Http\JsonResponse;
 | 
			
		||||
class AccountController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    use AccountFilter;
 | 
			
		||||
    use ValidatesUserGroupTrait;
 | 
			
		||||
 | 
			
		||||
    private AdminAccountRepositoryInterface $adminRepository;
 | 
			
		||||
    private array                           $balanceTypes;
 | 
			
		||||
@@ -90,11 +88,10 @@ class AccountController extends Controller
 | 
			
		||||
        $types           = $data['types'];
 | 
			
		||||
        $query           = $data['query'];
 | 
			
		||||
        $date            = $this->parameters->get('date') ?? today(config('app.timezone'));
 | 
			
		||||
 | 
			
		||||
        $return          = [];
 | 
			
		||||
        $result          = $this->adminRepository->searchAccount((string)$query, $types, $data['limit']);
 | 
			
		||||
        $defaultCurrency = app('amount')->getDefaultCurrency();
 | 
			
		||||
 | 
			
		||||
        $allItems = [];
 | 
			
		||||
        /** @var Account $account */
 | 
			
		||||
        foreach ($result as $account) {
 | 
			
		||||
            $nameWithBalance = $account->name;
 | 
			
		||||
@@ -104,11 +101,17 @@ class AccountController extends Controller
 | 
			
		||||
                $balance         = app('steam')->balance($account, $date);
 | 
			
		||||
                $nameWithBalance = sprintf('%s (%s)', $account->name, app('amount')->formatAnything($currency, $balance, false));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $return[] = [
 | 
			
		||||
            $type                 = (string)trans(sprintf('firefly.%s', $account->accountType->type));
 | 
			
		||||
            $groupedResult[$type] = $groupedResult[$type] ?? [
 | 
			
		||||
                'group ' => $type,
 | 
			
		||||
                'items'  => [],
 | 
			
		||||
            ];
 | 
			
		||||
            $allItems[]           = [
 | 
			
		||||
                'id'                      => (string)$account->id,
 | 
			
		||||
                'value'                   => (string)$account->id,
 | 
			
		||||
                'name'                    => $account->name,
 | 
			
		||||
                'name_with_balance'       => $nameWithBalance,
 | 
			
		||||
                'label'                   => $nameWithBalance,
 | 
			
		||||
                'type'                    => $account->accountType->type,
 | 
			
		||||
                'currency_id'             => (string)$currency->id,
 | 
			
		||||
                'currency_name'           => $currency->name,
 | 
			
		||||
@@ -118,10 +121,9 @@ class AccountController extends Controller
 | 
			
		||||
            ];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // custom order.
 | 
			
		||||
        usort(
 | 
			
		||||
            $return,
 | 
			
		||||
            function ($a, $b) {
 | 
			
		||||
            $allItems,
 | 
			
		||||
            function (array $a, array $b): int {
 | 
			
		||||
                $order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
 | 
			
		||||
                $pos_a = array_search($a['type'], $order, true);
 | 
			
		||||
                $pos_b = array_search($b['type'], $order, true);
 | 
			
		||||
@@ -129,7 +131,6 @@ class AccountController extends Controller
 | 
			
		||||
                return $pos_a - $pos_b;
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        return response()->json($return);
 | 
			
		||||
        return response()->json($allItems);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,94 @@
 | 
			
		||||
<?php
 | 
			
		||||
/*
 | 
			
		||||
 * TransactionController.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\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 Illuminate\Http\JsonResponse;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class TransactionController
 | 
			
		||||
 */
 | 
			
		||||
class TransactionController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    private JournalRepositoryInterface $repository;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * AccountController constructor.
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
        $this->middleware(
 | 
			
		||||
            function ($request, $next) {
 | 
			
		||||
                $this->repository = app(JournalRepositoryInterface::class);
 | 
			
		||||
 | 
			
		||||
                $userGroup = $this->validateUserGroup($request);
 | 
			
		||||
                if (null !== $userGroup) {
 | 
			
		||||
                    $this->repository->setUserGroup($userGroup);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return $next($request);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *  Documentation for this endpoint:
 | 
			
		||||
     *  TODO list of checks
 | 
			
		||||
     *  1. use dates from ParameterBag
 | 
			
		||||
     *  2. Request validates dates
 | 
			
		||||
     *  3. Request includes user_group_id
 | 
			
		||||
     *  4. Endpoint is documented.
 | 
			
		||||
     *  5. Collector uses user_group_id
 | 
			
		||||
     *
 | 
			
		||||
     *
 | 
			
		||||
     * @return JsonResponse
 | 
			
		||||
     */
 | 
			
		||||
    public function transactionDescriptions(AutocompleteRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $data   = $request->getData();
 | 
			
		||||
        $result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']);
 | 
			
		||||
 | 
			
		||||
        // limit and unique
 | 
			
		||||
        $filtered = $result->unique('description');
 | 
			
		||||
        $array    = [];
 | 
			
		||||
 | 
			
		||||
        /** @var TransactionJournal $journal */
 | 
			
		||||
        foreach ($filtered as $journal) {
 | 
			
		||||
            $array[] = [
 | 
			
		||||
                'id'                   => (string)$journal->id,
 | 
			
		||||
                'transaction_group_id' => (string)$journal->transaction_group_id,
 | 
			
		||||
                'name'                 => $journal->description,
 | 
			
		||||
                'description'          => $journal->description,
 | 
			
		||||
            ];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return response()->json($array);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -32,13 +32,12 @@ use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
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\BudgetLimitRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\CleansChartData;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Illuminate\Support\Collection;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
 | 
			
		||||
use FireflyIII\Models\AccountType;
 | 
			
		||||
use FireflyIII\Models\TransactionType;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\CleansChartData;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,7 @@ namespace FireflyIII\Api\V2\Controllers;
 | 
			
		||||
use Carbon\Carbon;
 | 
			
		||||
use Carbon\Exceptions\InvalidDateException;
 | 
			
		||||
use Carbon\Exceptions\InvalidFormatException;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use FireflyIII\Transformers\V2\AbstractTransformer;
 | 
			
		||||
use Illuminate\Database\Eloquent\Model;
 | 
			
		||||
use Illuminate\Pagination\LengthAwarePaginator;
 | 
			
		||||
@@ -48,8 +49,9 @@ use Symfony\Component\HttpFoundation\ParameterBag;
 | 
			
		||||
 */
 | 
			
		||||
class Controller extends BaseController
 | 
			
		||||
{
 | 
			
		||||
    use ValidatesUserGroupTrait;
 | 
			
		||||
 | 
			
		||||
    protected const CONTENT_TYPE = 'application/vnd.api+json';
 | 
			
		||||
    protected int          $pageSize;
 | 
			
		||||
    protected ParameterBag $parameters;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -57,11 +59,14 @@ class Controller extends BaseController
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->middleware(
 | 
			
		||||
            function ($request, $next) {
 | 
			
		||||
                $this->parameters = $this->getParameters();
 | 
			
		||||
        $this->pageSize   = 50;
 | 
			
		||||
        if (auth()->check()) {
 | 
			
		||||
            $this->pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
 | 
			
		||||
                return $next($request);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -73,6 +78,7 @@ class Controller extends BaseController
 | 
			
		||||
    private function getParameters(): ParameterBag
 | 
			
		||||
    {
 | 
			
		||||
        $bag = new ParameterBag();
 | 
			
		||||
        $bag->set('limit', 50);
 | 
			
		||||
        try {
 | 
			
		||||
            $page = (int)request()->get('page');
 | 
			
		||||
        } catch (ContainerExceptionInterface | NotFoundExceptionInterface $e) {
 | 
			
		||||
@@ -129,6 +135,11 @@ class Controller extends BaseController
 | 
			
		||||
            if (null !== $value) {
 | 
			
		||||
                $bag->set($integer, (int)$value);
 | 
			
		||||
            }
 | 
			
		||||
            if (null === $value && 'limit' === $integer && auth()->check()) {
 | 
			
		||||
                // set default for user:
 | 
			
		||||
                $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
                $bag->set($integer, $pageSize);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // sort fields:
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,8 @@ use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Show = show a single account.
 | 
			
		||||
 * Index = show all accounts
 | 
			
		||||
 * Class ShowController
 | 
			
		||||
 */
 | 
			
		||||
class ShowController extends Controller
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										87
									
								
								app/Api/V2/Controllers/Model/Bill/IndexController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								app/Api/V2/Controllers/Model/Bill/IndexController.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * ShowController.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\V2\Controllers\Model\Bill;
 | 
			
		||||
 | 
			
		||||
use FireflyIII\Api\V2\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Models\Bill;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use FireflyIII\Transformers\V2\BillTransformer;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
use Illuminate\Pagination\LengthAwarePaginator;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class ShowController
 | 
			
		||||
 */
 | 
			
		||||
class IndexController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    use ValidatesUserGroupTrait;
 | 
			
		||||
 | 
			
		||||
    private BillRepositoryInterface $repository;
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
        $this->middleware(
 | 
			
		||||
            function ($request, $next) {
 | 
			
		||||
                $this->repository = app(BillRepositoryInterface::class);
 | 
			
		||||
 | 
			
		||||
                // new way of user group validation
 | 
			
		||||
                $userGroup = $this->validateUserGroup($request);
 | 
			
		||||
                if (null !== $userGroup) {
 | 
			
		||||
                    $this->repository->setUserGroup($userGroup);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return $next($request);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Request $request
 | 
			
		||||
     *
 | 
			
		||||
     * TODO see autocomplete/accountcontroller for list.
 | 
			
		||||
     *
 | 
			
		||||
     * @return JsonResponse
 | 
			
		||||
     */
 | 
			
		||||
    public function index(Request $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $this->repository->correctOrder();
 | 
			
		||||
        $bills       = $this->repository->getBills();
 | 
			
		||||
        $pageSize    = $this->parameters->get('limit');
 | 
			
		||||
        $count       = $bills->count();
 | 
			
		||||
        $bills       = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
 | 
			
		||||
        $transformer = new BillTransformer();
 | 
			
		||||
        $transformer->setParameters($this->parameters); // give params to transformer
 | 
			
		||||
 | 
			
		||||
        return response()
 | 
			
		||||
            ->json($this->jsonApiList('subscriptions', $paginator, $transformer))
 | 
			
		||||
            ->header('Content-Type', self::CONTENT_TYPE);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -30,7 +30,6 @@ use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Models\Bill;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use FireflyIII\Transformers\V2\AccountTransformer;
 | 
			
		||||
use FireflyIII\Transformers\V2\BillTransformer;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
@@ -63,29 +62,6 @@ class ShowController extends Controller
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Request $request
 | 
			
		||||
     *
 | 
			
		||||
     * TODO see autocomplete/accountcontroller for list.
 | 
			
		||||
     *
 | 
			
		||||
     * @return JsonResponse
 | 
			
		||||
     */
 | 
			
		||||
    public function index(Request $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $this->repository->correctOrder();
 | 
			
		||||
        $bills       = $this->repository->getBills();
 | 
			
		||||
        $pageSize    = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $count       = $bills->count();
 | 
			
		||||
        $bills       = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
 | 
			
		||||
        $transformer = new BillTransformer();
 | 
			
		||||
        $transformer->setParameters($this->parameters); // give params to transformer
 | 
			
		||||
 | 
			
		||||
        return response()
 | 
			
		||||
            ->json($this->jsonApiList('subscriptions', $paginator, $transformer))
 | 
			
		||||
            ->header('Content-Type', self::CONTENT_TYPE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * TODO this endpoint is not documented
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,6 @@ namespace FireflyIII\Api\V2\Controllers\Model\Bill;
 | 
			
		||||
 | 
			
		||||
use FireflyIII\Api\V2\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Api\V2\Request\Generic\DateRequest;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,7 @@ declare(strict_types=1);
 | 
			
		||||
namespace FireflyIII\Api\V2\Controllers\Model\Budget;
 | 
			
		||||
 | 
			
		||||
use FireflyIII\Api\V2\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
 | 
			
		||||
use FireflyIII\Transformers\V2\BudgetTransformer;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
@@ -61,12 +62,12 @@ class ListController extends Controller
 | 
			
		||||
    public function index(Request $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        echo 'this needs move to Administration';
 | 
			
		||||
        exit;
 | 
			
		||||
        throw new FireflyException('Needs migration to IndexController');
 | 
			
		||||
        $collection = $this->repository->getActiveBudgets();
 | 
			
		||||
        $total      = $collection->count();
 | 
			
		||||
        $collection->slice($this->pageSize * $this->parameters->get('page'), $this->pageSize);
 | 
			
		||||
        $collection->slice($this->pageXSize * $this->parameters->get('page'), $this->pXageSize);
 | 
			
		||||
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($collection, $total, $this->pageSize, $this->parameters->get('page'));
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($collection, $total, $this->pagXeSize, $this->parameters->get('page'));
 | 
			
		||||
        $transformer = new BudgetTransformer();
 | 
			
		||||
 | 
			
		||||
        return response()
 | 
			
		||||
 
 | 
			
		||||
@@ -65,6 +65,7 @@ class ShowController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function budgeted(DateRequest $request, Budget $budget): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        throw new FireflyException('Needs refactoring, uses deprecated method.');
 | 
			
		||||
        $data      = $request->getAll();
 | 
			
		||||
        $result    = $this->repository->budgetedInPeriodForBudget($budget, $data['start'], $data['end']);
 | 
			
		||||
        $converted = $this->cerSum(array_values($result));
 | 
			
		||||
@@ -79,6 +80,7 @@ class ShowController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function spent(DateRequest $request, Budget $budget): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        throw new FireflyException('Needs refactoring, uses deprecated method.');
 | 
			
		||||
        $data      = $request->getAll();
 | 
			
		||||
        $result    = $this->repository->spentInPeriodForBudget($budget, $data['start'], $data['end']);
 | 
			
		||||
        $converted = $this->cerSum(array_values($result));
 | 
			
		||||
 
 | 
			
		||||
@@ -65,6 +65,7 @@ class SumController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function budgeted(DateRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        throw new FireflyException('Needs refactoring, uses deprecated method.');
 | 
			
		||||
        $data      = $request->getAll();
 | 
			
		||||
        $result    = $this->repository->budgetedInPeriod($data['start'], $data['end']);
 | 
			
		||||
        $converted = $this->cerSum(array_values($result));
 | 
			
		||||
@@ -82,6 +83,7 @@ class SumController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function spent(DateRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        throw new FireflyException('Needs refactoring, uses deprecated method.');
 | 
			
		||||
        $data      = $request->getAll();
 | 
			
		||||
        $result    = $this->repository->spentInPeriod($data['start'], $data['end']);
 | 
			
		||||
        $converted = $this->cerSum(array_values($result));
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\BudgetLimit;
 | 
			
		||||
 | 
			
		||||
use FireflyIII\Api\V2\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Api\V2\Request\Generic\DateRequest;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use FireflyIII\Models\Budget;
 | 
			
		||||
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
 | 
			
		||||
use FireflyIII\Transformers\V2\BudgetLimitTransformer;
 | 
			
		||||
@@ -57,16 +58,18 @@ class ListController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function index(DateRequest $request, Budget $budget): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        throw new FireflyException('Needs refactoring, move to IndexController.');
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        $dates      = $request->getAll();
 | 
			
		||||
        $collection = $this->repository->getBudgetLimits($budget, $dates['start'], $dates['end']);
 | 
			
		||||
        $total      = $collection->count();
 | 
			
		||||
        $collection->slice($this->pageSize * $this->parameters->get('page'), $this->pageSize);
 | 
			
		||||
        $collection->slice($pageSize * $this->parameters->get('page'), $pageSize);
 | 
			
		||||
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($collection, $total, $this->pageSize, $this->parameters->get('page'));
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($collection, $total, $pageSize, $this->parameters->get('page'));
 | 
			
		||||
        $transformer = new BudgetLimitTransformer();
 | 
			
		||||
 | 
			
		||||
        return response()
 | 
			
		||||
            ->api($this->jsonApiList('budget_limits', $paginator, $transformer))
 | 
			
		||||
            ->api($this->jsonApiList('budget-limits', $paginator, $transformer))
 | 
			
		||||
            ->header('Content-Type', self::CONTENT_TYPE);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										74
									
								
								app/Api/V2/Controllers/Model/Currency/IndexController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								app/Api/V2/Controllers/Model/Currency/IndexController.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,74 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * IndexController.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\V2\Controllers\Model\Currency;
 | 
			
		||||
 | 
			
		||||
use FireflyIII\Api\V2\Controllers\Controller;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Transformers\V2\CurrencyTransformer;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Illuminate\Pagination\LengthAwarePaginator;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class IndexController
 | 
			
		||||
 */
 | 
			
		||||
class IndexController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    private CurrencyRepositoryInterface $repository;
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
        $this->middleware(
 | 
			
		||||
            function ($request, $next) {
 | 
			
		||||
                $this->repository = app(CurrencyRepositoryInterface::class);
 | 
			
		||||
 | 
			
		||||
                return $next($request);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * TODO This endpoint is not yet documented.
 | 
			
		||||
     *
 | 
			
		||||
     * Display a listing of the resource.
 | 
			
		||||
     *
 | 
			
		||||
     * @return JsonResponse
 | 
			
		||||
     */
 | 
			
		||||
    public function index(): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $bills       = $this->repository->getAll();
 | 
			
		||||
        $pageSize    = $this->parameters->get('limit');
 | 
			
		||||
        $count       = $bills->count();
 | 
			
		||||
        $bills       = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
 | 
			
		||||
        $transformer = new CurrencyTransformer();
 | 
			
		||||
        $transformer->setParameters($this->parameters); // give params to transformer
 | 
			
		||||
 | 
			
		||||
        return response()
 | 
			
		||||
            ->json($this->jsonApiList('currencies', $paginator, $transformer))
 | 
			
		||||
            ->header('Content-Type', self::CONTENT_TYPE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -37,7 +37,7 @@ use Illuminate\Pagination\LengthAwarePaginator;
 | 
			
		||||
/**
 | 
			
		||||
 * Class ShowController
 | 
			
		||||
 */
 | 
			
		||||
class ShowController extends Controller
 | 
			
		||||
class IndexController extends Controller
 | 
			
		||||
{
 | 
			
		||||
    use ValidatesUserGroupTrait;
 | 
			
		||||
 | 
			
		||||
@@ -70,7 +70,7 @@ class ShowController extends Controller
 | 
			
		||||
    public function index(Request $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $piggies     = $this->repository->getPiggyBanks();
 | 
			
		||||
        $pageSize    = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
 | 
			
		||||
        $pageSize    = $this->parameters->get('limit');
 | 
			
		||||
        $count       = $piggies->count();
 | 
			
		||||
        $piggies     = $piggies->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($piggies, $count, $pageSize, $this->parameters->get('page'));
 | 
			
		||||
@@ -30,7 +30,6 @@ use FireflyIII\Api\V2\Request\Model\Transaction\StoreRequest;
 | 
			
		||||
use FireflyIII\Events\StoredTransactionGroup;
 | 
			
		||||
use FireflyIII\Exceptions\DuplicateTransactionException;
 | 
			
		||||
use FireflyIII\Exceptions\FireflyException;
 | 
			
		||||
use Illuminate\Validation\ValidationException;
 | 
			
		||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
 | 
			
		||||
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
 | 
			
		||||
use FireflyIII\Rules\IsDuplicateTransaction;
 | 
			
		||||
@@ -38,6 +37,7 @@ use FireflyIII\Transformers\V2\TransactionGroupTransformer;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Http\JsonResponse;
 | 
			
		||||
use Illuminate\Support\Facades\Validator;
 | 
			
		||||
use Illuminate\Validation\ValidationException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class StoreController
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ 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\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
 | 
			
		||||
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
 
 | 
			
		||||
@@ -52,30 +52,28 @@ class AccountController extends Controller
 | 
			
		||||
    public function list(ListRequest $request, Account $account): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        // collect transactions:
 | 
			
		||||
        $limit = $request->getLimit();
 | 
			
		||||
        $page     = $request->getPage();
 | 
			
		||||
        $page     = max($page, 1);
 | 
			
		||||
 | 
			
		||||
        if ($limit > 0 && $limit <= $this->pageSize) {
 | 
			
		||||
            $this->pageSize = $limit;
 | 
			
		||||
        }
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /** @var GroupCollectorInterface $collector */
 | 
			
		||||
        $collector = app(GroupCollectorInterface::class);
 | 
			
		||||
        $collector->setAccounts(new Collection([$account]))
 | 
			
		||||
                  ->withAPIInformation()
 | 
			
		||||
                  ->setLimit($this->pageSize)
 | 
			
		||||
                  ->setLimit($pageSize)
 | 
			
		||||
                  ->setPage($page)
 | 
			
		||||
                  ->setTypes($request->getTransactionTypes());
 | 
			
		||||
 | 
			
		||||
        $start = $request->getStartDate();
 | 
			
		||||
        $end   = $request->getEndDate();
 | 
			
		||||
        if (null !== $start) {
 | 
			
		||||
            app('log')->debug(sprintf('Set start date to %s', $start->toIso8601String()));
 | 
			
		||||
            $collector->setStart($start);
 | 
			
		||||
        }
 | 
			
		||||
        if (null !== $end) {
 | 
			
		||||
            $collector->setEnd($start);
 | 
			
		||||
            app('log')->debug(sprintf('Set end date to %s', $start->toIso8601String()));
 | 
			
		||||
            $collector->setEnd($end);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
@@ -83,7 +81,7 @@ class AccountController extends Controller
 | 
			
		||||
            sprintf(
 | 
			
		||||
                '%s?%s',
 | 
			
		||||
                route('api.v2.accounts.transactions', [$account->id]),
 | 
			
		||||
                $request->buildParams()
 | 
			
		||||
                $request->buildParams($pageSize)
 | 
			
		||||
            )
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -42,20 +42,16 @@ class TransactionController extends Controller
 | 
			
		||||
    public function list(ListRequest $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        // collect transactions:
 | 
			
		||||
        $limit = $request->getLimit();
 | 
			
		||||
        $pageSize = $this->parameters->get('limit');
 | 
			
		||||
        $page     = $request->getPage();
 | 
			
		||||
        $page     = max($page, 1);
 | 
			
		||||
 | 
			
		||||
        if ($limit > 0 && $limit <= $this->pageSize) {
 | 
			
		||||
            $this->pageSize = $limit;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /** @var GroupCollectorInterface $collector */
 | 
			
		||||
        $collector = app(GroupCollectorInterface::class);
 | 
			
		||||
        $collector->setUserGroup(auth()->user()->userGroup)
 | 
			
		||||
                  ->withAPIInformation()
 | 
			
		||||
                  ->setLimit($this->pageSize)
 | 
			
		||||
                  ->setLimit($pageSize)
 | 
			
		||||
                  ->setPage($page)
 | 
			
		||||
                  ->setTypes($request->getTransactionTypes());
 | 
			
		||||
 | 
			
		||||
@@ -72,11 +68,12 @@ class TransactionController extends Controller
 | 
			
		||||
        //        exit;
 | 
			
		||||
 | 
			
		||||
        $paginator = $collector->getPaginatedGroups();
 | 
			
		||||
        $params    = $request->buildParams($pageSize);
 | 
			
		||||
        $paginator->setPath(
 | 
			
		||||
            sprintf(
 | 
			
		||||
                '%s?%s',
 | 
			
		||||
                route('api.v2.transactions.list'),
 | 
			
		||||
                $request->buildParams()
 | 
			
		||||
                $params
 | 
			
		||||
            )
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -64,6 +64,7 @@ class ShowController extends Controller
 | 
			
		||||
    public function index(Request $request): JsonResponse
 | 
			
		||||
    {
 | 
			
		||||
        $collection = new Collection();
 | 
			
		||||
        $pageSize   = $this->parameters->get('limit');
 | 
			
		||||
        // if the user has the system owner role, get all. Otherwise, get only the users' groups.
 | 
			
		||||
        if (!auth()->user()->hasRole('owner')) {
 | 
			
		||||
            $collection = $this->repository->get();
 | 
			
		||||
@@ -72,9 +73,9 @@ class ShowController extends Controller
 | 
			
		||||
            $collection = $this->repository->getAll();
 | 
			
		||||
        }
 | 
			
		||||
        $count      = $collection->count();
 | 
			
		||||
        $userGroups = $collection->slice(($this->parameters->get('page') - 1) * $this->pageSize, $this->pageSize);
 | 
			
		||||
        $userGroups = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
 | 
			
		||||
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($userGroups, $count, $this->pageSize, $this->parameters->get('page'));
 | 
			
		||||
        $paginator   = new LengthAwarePaginator($userGroups, $count, $pageSize, $this->parameters->get('page'));
 | 
			
		||||
        $transformer = new UserGroupTransformer();
 | 
			
		||||
        $transformer->setParameters($this->parameters); // give params to transformer
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,6 @@ use FireflyIII\Support\Request\ChecksLogin;
 | 
			
		||||
use FireflyIII\Support\Request\ConvertsDataTypes;
 | 
			
		||||
use FireflyIII\User;
 | 
			
		||||
use Illuminate\Foundation\Http\FormRequest;
 | 
			
		||||
use Illuminate\Validation\Validator;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class AutocompleteRequest
 | 
			
		||||
@@ -38,6 +37,7 @@ class AutocompleteRequest extends FormRequest
 | 
			
		||||
{
 | 
			
		||||
    use ConvertsDataTypes;
 | 
			
		||||
    use ChecksLogin;
 | 
			
		||||
 | 
			
		||||
    protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -75,21 +75,4 @@ class AutocompleteRequest extends FormRequest
 | 
			
		||||
            'limit' => 'min:0|max:1337',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Configure the validator instance with special rules for after the basic validation rules.
 | 
			
		||||
     *
 | 
			
		||||
     * @param Validator $validator
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function withValidator(Validator $validator): void
 | 
			
		||||
    {
 | 
			
		||||
        $validator->after(
 | 
			
		||||
            function (Validator $validator) {
 | 
			
		||||
                // validate if the account can access this administration
 | 
			
		||||
                $this->validateAdministration($validator, [UserRoleEnum::MANAGE_TRANSACTIONS]);
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -43,10 +43,11 @@ class ListRequest extends FormRequest
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function buildParams(): string
 | 
			
		||||
    public function buildParams(int $pageSize): string
 | 
			
		||||
    {
 | 
			
		||||
        $array = [
 | 
			
		||||
            'page'  => $this->getPage(),
 | 
			
		||||
            'limit' => $pageSize,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $start = $this->getStartDate();
 | 
			
		||||
@@ -55,9 +56,6 @@ class ListRequest extends FormRequest
 | 
			
		||||
            $array['start'] = $start->format('Y-m-d');
 | 
			
		||||
            $array['end']   = $end->format('Y-m-d');
 | 
			
		||||
        }
 | 
			
		||||
        if (0 !== $this->getLimit()) {
 | 
			
		||||
            $array['limit'] = $this->getLimit();
 | 
			
		||||
        }
 | 
			
		||||
        return http_build_query($array);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -86,14 +84,6 @@ class ListRequest extends FormRequest
 | 
			
		||||
        return $this->getCarbonDate('end');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return int
 | 
			
		||||
     */
 | 
			
		||||
    public function getLimit(): int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->convertInteger('limit');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -57,6 +57,7 @@ class StoreRequest extends FormRequest
 | 
			
		||||
    use GroupValidation;
 | 
			
		||||
    use CurrencyValidation;
 | 
			
		||||
    use AppendsLocationData;
 | 
			
		||||
 | 
			
		||||
    protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -37,6 +37,7 @@ class StoreRequest extends FormRequest
 | 
			
		||||
{
 | 
			
		||||
    use ChecksLogin;
 | 
			
		||||
    use ConvertsDataTypes;
 | 
			
		||||
 | 
			
		||||
    protected array $acceptedRoles = [UserRoleEnum::OWNER, UserRoleEnum::FULL];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user