mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 20:25:28 +00:00
Compare commits
303 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a08cf6266 | ||
|
|
356876b2b2 | ||
|
|
f5197ec2e0 | ||
|
|
71af5db38e | ||
|
|
45195e6496 | ||
|
|
a56a6df557 | ||
|
|
d7e6a7b125 | ||
|
|
ddabfbc1ad | ||
|
|
944864ed25 | ||
|
|
1c795e71d5 | ||
|
|
7d7e1366a6 | ||
|
|
158a7b1517 | ||
|
|
03f19ec235 | ||
|
|
a82ec20833 | ||
|
|
fb8e238319 | ||
|
|
ab943bf006 | ||
|
|
b15b58f099 | ||
|
|
fee8d962e3 | ||
|
|
4b1eaddfc2 | ||
|
|
c0aca0e021 | ||
|
|
4c3910dc59 | ||
|
|
ec9e8cd672 | ||
|
|
5cbd93bba6 | ||
|
|
30fc0fbf54 | ||
|
|
d26e847d54 | ||
|
|
7c553c1f0b | ||
|
|
eb63163ddf | ||
|
|
6e4adc86b8 | ||
|
|
b46398242f | ||
|
|
db071b1014 | ||
|
|
ebf6b50126 | ||
|
|
ebc498f0ff | ||
|
|
ef4c34a31f | ||
|
|
1d26c12771 | ||
|
|
cb8b49fd7a | ||
|
|
b0e6d12325 | ||
|
|
6da6a68e33 | ||
|
|
a12fd4a3ae | ||
|
|
003d8ba02a | ||
|
|
acb2a8697a | ||
|
|
aff0e4a9df | ||
|
|
b7ba04dacf | ||
|
|
ee6c8786b2 | ||
|
|
4fc19b7eba | ||
|
|
37964a375d | ||
|
|
b8573d03a4 | ||
|
|
b104914076 | ||
|
|
1d30b58685 | ||
|
|
326baa93a7 | ||
|
|
ab9f26f850 | ||
|
|
9a944175ac | ||
|
|
0bcc3240b7 | ||
|
|
1bf3608142 | ||
|
|
9dc971550c | ||
|
|
33c52513a3 | ||
|
|
2408ff11f6 | ||
|
|
3d130e5d99 | ||
|
|
bc0355c5b1 | ||
|
|
b90b13632e | ||
|
|
bad57c907c | ||
|
|
374793eb92 | ||
|
|
8a6ae6105e | ||
|
|
ecda8eebf2 | ||
|
|
f0a5257921 | ||
|
|
860a4bdc0a | ||
|
|
f6ddf72323 | ||
|
|
ec212bb98e | ||
|
|
fd7d37ac23 | ||
|
|
b4cd0d6bbc | ||
|
|
0a5908e4d8 | ||
|
|
59f0631685 | ||
|
|
7718deb4a5 | ||
|
|
75d52b7024 | ||
|
|
ecc72dd01b | ||
|
|
6591512cf6 | ||
|
|
4a0e97e36a | ||
|
|
f90b2d9410 | ||
|
|
582ba0ce5d | ||
|
|
ce411ab9b0 | ||
|
|
d90468db3f | ||
|
|
3a621e6ff7 | ||
|
|
a7ffe66547 | ||
|
|
4a57f4d6dd | ||
|
|
5b72ffa575 | ||
|
|
04a9e2cec2 | ||
|
|
17022c1174 | ||
|
|
59914a9d87 | ||
|
|
a7b9653de3 | ||
|
|
c8dc065e24 | ||
|
|
bac58ad0c2 | ||
|
|
6b2431b054 | ||
|
|
7e212ebd48 | ||
|
|
b3223b90da | ||
|
|
6ea773cdd7 | ||
|
|
997cddcb5a | ||
|
|
8228f76f5d | ||
|
|
b35ee9ccf4 | ||
|
|
16942af52b | ||
|
|
b190ce3538 | ||
|
|
9027915280 | ||
|
|
19aaaef37e | ||
|
|
a3bb90e160 | ||
|
|
06bae0dd8b | ||
|
|
7d48ab5671 | ||
|
|
8588405aa1 | ||
|
|
8238ae7d0a | ||
|
|
78ebec01a4 | ||
|
|
ac1137d7e8 | ||
|
|
212e9b833b | ||
|
|
52ad0ba352 | ||
|
|
318d86a1f5 | ||
|
|
fbffba4c21 | ||
|
|
c7f4e5423a | ||
|
|
5f282a9b7d | ||
|
|
7539ee3560 | ||
|
|
032389c6c0 | ||
|
|
788ac54f86 | ||
|
|
4e0fbc8532 | ||
|
|
5764d9756c | ||
|
|
85e79922ab | ||
|
|
6f3826a6ff | ||
|
|
c061b0b777 | ||
|
|
fc7bbfa8e2 | ||
|
|
0da20c7a1b | ||
|
|
4e2d5fe166 | ||
|
|
70767678ba | ||
|
|
7340e146f1 | ||
|
|
583bc59d23 | ||
|
|
ff5b872fa3 | ||
|
|
28517a8b78 | ||
|
|
34138d1533 | ||
|
|
ccf589f093 | ||
|
|
3ee100e71e | ||
|
|
1e0547a02c | ||
|
|
577e1f1b56 | ||
|
|
a7d25125a7 | ||
|
|
dbb09ef5d1 | ||
|
|
d840c94a29 | ||
|
|
114980480e | ||
|
|
95b1a821f3 | ||
|
|
206397cc81 | ||
|
|
a6b1a6d0c2 | ||
|
|
aba39a3b27 | ||
|
|
b5f095dd91 | ||
|
|
a9e92d4fa6 | ||
|
|
867a2eacd3 | ||
|
|
accecf6a76 | ||
|
|
f12b3bc9b7 | ||
|
|
a2ed755c9c | ||
|
|
235639b728 | ||
|
|
b1d5882fa6 | ||
|
|
39e632d950 | ||
|
|
87ced85657 | ||
|
|
0c53a8db66 | ||
|
|
84dcbaf0e7 | ||
|
|
047440eaea | ||
|
|
217ad0234b | ||
|
|
9795f46bea | ||
|
|
10bc0098b9 | ||
|
|
7a900fd3d9 | ||
|
|
45cfb4e565 | ||
|
|
5320480767 | ||
|
|
3e18e984fa | ||
|
|
fce759e98f | ||
|
|
f4439778f1 | ||
|
|
11176fc212 | ||
|
|
ffc71da2eb | ||
|
|
246fa0d6e4 | ||
|
|
3444146da3 | ||
|
|
5c4a482f64 | ||
|
|
01f84ea11d | ||
|
|
08402babbd | ||
|
|
7ef3dcbd23 | ||
|
|
8836fa205b | ||
|
|
f544a278c5 | ||
|
|
4b8fd6adb9 | ||
|
|
1ac8a9b4ac | ||
|
|
08a8a69b34 | ||
|
|
dbd668bda5 | ||
|
|
cc0760553b | ||
|
|
1142ff6b1f | ||
|
|
927da5d742 | ||
|
|
9a734e48fe | ||
|
|
345fe39b54 | ||
|
|
c7e9d62712 | ||
|
|
5918095f11 | ||
|
|
24612eb634 | ||
|
|
f7125d6198 | ||
|
|
47870cd50c | ||
|
|
45fbf83971 | ||
|
|
6044cffef3 | ||
|
|
4d933e1ef7 | ||
|
|
181e088ad5 | ||
|
|
179b86c3ba | ||
|
|
083c15b956 | ||
|
|
7c780dd75c | ||
|
|
d35d51c014 | ||
|
|
14c6926360 | ||
|
|
bedfcb5c5d | ||
|
|
19461020ef | ||
|
|
36ecf25804 | ||
|
|
0229fc243a | ||
|
|
a2f09b305c | ||
|
|
32d7a0fd1b | ||
|
|
5d3f95762e | ||
|
|
4ca9ee6eec | ||
|
|
9026b0bfd7 | ||
|
|
3d30a5938a | ||
|
|
bcb06779b9 | ||
|
|
26b70f37d6 | ||
|
|
b20a354344 | ||
|
|
753f518f77 | ||
|
|
33d3019ffd | ||
|
|
26e3157ae7 | ||
|
|
b592528318 | ||
|
|
936d55d7de | ||
|
|
6df45fccc5 | ||
|
|
f43ebcce87 | ||
|
|
23fc261a82 | ||
|
|
344db19232 | ||
|
|
5f777845a3 | ||
|
|
f32bdd6c76 | ||
|
|
219c3c11f9 | ||
|
|
b3b367fcb3 | ||
|
|
52a43e7f30 | ||
|
|
04f5098d06 | ||
|
|
9731503826 | ||
|
|
b431351a22 | ||
|
|
089097a41c | ||
|
|
4468fdd76b | ||
|
|
79c70c59e3 | ||
|
|
c8ffc81527 | ||
|
|
048db14a08 | ||
|
|
a9ee07b19a | ||
|
|
e316d9ce6d | ||
|
|
6bf354cf93 | ||
|
|
384ebf9341 | ||
|
|
b2c74ba86a | ||
|
|
0c915de314 | ||
|
|
327e7efa89 | ||
|
|
c361b6cc07 | ||
|
|
59948d6746 | ||
|
|
1d93cf41fd | ||
|
|
8bbbb05adc | ||
|
|
6e314b6a30 | ||
|
|
499b2ca7ef | ||
|
|
77823d3f33 | ||
|
|
88dfb954ca | ||
|
|
ddc229f270 | ||
|
|
8af8cc2c9a | ||
|
|
775492b391 | ||
|
|
1419176094 | ||
|
|
aa0ca5fdcf | ||
|
|
0d61a3ad5d | ||
|
|
bdbb3d9ad1 | ||
|
|
fc73bddd43 | ||
|
|
7515578ba7 | ||
|
|
84b9841886 | ||
|
|
6b66476927 | ||
|
|
7357f19f81 | ||
|
|
f29d8322d5 | ||
|
|
31a3f6f4d8 | ||
|
|
7432a0c5cb | ||
|
|
f6d58191b2 | ||
|
|
89fbf0869a | ||
|
|
b1e453438e | ||
|
|
284c6033d3 | ||
|
|
b85b32560c | ||
|
|
35bc92bb49 | ||
|
|
243a5217e7 | ||
|
|
b2eeeed0af | ||
|
|
afd4700758 | ||
|
|
03a1601bf3 | ||
|
|
edfff4ec57 | ||
|
|
7b5bc3a25e | ||
|
|
d98ca0bb44 | ||
|
|
518b4ba5a7 | ||
|
|
9c1f781be3 | ||
|
|
fa7c1b3ec8 | ||
|
|
89acb9b6f3 | ||
|
|
45971f8f26 | ||
|
|
21f12b87a0 | ||
|
|
d264333ab8 | ||
|
|
0f9c1b9427 | ||
|
|
c273f309d4 | ||
|
|
17fd2f9909 | ||
|
|
0436701f29 | ||
|
|
840632b34e | ||
|
|
764481690c | ||
|
|
66b9d7421b | ||
|
|
a02c1557ac | ||
|
|
ff8af87179 | ||
|
|
9c8b31fdbb | ||
|
|
bda1413da4 | ||
|
|
f1cc8a10f5 | ||
|
|
babf462bcf | ||
|
|
dba24d2dee | ||
|
|
42066cfca2 | ||
|
|
32e550c8e0 | ||
|
|
4f2c94a5a8 | ||
|
|
95076bdb6a | ||
|
|
547caadeb2 | ||
|
|
ded267c9ac |
@@ -69,6 +69,8 @@ DB_PORT=3306
|
||||
DB_DATABASE=firefly
|
||||
DB_USERNAME=firefly
|
||||
DB_PASSWORD=secret_firefly_password
|
||||
# leave empty or omit when not using a socket connection
|
||||
DB_SOCKET=
|
||||
|
||||
# MySQL supports SSL. You can configure it here.
|
||||
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
|
||||
@@ -89,6 +91,9 @@ PGSQL_SSL_CERT=null
|
||||
PGSQL_SSL_KEY=null
|
||||
PGSQL_SSL_CRL_FILE=null
|
||||
|
||||
# more PostgreSQL settings
|
||||
PGSQL_SCHEMA=public
|
||||
|
||||
# If you're looking for performance improvements, you could install memcached or redis
|
||||
CACHE_DRIVER=file
|
||||
SESSION_DRIVER=file
|
||||
|
||||
3
.github/ISSUE_TEMPLATE/bug.yml
vendored
3
.github/ISSUE_TEMPLATE/bug.yml
vendored
@@ -14,8 +14,9 @@ body:
|
||||
label: I've found a bug and checked that ...
|
||||
description: Make sure that your request fulfills all of the following requirements. If one requirement cannot be satisfied, explain in detail why.
|
||||
options:
|
||||
- label: ... the documentation does not mention anything about my problem
|
||||
- label: ... [the documentation](https://docs.firefly-iii.org/) does not mention anything about my problem
|
||||
- label: ... there are no open or closed issues that are related to my problem
|
||||
- label: ... it's [definitely me, not you](https://github.com/firefly-iii/firefly-iii/blob/main/.github/its_you_not_me.md)
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
|
||||
8
.github/dependabot.yml
vendored
8
.github/dependabot.yml
vendored
@@ -19,11 +19,3 @@ updates:
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
# yarn / JS updates for new frontend
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/frontend"
|
||||
target-branch: develop
|
||||
versioning-strategy: increase
|
||||
labels: ["bug"]
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
15
.github/its_you_not_me.md
vendored
Normal file
15
.github/its_you_not_me.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# It's not you, it's me
|
||||
|
||||
Sometimes bugs reported to Firefly III are configuration and system problems on the user side.
|
||||
|
||||
If you run into one of the following problems, there's a good chance it's not a Firefly III issue, but a configuration issue.
|
||||
|
||||
- ⚠️ Can't connect to the database when starting Firefly III
|
||||
- ⚠️ Errors with missing app keys or encryption problems
|
||||
- ⚠️ Can't login due to 419 errors
|
||||
- ⚠️ Any 500 error when starting Firefly III
|
||||
- ⚠️ Any white page when starting Firefly III
|
||||
- ⚠️ Time-out when starting Firefly III for the first time
|
||||
- ⚠️ Firefly III does not work behind your reverse proxy
|
||||
|
||||
If you run into an issue like this, please start a [discussion](https://github.com/firefly-iii/firefly-iii/discussions) or chat on [Gitter.im](https://gitter.im/firefly-iii/firefly-iii). There's a good chance it's not a bug but something we can fix rather quickly :+1:
|
||||
14
.github/mergify.yml
vendored
Normal file
14
.github/mergify.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
pull_request_rules:
|
||||
- name: Security update by dependabot
|
||||
conditions:
|
||||
- author~=^dependabot(|-preview)\[bot\]$
|
||||
actions:
|
||||
merge:
|
||||
method: merge
|
||||
- name: Close all on main
|
||||
conditions:
|
||||
- base=main
|
||||
- -author~=^dependabot(|-preview)\[bot\]$
|
||||
actions:
|
||||
close:
|
||||
message: Please do not open PR's on the `main` branch, but on the `develop` branch only. Thank you!
|
||||
21
.github/workflows/build.yml
vendored
Normal file
21
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Sonarcloud CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
sonarcloud:
|
||||
name: SonarCloud
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarcloud-github-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -15,4 +15,5 @@ yarn-error.log
|
||||
public/google*.html
|
||||
report.html
|
||||
composer.phar
|
||||
app.js.map
|
||||
app.js.map
|
||||
frontend-v3
|
||||
|
||||
13
.mergify.yml
13
.mergify.yml
@@ -1,13 +0,0 @@
|
||||
pull_request_rules:
|
||||
- name: Automatic merge on approval
|
||||
conditions:
|
||||
- "#approved-reviews-by>=1"
|
||||
actions:
|
||||
merge:
|
||||
method: merge
|
||||
- name: Security update by dependabot
|
||||
conditions:
|
||||
- "author=dependabot"
|
||||
actions:
|
||||
merge:
|
||||
method: merge
|
||||
@@ -201,4 +201,70 @@ class ListController extends Controller
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/listTransactionWithoutBudget
|
||||
*
|
||||
* Show all transactions.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
$types = $this->mapTransactionTypes($this->parameters->get('type'));
|
||||
$manager = $this->getManager();
|
||||
|
||||
/** @var User $admin */
|
||||
$admin = auth()->user();
|
||||
|
||||
// use new group collector:
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector
|
||||
->setUser($admin)
|
||||
// filter on budget.
|
||||
->withoutBudget()
|
||||
// all info needed for the API:
|
||||
->withAPIInformation()
|
||||
// set page size:
|
||||
->setLimit($pageSize)
|
||||
// set page to retrieve
|
||||
->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'));
|
||||
}
|
||||
|
||||
$paginator = $collector->getPaginatedGroups();
|
||||
$paginator->setPath(route('api.v1.budgets.without-budget') . $this->buildParams());
|
||||
$transactions = $paginator->getCollection();
|
||||
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
$transformer = app(TransactionGroupTransformer::class);
|
||||
$transformer->setParameters($this->parameters);
|
||||
$resource = new FractalCollection($transactions, $transformer, 'transactions');
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -145,11 +145,11 @@ class TriggerController extends Controller
|
||||
// add a range:
|
||||
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $parameters['end']->format('Y-m-d')]);
|
||||
}
|
||||
if (array_key_exists('accounts', $parameters) && '' !== $parameters['accounts']) {
|
||||
if (array_key_exists('accounts', $parameters) && is_array($parameters['accounts']) && count($parameters['accounts']) > 0) {
|
||||
$ruleEngine->addOperator(['type' => 'account_id', 'value' => implode(',', $parameters['accounts'])]);
|
||||
}
|
||||
|
||||
// file the rule(s)
|
||||
// fire the rule(s)
|
||||
$ruleEngine->fire();
|
||||
|
||||
return response()->json([], 204);
|
||||
|
||||
@@ -75,6 +75,7 @@ class DestroyController extends Controller
|
||||
$this->repository->destroyGroup($transactionGroup);
|
||||
// trigger just after destruction
|
||||
event(new DestroyedTransactionGroup($transactionGroup));
|
||||
app('preferences')->mark();
|
||||
|
||||
return response()->json([], 204);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ class AccountController extends Controller
|
||||
{
|
||||
Log::debug('Now in account search()');
|
||||
$manager = $this->getManager();
|
||||
$query = $request->get('query');
|
||||
$field = $request->get('field');
|
||||
$query = trim((string)$request->get('query'));
|
||||
$field = trim((string)$request->get('field'));
|
||||
$type = $request->get('type') ?? 'all';
|
||||
if ('' === $query || !in_array($field, $this->validFields, true)) {
|
||||
return response(null, 422);
|
||||
|
||||
@@ -54,7 +54,7 @@ class AutocompleteRequest extends FormRequest
|
||||
return [
|
||||
'types' => $array,
|
||||
'query' => $this->string('query'),
|
||||
'date' => $this->date('date'),
|
||||
'date' => $this->getCarbonDate('date'),
|
||||
'limit' => $limit,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ class DateRequest extends FormRequest
|
||||
public function getAll(): array
|
||||
{
|
||||
return [
|
||||
'start' => $this->date('start'),
|
||||
'end' => $this->date('end'),
|
||||
'start' => $this->getCarbonDate('start'),
|
||||
'end' => $this->getCarbonDate('end'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ class ExportRequest extends FormRequest
|
||||
public function getAll(): array
|
||||
{
|
||||
$result = [
|
||||
'start' => $this->date('start') ?? Carbon::now()->subYear(),
|
||||
'end' => $this->date('end') ?? Carbon::now(),
|
||||
'start' => $this->getCarbonDate('start') ?? Carbon::now()->subYear(),
|
||||
'end' => $this->getCarbonDate('end') ?? Carbon::now(),
|
||||
'type' => $this->string('type'),
|
||||
];
|
||||
$parts = explode(',', $this->string('accounts'));
|
||||
|
||||
@@ -58,8 +58,8 @@ class GenericRequest extends FormRequest
|
||||
public function getAll(): array
|
||||
{
|
||||
return [
|
||||
'start' => $this->date('start'),
|
||||
'end' => $this->date('end'),
|
||||
'start' => $this->getCarbonDate('start'),
|
||||
'end' => $this->getCarbonDate('end'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ class GenericRequest extends FormRequest
|
||||
*/
|
||||
public function getEnd(): Carbon
|
||||
{
|
||||
$date = $this->date('end');
|
||||
$date = $this->getCarbonDate('end');
|
||||
$date->endOfDay();
|
||||
|
||||
return $date;
|
||||
@@ -251,7 +251,7 @@ class GenericRequest extends FormRequest
|
||||
*/
|
||||
public function getStart(): Carbon
|
||||
{
|
||||
$date = $this->date('start');
|
||||
$date = $this->getCarbonDate('start');
|
||||
$date->startOfDay();
|
||||
|
||||
return $date;
|
||||
|
||||
@@ -70,7 +70,7 @@ class StoreRequest extends FormRequest
|
||||
'account_number' => $this->string('account_number'),
|
||||
'account_role' => $this->string('account_role'),
|
||||
'opening_balance' => $this->string('opening_balance'),
|
||||
'opening_balance_date' => $this->date('opening_balance_date'),
|
||||
'opening_balance_date' => $this->getCarbonDate('opening_balance_date'),
|
||||
'cc_type' => $this->string('credit_card_type'),
|
||||
'cc_monthly_payment_date' => $this->string('monthly_payment_date'),
|
||||
'notes' => $this->stringWithNewlines('notes'),
|
||||
@@ -82,7 +82,7 @@ class StoreRequest extends FormRequest
|
||||
|
||||
if ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) {
|
||||
$data['opening_balance'] = app('steam')->negative($this->string('liability_amount'));
|
||||
$data['opening_balance_date'] = $this->date('liability_start_date');
|
||||
$data['opening_balance_date'] = $this->getCarbonDate('liability_start_date');
|
||||
$data['account_type_name'] = $this->string('liability_type');
|
||||
$data['liability_direction'] = $this->string('liability_direction');
|
||||
$data['account_type_id'] = null;
|
||||
@@ -116,15 +116,15 @@ class StoreRequest extends FormRequest
|
||||
'currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'active' => [new IsBoolean],
|
||||
'include_net_worth' => [new IsBoolean],
|
||||
'account_role' => sprintf('in:%s|required_if:type,asset', $accountRoles),
|
||||
'credit_card_type' => sprintf('in:%s|required_if:account_role,ccAsset', $ccPaymentTypes),
|
||||
'monthly_payment_date' => 'date' . '|required_if:account_role,ccAsset|required_if:credit_card_type,monthlyFull',
|
||||
'liability_type' => 'required_if:type,liability|required_if:type,liabilities|in:loan,debt,mortgage',
|
||||
'account_role' => sprintf('nullable|in:%s|required_if:type,asset', $accountRoles),
|
||||
'credit_card_type' => sprintf('nullable|in:%s|required_if:account_role,ccAsset', $ccPaymentTypes),
|
||||
'monthly_payment_date' => 'nullable|date|required_if:account_role,ccAsset|required_if:credit_card_type,monthlyFull',
|
||||
'liability_type' => 'nullable|required_if:type,liability|required_if:type,liabilities|in:loan,debt,mortgage',
|
||||
'liability_amount' => 'required_with:liability_start_date|min:0|numeric',
|
||||
'liability_start_date' => 'required_with:liability_amount|date',
|
||||
'liability_direction' => 'required_if:type,liability|required_if:type,liabilities|in:credit,debit',
|
||||
'liability_direction' => 'nullable|required_if:type,liability|required_if:type,liabilities|in:credit,debit',
|
||||
'interest' => 'between:0,100|numeric',
|
||||
'interest_period' => sprintf('in:%s', join(',', config('firefly.interest_periods'))),
|
||||
'interest_period' => sprintf('nullable|in:%s', join(',', config('firefly.interest_periods'))),
|
||||
'notes' => 'min:0|max:65536',
|
||||
];
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ class StoreRequest extends FormRequest
|
||||
public function getAll(): array
|
||||
{
|
||||
return [
|
||||
'start' => $this->date('start'),
|
||||
'end' => $this->date('end'),
|
||||
'start' => $this->getCarbonDate('start'),
|
||||
'end' => $this->getCarbonDate('end'),
|
||||
'amount' => $this->string('amount'),
|
||||
'currency_id' => $this->integer('currency_id'),
|
||||
'currency_code' => $this->string('currency_code'),
|
||||
|
||||
@@ -51,8 +51,8 @@ class StoreRequest extends FormRequest
|
||||
$data['account_id'] = $this->integer('account_id');
|
||||
$data['targetamount'] = $this->string('target_amount');
|
||||
$data['current_amount'] = $this->string('current_amount');
|
||||
$data['startdate'] = $this->date('start_date');
|
||||
$data['targetdate'] = $this->date('target_date');
|
||||
$data['startdate'] = $this->getCarbonDate('start_date');
|
||||
$data['targetdate'] = $this->getCarbonDate('target_date');
|
||||
$data['notes'] = $this->stringWithNewlines('notes');
|
||||
$data['object_group_id'] = $this->integer('object_group_id');
|
||||
$data['object_group_title'] = $this->string('object_group_title');
|
||||
|
||||
@@ -55,7 +55,7 @@ class TriggerRequest extends FormRequest
|
||||
*/
|
||||
private function getDate(string $field): ?Carbon
|
||||
{
|
||||
return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', $this->query($field));
|
||||
return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($this->query($field),0,10));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ class TriggerRequest extends FormRequest
|
||||
*/
|
||||
private function getAccounts(): array
|
||||
{
|
||||
return $this->get('accounts');
|
||||
return $this->get('accounts') ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,6 +53,7 @@ class UpdateRequest extends FormRequest
|
||||
'strict' => ['strict', 'boolean'],
|
||||
'stop_processing' => ['stop_processing', 'boolean'],
|
||||
'active' => ['active', 'boolean'],
|
||||
'order' => ['order', 'integer'],
|
||||
];
|
||||
|
||||
$return = $this->getAllData($fields);
|
||||
@@ -150,6 +151,7 @@ class UpdateRequest extends FormRequest
|
||||
'strict' => [new IsBoolean],
|
||||
'stop_processing' => [new IsBoolean],
|
||||
'active' => [new IsBoolean],
|
||||
'order' => 'numeric|between:1,1337',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class StoreRequest extends FormRequest
|
||||
{
|
||||
$data = [
|
||||
'tag' => $this->string('tag'),
|
||||
'date' => $this->date('date'),
|
||||
'date' => $this->getCarbonDate('date'),
|
||||
'description' => $this->string('description'),
|
||||
'has_location' => true,
|
||||
];
|
||||
|
||||
@@ -137,7 +137,7 @@ class StoreRequest extends FormRequest
|
||||
'original_source' => sprintf('ff3-v%s|api-v%s', config('firefly.version'), config('firefly.api_version')),
|
||||
'recurrence_id' => $this->integerFromValue($object['recurrence_id']),
|
||||
'bunq_payment_id' => $this->clearString((string)$object['bunq_payment_id'], false),
|
||||
'external_uri' => $this->clearString((string)$object['external_uri'], false),
|
||||
'external_url' => $this->clearString((string)$object['external_url'], false),
|
||||
|
||||
'sepa_cc' => $this->clearString((string)$object['sepa_cc'], false),
|
||||
'sepa_ct_op' => $this->clearString((string)$object['sepa_ct_op'], false),
|
||||
@@ -228,7 +228,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_uri' => 'min:1,max:255|nullable|url',
|
||||
'transactions.*.external_url' => 'min:1,max:255|nullable|url',
|
||||
|
||||
// SEPA fields:
|
||||
'transactions.*.sepa_cc' => 'min:1,max:255|nullable',
|
||||
|
||||
@@ -113,7 +113,7 @@ class UpdateRequest extends FormRequest
|
||||
'sepa_ep',
|
||||
'sepa_ci',
|
||||
'sepa_batch_id',
|
||||
'external_uri',
|
||||
'external_url',
|
||||
];
|
||||
$this->booleanFields = [
|
||||
'reconciled',
|
||||
@@ -181,7 +181,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
foreach ($this->integerFields as $fieldName) {
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->integerFromValue((string)$transaction[$fieldName]);
|
||||
$current[$fieldName] = $this->integerFromValue((string) $transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
foreach ($this->stringFields as $fieldName) {
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->clearString((string)$transaction[$fieldName], false);
|
||||
$current[$fieldName] = $this->clearString((string) $transaction[$fieldName], false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
foreach ($this->textareaFields as $fieldName) {
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->clearString((string)$transaction[$fieldName]);
|
||||
$current[$fieldName] = $this->clearString((string) $transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,8 +233,8 @@ class UpdateRequest extends FormRequest
|
||||
foreach ($this->dateFields as $fieldName) {
|
||||
Log::debug(sprintf('Now at date field %s', $fieldName));
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
Log::debug(sprintf('New value: "%s"', (string)$transaction[$fieldName]));
|
||||
$current[$fieldName] = $this->dateFromValue((string)$transaction[$fieldName]);
|
||||
Log::debug(sprintf('New value: "%s"', (string) $transaction[$fieldName]));
|
||||
$current[$fieldName] = $this->dateFromValue((string) $transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
foreach ($this->booleanFields as $fieldName) {
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->convertBoolean((string)$transaction[$fieldName]);
|
||||
$current[$fieldName] = $this->convertBoolean((string) $transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,72 +284,76 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
// basic fields for group:
|
||||
'group_title' => 'between:1,1000',
|
||||
'apply_rules' => [new IsBoolean],
|
||||
'group_title' => 'between:1,1000',
|
||||
'apply_rules' => [new IsBoolean],
|
||||
|
||||
// transaction rules (in array for splits):
|
||||
'transactions.*.type' => 'in:withdrawal,deposit,transfer,opening-balance,reconciliation',
|
||||
'transactions.*.date' => [new IsDateOrTime],
|
||||
'transactions.*.order' => 'numeric|min:0',
|
||||
'transactions.*.type' => 'in:withdrawal,deposit,transfer,opening-balance,reconciliation',
|
||||
'transactions.*.date' => [new IsDateOrTime],
|
||||
'transactions.*.order' => 'numeric|min:0',
|
||||
|
||||
// group id:
|
||||
'transactions.*.transaction_journal_id' => ['nullable', 'numeric', new BelongsUser],
|
||||
|
||||
|
||||
// currency info
|
||||
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.foreign_currency_id' => 'nullable|numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.foreign_currency_code' => 'nullable|min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.foreign_currency_id' => 'nullable|numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.foreign_currency_code' => 'nullable|min:3|max:3|exists:transaction_currencies,code',
|
||||
|
||||
// amount
|
||||
'transactions.*.amount' => 'numeric|gt:0|max:100000000000',
|
||||
'transactions.*.foreign_amount' => 'nullable|numeric|gte:0',
|
||||
'transactions.*.amount' => 'numeric|gt:0|max:100000000000',
|
||||
'transactions.*.foreign_amount' => 'nullable|numeric|gte:0',
|
||||
|
||||
// description
|
||||
'transactions.*.description' => 'nullable|between:1,1000',
|
||||
'transactions.*.description' => 'nullable|between:1,1000',
|
||||
|
||||
// source of transaction
|
||||
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.source_name' => 'between:1,255|nullable',
|
||||
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.source_name' => 'between:1,255|nullable',
|
||||
|
||||
// destination of transaction
|
||||
'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.destination_name' => 'between:1,255|nullable',
|
||||
'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser],
|
||||
'transactions.*.destination_name' => 'between:1,255|nullable',
|
||||
|
||||
// budget, category, bill and piggy
|
||||
'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser],
|
||||
'transactions.*.budget_name' => ['between:1,255', 'nullable', new BelongsUser],
|
||||
'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser],
|
||||
'transactions.*.category_name' => 'between:1,255|nullable',
|
||||
'transactions.*.bill_id' => ['numeric', 'nullable', 'mustExist:bills,id', new BelongsUser],
|
||||
'transactions.*.bill_name' => ['between:1,255', 'nullable', new BelongsUser],
|
||||
'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser],
|
||||
'transactions.*.budget_name' => ['between:1,255', 'nullable', new BelongsUser],
|
||||
'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser],
|
||||
'transactions.*.category_name' => 'between:1,255|nullable',
|
||||
'transactions.*.bill_id' => ['numeric', 'nullable', 'mustExist:bills,id', new BelongsUser],
|
||||
'transactions.*.bill_name' => ['between:1,255', 'nullable', new BelongsUser],
|
||||
|
||||
// other interesting fields
|
||||
'transactions.*.reconciled' => [new IsBoolean],
|
||||
'transactions.*.notes' => 'min:1,max:50000|nullable',
|
||||
'transactions.*.tags' => 'between:0,255',
|
||||
'transactions.*.reconciled' => [new IsBoolean],
|
||||
'transactions.*.notes' => 'min:1,max:50000|nullable',
|
||||
'transactions.*.tags' => 'between:0,255',
|
||||
|
||||
// meta info fields
|
||||
'transactions.*.internal_reference' => 'min:1,max:255|nullable',
|
||||
'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_uri' => 'min:1,max:255|nullable|url',
|
||||
'transactions.*.internal_reference' => 'min:1,max:255|nullable',
|
||||
'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',
|
||||
|
||||
// SEPA fields:
|
||||
'transactions.*.sepa_cc' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_ct_op' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_ct_id' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_db' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_country' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_ep' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_ci' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_batch_id' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_cc' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_ct_op' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_ct_id' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_db' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_country' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_ep' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_ci' => 'min:1,max:255|nullable',
|
||||
'transactions.*.sepa_batch_id' => 'min:1,max:255|nullable',
|
||||
|
||||
// dates
|
||||
'transactions.*.interest_date' => 'date|nullable',
|
||||
'transactions.*.book_date' => 'date|nullable',
|
||||
'transactions.*.process_date' => 'date|nullable',
|
||||
'transactions.*.due_date' => 'date|nullable',
|
||||
'transactions.*.payment_date' => 'date|nullable',
|
||||
'transactions.*.invoice_date' => 'date|nullable',
|
||||
'transactions.*.interest_date' => 'date|nullable',
|
||||
'transactions.*.book_date' => 'date|nullable',
|
||||
'transactions.*.process_date' => 'date|nullable',
|
||||
'transactions.*.due_date' => 'date|nullable',
|
||||
'transactions.*.payment_date' => 'date|nullable',
|
||||
'transactions.*.invoice_date' => 'date|nullable',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -375,6 +379,9 @@ class UpdateRequest extends FormRequest
|
||||
// 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,);
|
||||
|
||||
// validate that the currency fits the source and/or destination account.
|
||||
// validate all account info
|
||||
$this->validateAccountInformationUpdate($validator, $transactionGroup);
|
||||
|
||||
@@ -62,7 +62,7 @@ class CronRequest extends FormRequest
|
||||
$data['force'] = $this->boolean('force');
|
||||
}
|
||||
if ($this->has('date')) {
|
||||
$data['date'] = $this->date('date');
|
||||
$data['date'] = $this->getCarbonDate('date');
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -69,6 +69,7 @@ class CorrectDatabase extends Command
|
||||
'firefly-iii:delete-empty-journals',
|
||||
'firefly-iii:delete-empty-groups',
|
||||
'firefly-iii:fix-account-types',
|
||||
'firefly-iii:fix-ibans',
|
||||
'firefly-iii:fix-account-order',
|
||||
'firefly-iii:rename-meta-fields',
|
||||
'firefly-iii:fix-ob-currencies',
|
||||
|
||||
@@ -72,9 +72,7 @@ class CorrectOpeningBalanceCurrencies extends Command
|
||||
$count = 0;
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($set as $journal) {
|
||||
Log::debug(sprintf('Going to fix journal #%d', $journal->id));
|
||||
$count += $this->correctJournal($journal);
|
||||
Log::debug(sprintf('Done, count is now %d', $count));
|
||||
}
|
||||
|
||||
if ($count > 0) {
|
||||
@@ -100,7 +98,6 @@ class CorrectOpeningBalanceCurrencies extends Command
|
||||
*/
|
||||
private function correctJournal(TransactionJournal $journal): int
|
||||
{
|
||||
Log::debug(sprintf('Going to correct journal #%d', $journal->id));
|
||||
// get the asset account for this opening balance:
|
||||
$account = $this->getAccount($journal);
|
||||
if (null === $account) {
|
||||
@@ -110,9 +107,7 @@ class CorrectOpeningBalanceCurrencies extends Command
|
||||
|
||||
return 0;
|
||||
}
|
||||
Log::debug(sprintf('Found "%s" #%d "%s".', $account->accountType->type, $account->id, $account->name));
|
||||
$currency = $this->getCurrency($account);
|
||||
Log::debug(sprintf('Found currency #%d (%s)', $currency->id, $currency->code));
|
||||
|
||||
// update journal and all transactions:
|
||||
return $this->setCurrency($journal, $currency);
|
||||
@@ -126,20 +121,14 @@ class CorrectOpeningBalanceCurrencies extends Command
|
||||
private function getAccount(TransactionJournal $journal): ?Account
|
||||
{
|
||||
$transactions = $journal->transactions()->get();
|
||||
Log::debug(sprintf('Found %d transactions for journal #%d.', $transactions->count(), $journal->id));
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($transactions as $transaction) {
|
||||
Log::debug(sprintf('Testing transaction #%d', $transaction->id));
|
||||
/** @var Account $account */
|
||||
$account = $transaction->account()->first();
|
||||
if (null !== $account && AccountType::INITIAL_BALANCE !== $account->accountType()->first()->type) {
|
||||
Log::debug(sprintf('Account of transaction #%d is opposite of IB account (%s).', $transaction->id, $account->accountType()->first()->type));
|
||||
|
||||
return $account;
|
||||
}
|
||||
}
|
||||
Log::debug('Found no IB account in transactions of journal.');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -165,10 +154,8 @@ class CorrectOpeningBalanceCurrencies extends Command
|
||||
*/
|
||||
private function setCurrency(TransactionJournal $journal, TransactionCurrency $currency): int
|
||||
{
|
||||
Log::debug('Now in setCurrency');
|
||||
$count = 0;
|
||||
if ((int)$journal->transaction_currency_id !== (int)$currency->id) {
|
||||
Log::debug(sprintf('Currency ID of journal #%d was #%d, now set to #%d', $journal->id, $journal->transaction_currency_id, $currency->id));
|
||||
$journal->transaction_currency_id = $currency->id;
|
||||
$journal->save();
|
||||
$count = 1;
|
||||
@@ -177,15 +164,11 @@ class CorrectOpeningBalanceCurrencies extends Command
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($journal->transactions as $transaction) {
|
||||
if ((int)$transaction->transaction_currency_id !== (int)$currency->id) {
|
||||
Log::debug(
|
||||
sprintf('Currency ID of transaction #%d was #%d, now set to #%d', $transaction->id, $transaction->transaction_currency_id, $currency->id)
|
||||
);
|
||||
$transaction->transaction_currency_id = $currency->id;
|
||||
$transaction->save();
|
||||
$count = 1;
|
||||
}
|
||||
}
|
||||
Log::debug(sprintf('Return %d', $count));
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class CorrectionSkeleton
|
||||
* TODO DONT FORGET TO ADD THIS TO THE DOCKER BUILD
|
||||
*/
|
||||
class CorrectionSkeleton extends Command
|
||||
{
|
||||
|
||||
51
app/Console/Commands/Correction/FixIbans.php
Normal file
51
app/Console/Commands/Correction/FixIbans.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Console\Commands\Correction;
|
||||
|
||||
use FireflyIII\Models\Account;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class FixIbans
|
||||
*/
|
||||
class FixIbans extends Command
|
||||
{
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Removes spaces from IBANs';
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'firefly-iii:fix-ibans';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$accounts = Account::whereNotNull('iban')->get();
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$iban = $account->iban;
|
||||
if (str_contains($iban, ' ')) {
|
||||
|
||||
$iban = app('steam')->filterSpaces((string)$account->iban);
|
||||
if ('' !== $iban) {
|
||||
$account->iban = $iban;
|
||||
$account->save();
|
||||
$this->line(sprintf('Removed spaces from IBAN of account #%d', $account->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,12 @@ class CreateDatabase extends Command
|
||||
$exists = false;
|
||||
$checked = false; // checked for existence of DB?
|
||||
$dsn = sprintf('mysql:host=%s;port=%d;charset=utf8mb4', env('DB_HOST', 'localhost'), env('DB_PORT', '3306'));
|
||||
|
||||
if ('' !== env('DB_SOCKET', '')) {
|
||||
$dsn = sprintf('mysql:unix_socket=%s;charset=utf8mb4', env('DB_SOCKET', ''));
|
||||
}
|
||||
$this->info(sprintf('DSN is %s', $dsn));
|
||||
|
||||
$options = [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
|
||||
@@ -6,6 +6,7 @@ use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class ReportSkeleton
|
||||
* TODO DONT FORGET TO ADD THIS TO THE DOCKER BUILD
|
||||
*/
|
||||
class ReportSkeleton extends Command
|
||||
{
|
||||
|
||||
@@ -74,8 +74,16 @@ class RestoreOAuthKeys extends Command
|
||||
}
|
||||
if ($this->keysInDatabase() && !$this->keysOnDrive()) {
|
||||
Log::debug('Keys are in DB and keys are not on the drive. Restore.');
|
||||
$this->restoreKeysFromDB();
|
||||
$this->line('Restored OAuth keys from database.');
|
||||
$result = $this->restoreKeysFromDB();
|
||||
if(true === $result) {
|
||||
$this->line('Restored OAuth keys from database.');
|
||||
|
||||
return;
|
||||
}
|
||||
Log::warning('Could not restore keys. Will create new ones.');
|
||||
$this->generateKeys();
|
||||
$this->storeKeysInDB();
|
||||
$this->line('Generated and stored new keys.');
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -124,8 +132,8 @@ class RestoreOAuthKeys extends Command
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function restoreKeysFromDB(): void
|
||||
private function restoreKeysFromDB(): bool
|
||||
{
|
||||
OAuthKeys::restoreKeysFromDB();
|
||||
return OAuthKeys::restoreKeysFromDB();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ class UpgradeDatabase extends Command
|
||||
'firefly-iii:unify-group-accounts',
|
||||
'firefly-iii:fix-transaction-types',
|
||||
'firefly-iii:fix-frontpage-accounts',
|
||||
'firefly-iii:fix-ibans',
|
||||
|
||||
// two report commands
|
||||
'firefly-iii:report-empty-objects',
|
||||
@@ -143,11 +144,6 @@ class UpgradeDatabase extends Command
|
||||
$result = Artisan::output();
|
||||
echo $result;
|
||||
|
||||
$this->line('Now installing OAuth2 keys...');
|
||||
Artisan::call('passport:install');
|
||||
$result = Artisan::output();
|
||||
echo $result;
|
||||
|
||||
$this->line('Done!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace FireflyIII\Console\Commands\Upgrade;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class UpgradeSkeleton
|
||||
* Class UpgradeSkeleton.
|
||||
* TODO DONT FORGET TO ADD THIS TO THE DOCKER BUILD
|
||||
*/
|
||||
class UpgradeSkeleton extends Command
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* ActuallyLoggedIn.php
|
||||
* Copyright (c) 2021 james@firefly-iii.org
|
||||
* Copyright (c) 2022 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
@@ -20,6 +20,8 @@ declare(strict_types=1);
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Events;
|
||||
|
||||
use FireflyIII\User;
|
||||
|
||||
@@ -91,6 +91,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
return redirect(route('currencies.index'));
|
||||
case 'budgets.show':
|
||||
case 'budgets.edit':
|
||||
case 'budgets.show.limit':
|
||||
$request->session()->reflash();
|
||||
|
||||
return redirect(route('budgets.index'));
|
||||
|
||||
@@ -365,19 +365,29 @@ class TransactionJournalFactory
|
||||
$this->accountValidator->setTransactionType($transactionType);
|
||||
|
||||
// validate source account.
|
||||
$sourceId = $data['source_id'] ? (int)$data['source_id'] : null;
|
||||
$sourceName = $data['source_name'] ? (string)$data['source_name'] : null;
|
||||
$validSource = $this->accountValidator->validateSource($sourceId, $sourceName, null);
|
||||
$array = [
|
||||
'id' => $data['source_id'] ? (int)$data['source_id'] : null,
|
||||
'name' => $data['source_name'] ? (string)$data['source_name'] : null,
|
||||
'iban' => $data['source_iban'] ? (string)$data['source_iban'] : null,
|
||||
'number' => $data['source_number'] ? (string)$data['source_number'] : null,
|
||||
];
|
||||
$validSource = $this->accountValidator->validateSource($array);
|
||||
|
||||
// do something with result:
|
||||
if (false === $validSource) {
|
||||
throw new FireflyException(sprintf('Source: %s', $this->accountValidator->sourceError));
|
||||
}
|
||||
Log::debug('Source seems valid.');
|
||||
|
||||
// validate destination account
|
||||
$destinationId = $data['destination_id'] ? (int)$data['destination_id'] : null;
|
||||
$destinationName = $data['destination_name'] ? (string)$data['destination_name'] : null;
|
||||
$validDestination = $this->accountValidator->validateDestination($destinationId, $destinationName, null);
|
||||
$array = [
|
||||
'id' => $data['destination_id'] ? (int)$data['destination_id'] : null,
|
||||
'name' => $data['destination_name'] ? (string)$data['destination_name'] : null,
|
||||
'iban' => $data['destination_iban'] ? (string)$data['destination_iban'] : null,
|
||||
'number' => $data['destination_number'] ? (string)$data['destination_number'] : null,
|
||||
];
|
||||
|
||||
$validDestination = $this->accountValidator->validateDestination($array);
|
||||
// do something with result:
|
||||
if (false === $validDestination) {
|
||||
throw new FireflyException(sprintf('Destination: %s', $this->accountValidator->destError));
|
||||
|
||||
@@ -52,7 +52,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$reportType = 'account';
|
||||
$preferredPeriod = $this->preferredPeriod();
|
||||
try {
|
||||
$result = prefixView('reports.double.report', compact('accountIds', 'reportType', 'doubleIds', 'preferredPeriod'))
|
||||
$result = view('reports.double.report', compact('accountIds', 'reportType', 'doubleIds', 'preferredPeriod'))
|
||||
->with('start', $this->start)->with('end', $this->end)
|
||||
->with('doubles', $this->expense)
|
||||
->render();
|
||||
|
||||
@@ -78,7 +78,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
'due_date', 'payment_date', 'invoice_date',
|
||||
];
|
||||
try {
|
||||
$result = prefixView('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
|
||||
$result = view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
|
||||
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
|
||||
->render();
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
|
||||
@@ -64,7 +64,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
|
||||
$budgetIds = implode(',', $this->budgets->pluck('id')->toArray());
|
||||
try {
|
||||
$result = prefixView(
|
||||
$result = view(
|
||||
'reports.budget.month',
|
||||
compact('accountIds', 'budgetIds')
|
||||
)
|
||||
|
||||
@@ -76,7 +76,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
// render!
|
||||
try {
|
||||
return prefixView('reports.category.month', compact('accountIds', 'categoryIds', 'reportType'))
|
||||
return view('reports.category.month', compact('accountIds', 'categoryIds', 'reportType'))
|
||||
->with('start', $this->start)->with('end', $this->end)
|
||||
->with('categories', $this->categories)
|
||||
->with('accounts', $this->accounts)
|
||||
|
||||
@@ -53,7 +53,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$reportType = 'default';
|
||||
|
||||
try {
|
||||
return prefixView('reports.default.month', compact('accountIds', 'reportType'))->with('start', $this->start)->with('end', $this->end)->render();
|
||||
return view('reports.default.month', compact('accountIds', 'reportType'))->with('start', $this->start)->with('end', $this->end)->render();
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
|
||||
$result = 'Could not render report view.';
|
||||
|
||||
@@ -54,7 +54,7 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
|
||||
$reportType = 'default';
|
||||
|
||||
try {
|
||||
return prefixView(
|
||||
return view(
|
||||
'reports.default.multi-year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
|
||||
@@ -54,7 +54,7 @@ class YearReportGenerator implements ReportGeneratorInterface
|
||||
$reportType = 'default';
|
||||
|
||||
try {
|
||||
$result = prefixView(
|
||||
$result = view(
|
||||
'reports.default.year',
|
||||
compact('accountIds', 'reportType')
|
||||
)->with('start', $this->start)->with('end', $this->end)->render();
|
||||
|
||||
@@ -75,7 +75,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
|
||||
// render!
|
||||
try {
|
||||
$result = prefixView(
|
||||
$result = view(
|
||||
'reports.tag.month',
|
||||
compact('accountIds', 'reportType', 'tagIds')
|
||||
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();
|
||||
|
||||
@@ -123,7 +123,6 @@ class UpdatedGroupEventHandler
|
||||
if (1 === $group->transactionJournals->count()) {
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('Correct inconsistent accounts in group #%d', $group->id));
|
||||
// first journal:
|
||||
/** @var TransactionJournal $first */
|
||||
$first = $group->transactionJournals()
|
||||
@@ -132,6 +131,12 @@ class UpdatedGroupEventHandler
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->orderBy('transaction_journals.description', 'DESC')
|
||||
->first();
|
||||
|
||||
if(null === $first) {
|
||||
Log::warning(sprintf('Group #%d has no transaction journals.', $group->id));
|
||||
return;
|
||||
}
|
||||
|
||||
$all = $group->transactionJournals()->get()->pluck('id')->toArray();
|
||||
/** @var Account $sourceAccount */
|
||||
$sourceAccount = $first->transactions()->where('amount', '<', '0')->first()->account;
|
||||
|
||||
@@ -176,7 +176,9 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
return false;
|
||||
}
|
||||
// is allowed? Save the file, without encryption.
|
||||
$this->uploadDisk->put($attachment->fileName(), $content);
|
||||
$parts = explode('/', $attachment->fileName());
|
||||
$file = $parts[count($parts) - 1];
|
||||
$this->uploadDisk->put($file, $content);
|
||||
|
||||
// update attachment.
|
||||
$attachment->md5 = md5_file($path);
|
||||
|
||||
@@ -212,6 +212,40 @@ trait MetaCollection
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function withoutExternalUrl(): GroupCollectorInterface
|
||||
{
|
||||
if (false === $this->hasJoinedMetaTables) {
|
||||
$this->hasJoinedMetaTables = true;
|
||||
$this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id');
|
||||
}
|
||||
$this->query->where(function(Builder $q1) {
|
||||
$q1->where(function(Builder $q2) {
|
||||
$q2->where('journal_meta.name', '=', 'external_url');
|
||||
$q2->whereNull('journal_meta.data');
|
||||
})->orWhereNull('journal_meta.name');
|
||||
});
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function withExternalUrl(): GroupCollectorInterface
|
||||
{
|
||||
if (false === $this->hasJoinedMetaTables) {
|
||||
$this->hasJoinedMetaTables = true;
|
||||
$this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id');
|
||||
}
|
||||
$this->query->where('journal_meta.name', '=', 'external_url');
|
||||
$this->query->whereNotNull('journal_meta.data');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
@@ -119,4 +119,61 @@ trait TimeCollection
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function yearIs(string $year): GroupCollectorInterface
|
||||
{
|
||||
$this->query->whereYear('transaction_journals.date', '=', $year);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function monthIs(string $month): GroupCollectorInterface
|
||||
{
|
||||
$this->query->whereMonth('transaction_journals.date', '=', $month);
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
public function dayIs(string $day): GroupCollectorInterface
|
||||
{
|
||||
$this->query->whereDay('transaction_journals.date', '=', $day);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function yearBefore(string $year): GroupCollectorInterface
|
||||
{
|
||||
$this->query->whereYear('transaction_journals.date', '<=', $year);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function monthBefore(string $month): GroupCollectorInterface
|
||||
{
|
||||
$this->query->whereMonth('transaction_journals.date', '<=', $month);
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
public function dayBefore(string $day): GroupCollectorInterface
|
||||
{
|
||||
$this->query->whereDay('transaction_journals.date', '<=', $day);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function yearAfter(string $year): GroupCollectorInterface
|
||||
{
|
||||
$this->query->whereYear('transaction_journals.date', '>=', $year);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function monthAfter(string $month): GroupCollectorInterface
|
||||
{
|
||||
$this->query->whereMonth('transaction_journals.date', '>=', $month);
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
public function dayAfter(string $day): GroupCollectorInterface
|
||||
{
|
||||
$this->query->whereDay('transaction_journals.date', '>=', $day);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,6 +559,15 @@ class GroupCollector implements GroupCollectorInterface
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function dumpQueryInLogs(): void
|
||||
{
|
||||
Log::debug($this->query->select($this->fields)->toSql()) ;
|
||||
Log::debug('Bindings',$this->query->getBindings());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a selected set of fields to arrays.
|
||||
*
|
||||
|
||||
@@ -305,6 +305,20 @@ interface GroupCollectorInterface
|
||||
*/
|
||||
public function setExternalId(string $externalId): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Transactions without an external URL
|
||||
*
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function withoutExternalUrl(): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Transactions with an external URL
|
||||
*
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function withExternalUrl(): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Limit results to a specific foreign currency.
|
||||
*
|
||||
@@ -565,4 +579,15 @@ interface GroupCollectorInterface
|
||||
*/
|
||||
public function withoutTags(): GroupCollectorInterface;
|
||||
|
||||
|
||||
public function yearIs(string $year): GroupCollectorInterface;
|
||||
public function monthIs(string $month): GroupCollectorInterface;
|
||||
public function dayIs(string $day): GroupCollectorInterface;
|
||||
public function yearBefore(string $year): GroupCollectorInterface;
|
||||
public function monthBefore(string $month): GroupCollectorInterface;
|
||||
public function dayBefore(string $day): GroupCollectorInterface;
|
||||
public function yearAfter(string $year): GroupCollectorInterface;
|
||||
public function monthAfter(string $month): GroupCollectorInterface;
|
||||
public function dayAfter(string $day): GroupCollectorInterface;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Help.php
|
||||
* Copyright (c) 2019 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\Helpers\Help;
|
||||
|
||||
use Cache;
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use Log;
|
||||
use Route;
|
||||
|
||||
/**
|
||||
* Class Help.
|
||||
*/
|
||||
class Help implements HelpInterface
|
||||
{
|
||||
/** @var string The cache key */
|
||||
public const CACHEKEY = 'help_%s_%s';
|
||||
/** @var string The user agent. */
|
||||
protected $userAgent = 'Firefly III v%s';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->userAgent = sprintf($this->userAgent, config('firefly.version'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get from cache.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFromCache(string $route, string $language): string
|
||||
{
|
||||
$line = sprintf(self::CACHEKEY, $route, $language);
|
||||
|
||||
return Cache::get($line);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text from GitHub.
|
||||
*
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
*
|
||||
* @return string
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getFromGitHub(string $route, string $language): string
|
||||
{
|
||||
$uri = sprintf('https://raw.githubusercontent.com/firefly-iii/help/main/%s/%s.md', $language, $route);
|
||||
Log::debug(sprintf('Trying to get %s...', $uri));
|
||||
$opt = ['headers' => ['User-Agent' => $this->userAgent]];
|
||||
$content = '';
|
||||
$statusCode = 500;
|
||||
$client = app(Client::class);
|
||||
try {
|
||||
$res = $client->request('GET', $uri, $opt);
|
||||
$statusCode = $res->getStatusCode();
|
||||
$content = trim($res->getBody()->getContents());
|
||||
} catch (Exception $e) { // @phpstan-ignore-line
|
||||
Log::info($e->getMessage());
|
||||
//Log::info($e->getTraceAsString());
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Status code is %d', $statusCode));
|
||||
|
||||
if ('' !== $content) {
|
||||
Log::debug('Content is longer than zero. Expect something.');
|
||||
$converter = new CommonMarkConverter();
|
||||
$content = (string)$converter->convertToHtml($content);
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do we have the route?
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $route
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRoute(string $route): bool
|
||||
{
|
||||
return Route::has($route);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is in cache?
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function inCache(string $route, string $language): bool
|
||||
{
|
||||
$line = sprintf(self::CACHEKEY, $route, $language);
|
||||
$result = Cache::has($line);
|
||||
if ($result) {
|
||||
Log::debug(sprintf('Cache has this entry: %s', 'help.' . $route . '.' . $language));
|
||||
}
|
||||
if (!$result) {
|
||||
Log::debug(sprintf('Cache does not have this entry: %s', 'help.' . $route . '.' . $language));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put help text in cache.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
* @param string $content
|
||||
*/
|
||||
public function putInCache(string $route, string $language, string $content): void
|
||||
{
|
||||
$key = sprintf(self::CACHEKEY, $route, $language);
|
||||
if ('' !== $content) {
|
||||
Log::debug(sprintf('Will store entry in cache: %s', $key));
|
||||
Cache::put($key, $content, 10080); // a week.
|
||||
|
||||
return;
|
||||
}
|
||||
Log::info(sprintf('Will not cache %s because content is empty.', $key));
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* HelpInterface.php
|
||||
* Copyright (c) 2019 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\Helpers\Help;
|
||||
|
||||
/**
|
||||
* Interface HelpInterface.
|
||||
*/
|
||||
interface HelpInterface
|
||||
{
|
||||
/**
|
||||
* Get the help text from cache.
|
||||
*
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFromCache(string $route, string $language): string;
|
||||
|
||||
/**
|
||||
* Get the help text from GitHub.
|
||||
*
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFromGitHub(string $route, string $language): string;
|
||||
|
||||
/**
|
||||
* Is the route a known route?
|
||||
*
|
||||
* @param string $route
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRoute(string $route): bool;
|
||||
|
||||
/**
|
||||
* Is the help text in cache?
|
||||
*
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function inCache(string $route, string $language): bool;
|
||||
|
||||
/**
|
||||
* Put the result in cache.
|
||||
*
|
||||
* @param string $route
|
||||
* @param string $language
|
||||
* @param string $content
|
||||
*/
|
||||
public function putInCache(string $route, string $language, string $content);
|
||||
}
|
||||
@@ -38,9 +38,16 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function generate(WebhookMessage $message): string
|
||||
{
|
||||
// webhook is deleted
|
||||
if (null === $message->webhook) {
|
||||
throw new FireflyException('Part of a deleted webhook.');
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$json = json_encode($message->message, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
@@ -48,7 +55,7 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface
|
||||
Log::error(sprintf('JSON value: %s', $message->message));
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
throw new FireflyException('Could not generate JSON for SHA3 hash.', $e);
|
||||
throw new FireflyException('Could not generate JSON for SHA3 hash.', 0, $e);
|
||||
}
|
||||
|
||||
// signature v1 is generated using the following structure:
|
||||
|
||||
@@ -124,7 +124,7 @@ class CreateController extends Controller
|
||||
$request->session()->forget('accounts.create.fromStore');
|
||||
Log::channel('audit')->info('Creating new account.');
|
||||
|
||||
return prefixView(
|
||||
return view(
|
||||
'accounts.create',
|
||||
compact('subTitleIcon', 'liabilityDirections', 'locations', 'objectType', 'interestPeriods', 'subTitle', 'roles', 'liabilityTypes')
|
||||
);
|
||||
|
||||
@@ -84,7 +84,7 @@ class DeleteController extends Controller
|
||||
// put previous url in session
|
||||
$this->rememberPreviousUri('accounts.delete.uri');
|
||||
|
||||
return prefixView('accounts.delete', compact('account', 'subTitle', 'accountList', 'objectType'));
|
||||
return view('accounts.delete', compact('account', 'subTitle', 'accountList', 'objectType'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,7 +122,7 @@ class EditController extends Controller
|
||||
}
|
||||
$request->session()->forget('accounts.edit.fromUpdate');
|
||||
|
||||
$openingBalanceAmount = app('steam')->positive((string)$repository->getOpeningBalanceAmount($account));
|
||||
$openingBalanceAmount = (string)$repository->getOpeningBalanceAmount($account);
|
||||
if ('0' === $openingBalanceAmount) {
|
||||
$openingBalanceAmount = '';
|
||||
}
|
||||
@@ -143,9 +143,9 @@ class EditController extends Controller
|
||||
'BIC' => $repository->getMetaValue($account, 'BIC'),
|
||||
'opening_balance_date' => $openingBalanceDate,
|
||||
'liability_type_id' => $account->account_type_id,
|
||||
'opening_balance' => $openingBalanceAmount,
|
||||
'opening_balance' => number_format((float)$openingBalanceAmount, $currency->decimal_places,'.',''),
|
||||
'liability_direction' => $this->repository->getMetaValue($account, 'liability_direction'),
|
||||
'virtual_balance' => $account->virtual_balance,
|
||||
'virtual_balance' => number_format((float)$account->virtual_balance, $currency->decimal_places,'.',''),
|
||||
'currency_id' => $currency->id,
|
||||
'include_net_worth' => $includeNetWorth,
|
||||
'interest' => $repository->getMetaValue($account, 'interest'),
|
||||
@@ -153,10 +153,13 @@ class EditController extends Controller
|
||||
'notes' => $this->repository->getNoteText($account),
|
||||
'active' => $hasOldInput ? (bool)$request->old('active') : $account->active,
|
||||
];
|
||||
if('' === $openingBalanceAmount) {
|
||||
$preFilled['opening_balance'] = '';
|
||||
}
|
||||
|
||||
$request->session()->flash('preFilled', $preFilled);
|
||||
|
||||
return prefixView(
|
||||
return view(
|
||||
'accounts.edit',
|
||||
compact(
|
||||
'account',
|
||||
|
||||
@@ -109,6 +109,7 @@ class IndexController extends Controller
|
||||
$account->interestPeriod = (string)trans(sprintf('firefly.interest_calc_%s', $this->repository->getMetaValue($account, 'interest_period')));
|
||||
$account->accountTypeString = (string)trans(sprintf('firefly.account_type_%s', $account->accountType->type));
|
||||
$account->current_debt = '0';
|
||||
$account->iban = implode(' ', str_split((string)$account->iban, 4));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -116,7 +117,7 @@ class IndexController extends Controller
|
||||
$accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
|
||||
$accounts->setPath(route('accounts.inactive.index', [$objectType]));
|
||||
|
||||
return prefixView('accounts.index', compact('objectType', 'inactivePage', 'subTitleIcon', 'subTitle', 'page', 'accounts'));
|
||||
return view('accounts.index', compact('objectType', 'inactivePage', 'subTitleIcon', 'subTitle', 'page', 'accounts'));
|
||||
|
||||
}
|
||||
|
||||
@@ -175,6 +176,7 @@ class IndexController extends Controller
|
||||
$account->location = $this->repository->getLocation($account);
|
||||
$account->liability_direction = $this->repository->getMetaValue($account, 'liability_direction');
|
||||
$account->current_debt = $this->repository->getMetaValue($account, 'current_debt') ?? '-';
|
||||
$account->iban = implode(' ', str_split((string)$account->iban, 4));
|
||||
}
|
||||
);
|
||||
// make paginator:
|
||||
@@ -186,6 +188,6 @@ class IndexController extends Controller
|
||||
Log::debug(sprintf('Count of accounts after LAP (1): %d', $accounts->count()));
|
||||
Log::debug(sprintf('Count of accounts after LAP (2): %d', $accounts->getCollection()->count()));
|
||||
|
||||
return prefixView('accounts.index', compact('objectType', 'inactiveCount', 'subTitleIcon', 'subTitle', 'page', 'accounts'));
|
||||
return view('accounts.index', compact('objectType', 'inactiveCount', 'subTitleIcon', 'subTitle', 'page', 'accounts'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class ReconcileController extends Controller
|
||||
$indexUri = route('accounts.reconcile', [$account->id, '%start%', '%end%']);
|
||||
$objectType = 'asset';
|
||||
|
||||
return prefixView(
|
||||
return view(
|
||||
'accounts.reconcile.index',
|
||||
compact(
|
||||
'account',
|
||||
|
||||
@@ -135,7 +135,7 @@ class ShowController extends Controller
|
||||
$showAll = false;
|
||||
$balance = app('steam')->balance($account, $end);
|
||||
|
||||
return prefixView(
|
||||
return view(
|
||||
'accounts.show',
|
||||
compact(
|
||||
'account',
|
||||
@@ -194,7 +194,7 @@ class ShowController extends Controller
|
||||
$showAll = true;
|
||||
$balance = app('steam')->balance($account, $end);
|
||||
|
||||
return prefixView(
|
||||
return view(
|
||||
'accounts.show',
|
||||
compact(
|
||||
'account',
|
||||
|
||||
@@ -75,7 +75,7 @@ class ConfigurationController extends Controller
|
||||
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
|
||||
$siteOwner = config('firefly.site_owner');
|
||||
|
||||
return prefixView(
|
||||
return view(
|
||||
'admin.configuration.index',
|
||||
compact('subTitle', 'subTitleIcon', 'singleUserMode', 'isDemoSite', 'siteOwner')
|
||||
);
|
||||
|
||||
@@ -68,7 +68,7 @@ class HomeController extends Controller
|
||||
}
|
||||
Log::debug('Email is ', [$email]);
|
||||
|
||||
return prefixView('admin.index', compact('title', 'mainTitleIcon', 'email'));
|
||||
return view('admin.index', compact('title', 'mainTitleIcon', 'email'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,7 @@ class LinkController extends Controller
|
||||
$this->rememberPreviousUri('link-types.create.uri');
|
||||
}
|
||||
|
||||
return prefixView('admin.link.create', compact('subTitle', 'subTitleIcon'));
|
||||
return view('admin.link.create', compact('subTitle', 'subTitleIcon'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ class LinkController extends Controller
|
||||
// put previous url in session
|
||||
$this->rememberPreviousUri('link-types.delete.uri');
|
||||
|
||||
return prefixView('admin.link.delete', compact('linkType', 'subTitle', 'moveTo', 'count'));
|
||||
return view('admin.link.delete', compact('linkType', 'subTitle', 'moveTo', 'count'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ class LinkController extends Controller
|
||||
}
|
||||
$request->session()->forget('link-types.edit.fromUpdate');
|
||||
|
||||
return prefixView('admin.link.edit', compact('subTitle', 'subTitleIcon', 'linkType'));
|
||||
return view('admin.link.edit', compact('subTitle', 'subTitleIcon', 'linkType'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +186,7 @@ class LinkController extends Controller
|
||||
}
|
||||
);
|
||||
|
||||
return prefixView('admin.link.index', compact('subTitle', 'subTitleIcon', 'linkTypes'));
|
||||
return view('admin.link.index', compact('subTitle', 'subTitleIcon', 'linkTypes'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,7 +204,7 @@ class LinkController extends Controller
|
||||
|
||||
Log::channel('audit')->info(sprintf('User viewing link type #%d', $linkType->id));
|
||||
|
||||
return prefixView('admin.link.show', compact('subTitle', 'subTitleIcon', 'linkType', 'links'));
|
||||
return view('admin.link.show', compact('subTitle', 'subTitleIcon', 'linkType', 'links'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,7 +82,7 @@ class UpdateController extends Controller
|
||||
'alpha' => (string)trans('firefly.update_channel_alpha'),
|
||||
];
|
||||
|
||||
return prefixView('admin.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options', 'channelSelected', 'channelOptions'));
|
||||
return view('admin.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options', 'channelSelected', 'channelOptions'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,7 @@ class UserController extends Controller
|
||||
|
||||
$subTitle = (string)trans('firefly.delete_user', ['email' => $user->email]);
|
||||
|
||||
return prefixView('admin.users.delete', compact('user', 'subTitle'));
|
||||
return view('admin.users.delete', compact('user', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +132,7 @@ class UserController extends Controller
|
||||
'email_changed' => (string)trans('firefly.block_code_email_changed'),
|
||||
];
|
||||
|
||||
return prefixView('admin.users.edit', compact('user', 'canEditDetails', 'subTitle', 'subTitleIcon', 'codes', 'currentUser', 'isAdmin'));
|
||||
return view('admin.users.edit', compact('user', 'canEditDetails', 'subTitle', 'subTitleIcon', 'codes', 'currentUser', 'isAdmin'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,7 +154,7 @@ class UserController extends Controller
|
||||
}
|
||||
);
|
||||
|
||||
return prefixView('admin.users.index', compact('subTitle', 'subTitleIcon', 'users'));
|
||||
return view('admin.users.index', compact('subTitle', 'subTitleIcon', 'users'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ class UserController extends Controller
|
||||
$subTitleIcon = 'fa-user';
|
||||
$information = $this->repository->getUserData($user);
|
||||
|
||||
return prefixView(
|
||||
return view(
|
||||
'admin.users.show',
|
||||
compact(
|
||||
'title',
|
||||
|
||||
@@ -79,7 +79,7 @@ class AttachmentController extends Controller
|
||||
// put previous url in session
|
||||
$this->rememberPreviousUri('attachments.delete.uri');
|
||||
|
||||
return prefixView('attachments.delete', compact('attachment', 'subTitle'));
|
||||
return view('attachments.delete', compact('attachment', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,7 +158,7 @@ class AttachmentController extends Controller
|
||||
];
|
||||
$request->session()->flash('preFilled', $preFilled);
|
||||
|
||||
return prefixView('attachments.edit', compact('attachment', 'subTitleIcon', 'subTitle'));
|
||||
return view('attachments.edit', compact('attachment', 'subTitleIcon', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,7 +177,7 @@ class AttachmentController extends Controller
|
||||
}
|
||||
);
|
||||
|
||||
return prefixView('attachments.index', compact('set'));
|
||||
return view('attachments.index', compact('set'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,7 +75,7 @@ class ForgotPasswordController extends Controller
|
||||
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);
|
||||
Log::error($message);
|
||||
|
||||
return prefixView('error', compact('message'));
|
||||
return view('error', compact('message'));
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ class ForgotPasswordController extends Controller
|
||||
if ('eloquent' !== $loginProvider) {
|
||||
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);
|
||||
|
||||
return prefixView('error', compact('message'));
|
||||
return view('error', compact('message'));
|
||||
}
|
||||
|
||||
// is allowed to?
|
||||
@@ -129,6 +129,6 @@ class ForgotPasswordController extends Controller
|
||||
$allowRegistration = false;
|
||||
}
|
||||
|
||||
return prefixView('auth.passwords.email')->with(compact('allowRegistration', 'pageTitle'));
|
||||
return view('auth.passwords.email')->with(compact('allowRegistration', 'pageTitle'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ class LoginController extends Controller
|
||||
}
|
||||
$usernameField = $this->username();
|
||||
|
||||
return prefixView('auth.login', compact('allowRegistration', 'email', 'remember', 'ldapWarning', 'allowReset', 'title', 'usernameField'));
|
||||
return view('auth.login', compact('allowRegistration', 'email', 'remember', 'ldapWarning', 'allowReset', 'title', 'usernameField'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -148,12 +148,12 @@ class RegisterController extends Controller
|
||||
if (false === $allowRegistration) {
|
||||
$message = 'Registration is currently not available.';
|
||||
|
||||
return prefixView('error', compact('message'));
|
||||
return view('error', compact('message'));
|
||||
}
|
||||
|
||||
$email = $request->old('email');
|
||||
|
||||
return prefixView('auth.register', compact('isDemoSite', 'email', 'pageTitle'));
|
||||
return view('auth.register', compact('isDemoSite', 'email', 'pageTitle'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class ResetPasswordController extends Controller
|
||||
if ('eloquent' !== $loginProvider) {
|
||||
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);
|
||||
|
||||
return prefixView('error', compact('message'));
|
||||
return view('error', compact('message'));
|
||||
}
|
||||
$rules = [
|
||||
'token' => 'required',
|
||||
@@ -130,7 +130,7 @@ class ResetPasswordController extends Controller
|
||||
if ('eloquent' !== $loginProvider) {
|
||||
$message = sprintf('Cannot reset password when authenticating over "%s".', $loginProvider);
|
||||
|
||||
return prefixView('error', compact('message'));
|
||||
return view('error', compact('message'));
|
||||
}
|
||||
|
||||
// is allowed to register?
|
||||
@@ -143,7 +143,7 @@ class ResetPasswordController extends Controller
|
||||
}
|
||||
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
return prefixView('auth.passwords.reset')->with(
|
||||
return view('auth.passwords.reset')->with(
|
||||
['token' => $token, 'email' => $request->email, 'allowRegistration' => $allowRegistration, 'pageTitle' => $pageTitle]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class TwoFactorController extends Controller
|
||||
$siteOwner = config('firefly.site_owner');
|
||||
$title = (string)trans('firefly.two_factor_forgot_title');
|
||||
|
||||
return prefixView('auth.lost-two-factor', compact('user', 'siteOwner', 'title'));
|
||||
return view('auth.lost-two-factor', compact('user', 'siteOwner', 'title'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -88,7 +88,7 @@ class CreateController extends Controller
|
||||
}
|
||||
$request->session()->forget('bills.create.fromStore');
|
||||
|
||||
return prefixView('bills.create', compact('periods', 'subTitle', 'defaultCurrency'));
|
||||
return view('bills.create', compact('periods', 'subTitle', 'defaultCurrency'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,7 +75,7 @@ class DeleteController extends Controller
|
||||
$this->rememberPreviousUri('bills.delete.uri');
|
||||
$subTitle = (string)trans('firefly.delete_bill', ['name' => $bill->name]);
|
||||
|
||||
return prefixView('bills.delete', compact('bill', 'subTitle'));
|
||||
return view('bills.delete', compact('bill', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,7 @@ class EditController extends Controller
|
||||
$request->session()->flash('preFilled', $preFilled);
|
||||
$request->session()->forget('bills.edit.fromUpdate');
|
||||
|
||||
return prefixView('bills.edit', compact('subTitle', 'periods', 'rules', 'bill', 'defaultCurrency', 'preFilled'));
|
||||
return view('bills.edit', compact('subTitle', 'periods', 'rules', 'bill', 'defaultCurrency', 'preFilled'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -137,7 +137,7 @@ class IndexController extends Controller
|
||||
$sums = $this->getSums($bills);
|
||||
$totals = $this->getTotals($sums);
|
||||
|
||||
return prefixView('bills.index', compact('bills', 'sums', 'total', 'totals'));
|
||||
return view('bills.index', compact('bills', 'sums', 'total', 'totals'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,6 +203,7 @@ class IndexController extends Controller
|
||||
'quarterly' => '4',
|
||||
'monthly' => '12',
|
||||
'weekly' => '52.17',
|
||||
'daily' => '365.24',
|
||||
];
|
||||
$yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
|
||||
Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
|
||||
|
||||
@@ -179,7 +179,7 @@ class ShowController extends Controller
|
||||
}
|
||||
|
||||
|
||||
return prefixView('bills.show', compact('attachments', 'groups', 'rules', 'yearAverage', 'overallAverage', 'year', 'object', 'bill', 'subTitle'));
|
||||
return view('bills.show', compact('attachments', 'groups', 'rules', 'yearAverage', 'overallAverage', 'year', 'object', 'bill', 'subTitle'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class AvailableBudgetController extends Controller
|
||||
}
|
||||
$page = (int)($request->get('page') ?? 1);
|
||||
|
||||
return prefixView('budgets.available-budgets.create', compact('start', 'end', 'page', 'currency'));
|
||||
return view('budgets.available-budgets.create', compact('start', 'end', 'page', 'currency'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +130,7 @@ class AvailableBudgetController extends Controller
|
||||
);
|
||||
$page = (int)($request->get('page') ?? 1);
|
||||
|
||||
return prefixView('budgets.available-budgets.create-alternative', compact('start', 'end', 'page', 'currencies'));
|
||||
return view('budgets.available-budgets.create-alternative', compact('start', 'end', 'page', 'currencies'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,7 +164,7 @@ class AvailableBudgetController extends Controller
|
||||
{
|
||||
$availableBudget->amount = number_format((float)$availableBudget->amount, $availableBudget->transactionCurrency->decimal_places, '.', '');
|
||||
|
||||
return prefixView('budgets.available-budgets.edit', compact('availableBudget', 'start', 'end'));
|
||||
return view('budgets.available-budgets.edit', compact('availableBudget', 'start', 'end'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -103,7 +103,7 @@ class BudgetLimitController extends Controller
|
||||
}
|
||||
);
|
||||
|
||||
return prefixView('budgets.budget-limits.create', compact('start', 'end', 'currencies', 'budget'));
|
||||
return view('budgets.budget-limits.create', compact('start', 'end', 'currencies', 'budget'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,7 +181,7 @@ class BudgetLimitController extends Controller
|
||||
return response()->json($array);
|
||||
}
|
||||
|
||||
return response()->json([]);
|
||||
return redirect(route('budgets.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -103,7 +103,7 @@ class CreateController extends Controller
|
||||
$request->session()->forget('budgets.create.fromStore');
|
||||
$subTitle = (string)trans('firefly.create_new_budget');
|
||||
|
||||
return prefixView('budgets.create', compact('subTitle', 'autoBudgetTypes', 'autoBudgetPeriods'));
|
||||
return view('budgets.create', compact('subTitle', 'autoBudgetTypes', 'autoBudgetPeriods'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,7 +75,7 @@ class DeleteController extends Controller
|
||||
// put previous url in session
|
||||
$this->rememberPreviousUri('budgets.delete.uri');
|
||||
|
||||
return prefixView('budgets.delete', compact('budget', 'subTitle'));
|
||||
return view('budgets.delete', compact('budget', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -102,7 +102,8 @@ class EditController extends Controller
|
||||
'auto_budget_currency_id' => $hasOldInput ? (int)$request->old('auto_budget_currency_id') : $currency->id,
|
||||
];
|
||||
if ($autoBudget) {
|
||||
$preFilled['auto_budget_amount'] = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount;
|
||||
$amount = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount;
|
||||
$preFilled['auto_budget_amount'] = number_format((float)$amount, $autoBudget->transactionCurrency->decimal_places, '.', '');
|
||||
}
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
@@ -112,7 +113,7 @@ class EditController extends Controller
|
||||
$request->session()->forget('budgets.edit.fromUpdate');
|
||||
$request->session()->flash('preFilled', $preFilled);
|
||||
|
||||
return prefixView('budgets.edit', compact('budget', 'subTitle', 'autoBudgetTypes', 'autoBudgetPeriods', 'autoBudget'));
|
||||
return view('budgets.edit', compact('budget', 'subTitle', 'autoBudgetTypes', 'autoBudgetPeriods', 'autoBudget'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -136,7 +136,7 @@ class IndexController extends Controller
|
||||
// get all inactive budgets, and simply list them:
|
||||
$inactive = $this->repository->getInactiveBudgets();
|
||||
|
||||
return prefixView(
|
||||
return view(
|
||||
'budgets.index', compact(
|
||||
'availableBudgets', 'budgeted', 'spent', 'prevLoop', 'nextLoop', 'budgets', 'currencies', 'enableAddButton', 'periodTitle',
|
||||
'defaultCurrency', 'activeDaysPassed', 'activeDaysLeft', 'inactive', 'budgets', 'start', 'end', 'sums'
|
||||
|
||||
@@ -105,7 +105,7 @@ class ShowController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('budgets.no-budget'));
|
||||
|
||||
return prefixView('budgets.no-budget', compact('groups', 'subTitle', 'periods', 'start', 'end'));
|
||||
return view('budgets.no-budget', compact('groups', 'subTitle', 'periods', 'start', 'end'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +133,7 @@ class ShowController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('budgets.no-budget'));
|
||||
|
||||
return prefixView('budgets.no-budget', compact('groups', 'subTitle', 'start', 'end'));
|
||||
return view('budgets.no-budget', compact('groups', 'subTitle', 'start', 'end'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +167,7 @@ class ShowController extends Controller
|
||||
|
||||
$subTitle = (string)trans('firefly.all_journals_for_budget', ['name' => $budget->name]);
|
||||
|
||||
return prefixView('budgets.show', compact('limits', 'attachments', 'budget', 'repetition', 'groups', 'subTitle'));
|
||||
return view('budgets.show', compact('limits', 'attachments', 'budget', 'repetition', 'groups', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,6 +212,6 @@ class ShowController extends Controller
|
||||
$attachments = $this->repository->getAttachments($budget);
|
||||
$limits = $this->getLimits($budget, $start, $end);
|
||||
|
||||
return prefixView('budgets.show', compact('limits', 'attachments', 'budget', 'budgetLimit', 'groups', 'subTitle'));
|
||||
return view('budgets.show', compact('limits', 'attachments', 'budget', 'budgetLimit', 'groups', 'subTitle'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class CreateController extends Controller
|
||||
$request->session()->forget('categories.create.fromStore');
|
||||
$subTitle = (string)trans('firefly.create_new_category');
|
||||
|
||||
return prefixView('categories.create', compact('subTitle'));
|
||||
return view('categories.create', compact('subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,7 +74,7 @@ class DeleteController extends Controller
|
||||
// put previous url in session
|
||||
$this->rememberPreviousUri('categories.delete.uri');
|
||||
|
||||
return prefixView('categories.delete', compact('category', 'subTitle'));
|
||||
return view('categories.delete', compact('category', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,7 +86,7 @@ class EditController extends Controller
|
||||
'notes' => $request->old('notes') ?? $this->repository->getNoteText($category),
|
||||
];
|
||||
|
||||
return prefixView('categories.edit', compact('category', 'subTitle', 'preFilled'));
|
||||
return view('categories.edit', compact('category', 'subTitle', 'preFilled'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,7 +87,7 @@ class IndexController extends Controller
|
||||
$categories = new LengthAwarePaginator($collection, $total, $pageSize, $page);
|
||||
$categories->setPath(route('categories.index'));
|
||||
|
||||
return prefixView('categories.index', compact('categories'));
|
||||
return view('categories.index', compact('categories'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class NoCategoryController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('categories.no-category'));
|
||||
|
||||
return prefixView('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));
|
||||
return view('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,6 +139,6 @@ class NoCategoryController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('categories.no-category.all'));
|
||||
|
||||
return prefixView('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));
|
||||
return view('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ class ShowController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath($path);
|
||||
|
||||
return prefixView('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
return view('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,6 +146,6 @@ class ShowController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath($path);
|
||||
|
||||
return prefixView('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
return view('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
@@ -93,7 +94,7 @@ class CurrencyController extends Controller
|
||||
|
||||
Log::channel('audit')->info('Create new currency.');
|
||||
|
||||
return prefixView('currencies.create', compact('subTitleIcon', 'subTitle'));
|
||||
return view('currencies.create', compact('subTitleIcon', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +161,7 @@ class CurrencyController extends Controller
|
||||
$subTitle = (string)trans('form.delete_currency', ['name' => $currency->name]);
|
||||
Log::channel('audit')->info(sprintf('Visit page to delete currency %s.', $currency->code));
|
||||
|
||||
return prefixView('currencies.delete', compact('currency', 'subTitle'));
|
||||
return view('currencies.delete', compact('currency', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,10 +211,9 @@ class CurrencyController extends Controller
|
||||
* @param Request $request
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function disableCurrency(Request $request)
|
||||
public function disableCurrency(Request $request): JsonResponse
|
||||
{
|
||||
$currencyId = (int)$request->get('id');
|
||||
if ($currencyId > 0) {
|
||||
@@ -228,8 +228,7 @@ class CurrencyController extends Controller
|
||||
|
||||
$request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));
|
||||
Log::channel('audit')->info(sprintf('Tried to disable currency %s but is not site owner.', $currency->code));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
return response()->json([]);
|
||||
|
||||
}
|
||||
|
||||
@@ -240,8 +239,7 @@ class CurrencyController extends Controller
|
||||
|
||||
$request->session()->flash('error', $message);
|
||||
Log::channel('audit')->info(sprintf('Tried to disable currency %s but is in use.', $currency->code));
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
return response()->json([]);
|
||||
}
|
||||
|
||||
$this->repository->disable($currency);
|
||||
@@ -267,7 +265,7 @@ class CurrencyController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return redirect(route('currencies.index'));
|
||||
return response()->json([]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,7 +308,7 @@ class CurrencyController extends Controller
|
||||
}
|
||||
$request->session()->forget('currencies.edit.fromUpdate');
|
||||
|
||||
return prefixView('currencies.edit', compact('currency', 'subTitle', 'subTitleIcon'));
|
||||
return view('currencies.edit', compact('currency', 'subTitle', 'subTitleIcon'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,7 +361,7 @@ class CurrencyController extends Controller
|
||||
$isOwner = false;
|
||||
}
|
||||
|
||||
return prefixView('currencies.index', compact('currencies', 'defaultCurrency', 'isOwner'));
|
||||
return view('currencies.index', compact('currencies', 'defaultCurrency', 'isOwner'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -144,6 +144,15 @@ class DebugController extends Controller
|
||||
$bcscale = bcscale();
|
||||
$layout = env('FIREFLY_III_LAYOUT');
|
||||
$tz = env('TZ');
|
||||
$buildNr = '(unknown)';
|
||||
$buildDate = '(unknown)';
|
||||
|
||||
if (file_exists('/var/www/counter-main.txt')) {
|
||||
$buildNr = trim(file_get_contents('/var/www/counter-main.txt'));
|
||||
}
|
||||
if (file_exists('/var/www/build-date-main.txt')) {
|
||||
$buildDate = trim(file_get_contents('/var/www/build-date-main.txt'));
|
||||
}
|
||||
|
||||
// expected + found DB version:
|
||||
$expectedDBversion = config('firefly.db_version');
|
||||
@@ -206,6 +215,8 @@ class DebugController extends Controller
|
||||
'drivers',
|
||||
'currentDriver',
|
||||
'loginProvider',
|
||||
'buildNr',
|
||||
'buildDate',
|
||||
'bcscale',
|
||||
'layout',
|
||||
'userAgent',
|
||||
|
||||
@@ -110,7 +110,7 @@ class IndexController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return prefixView('export.index');
|
||||
return view('export.index');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* HelpController.php
|
||||
* Copyright (c) 2019 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\Http\Controllers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* Class HelpController.
|
||||
*/
|
||||
class HelpController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show help for a route.
|
||||
*
|
||||
* @param string $route
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function show(string $route): JsonResponse
|
||||
{
|
||||
/** @var string $language */
|
||||
$language = app('preferences')->get('language', config('firefly.default_language', 'en_US'))->data;
|
||||
$html = $this->getHelpText($route, $language);
|
||||
|
||||
return response()->json(['html' => $html]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -102,6 +102,9 @@ class HomeController extends Controller
|
||||
*/
|
||||
public function index(AccountRepositoryInterface $repository): mixed
|
||||
{
|
||||
if ('v3' === config('firefly.layout')) {
|
||||
die('Please set your layout to "v1".');
|
||||
}
|
||||
$types = config('firefly.accountTypesByIdentifier.asset');
|
||||
$count = $repository->count($types);
|
||||
Log::channel('audit')->info('User visits homepage.');
|
||||
@@ -138,6 +141,6 @@ class HomeController extends Controller
|
||||
$user = auth()->user();
|
||||
event(new RequestedVersionCheckStatus($user));
|
||||
|
||||
return prefixView('index', compact('count', 'subTitle', 'transactions', 'billCount', 'start', 'end', 'today'));
|
||||
return view('index', compact('count', 'subTitle', 'transactions', 'billCount', 'start', 'end', 'today'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class JavascriptController extends Controller
|
||||
}
|
||||
|
||||
return response()
|
||||
->view('v1.javascript.accounts', $data)
|
||||
->view('javascript.accounts', $data)
|
||||
->header('Content-Type', 'text/javascript');
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class JavascriptController extends Controller
|
||||
}
|
||||
|
||||
return response()
|
||||
->view('v1.javascript.currencies', $data)
|
||||
->view('javascript.currencies', $data)
|
||||
->header('Content-Type', 'text/javascript');
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ class JavascriptController extends Controller
|
||||
$request->session()->keep(['two-factor-secret']);
|
||||
|
||||
return response()
|
||||
->view('v1.javascript.variables', $data)
|
||||
->view('javascript.variables', $data)
|
||||
->header('Content-Type', 'text/javascript');
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class FrontpageController extends Controller
|
||||
$html = '';
|
||||
if (!empty($info)) {
|
||||
try {
|
||||
$html = prefixView('json.piggy-banks', compact('info'))->render();
|
||||
$html = view('json.piggy-banks', compact('info'))->render();
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
|
||||
|
||||
@@ -83,14 +83,18 @@ class ReconcileController extends Controller
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function overview(Request $request, Account $account, Carbon $start, Carbon $end): JsonResponse
|
||||
public function overview(Request $request, Account $account = null, Carbon $start = null, Carbon $end = null): JsonResponse
|
||||
{
|
||||
$startBalance = $request->get('startBalance');
|
||||
$endBalance = $request->get('endBalance');
|
||||
$accountCurrency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
$amount = '0';
|
||||
$clearedAmount = '0';
|
||||
$route = '';
|
||||
|
||||
if (null === $start && null === $end) {
|
||||
throw new FireflyException('Invalid dates submitted.');
|
||||
}
|
||||
if ($end->lt($start)) {
|
||||
[$start, $end] = [$end, $start];
|
||||
}
|
||||
@@ -137,7 +141,7 @@ class ReconcileController extends Controller
|
||||
$reconSum = bcadd(bcadd($startBalance, $amount), $clearedAmount);
|
||||
|
||||
try {
|
||||
$view = prefixView(
|
||||
$view = view(
|
||||
'accounts.reconcile.overview',
|
||||
compact(
|
||||
'account',
|
||||
@@ -220,8 +224,11 @@ class ReconcileController extends Controller
|
||||
* @throws FireflyException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function transactions(Account $account, Carbon $start, Carbon $end)
|
||||
public function transactions(Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
if (null === $start || null === $end) {
|
||||
throw new FireflyException('Invalid dates submitted.');
|
||||
}
|
||||
if ($end->lt($start)) {
|
||||
[$end, $start] = [$start, $end];
|
||||
}
|
||||
@@ -249,7 +256,7 @@ class ReconcileController extends Controller
|
||||
$journals = $this->processTransactions($account, $array);
|
||||
|
||||
try {
|
||||
$html = prefixView(
|
||||
$html = view(
|
||||
'accounts.reconcile.transactions',
|
||||
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
|
||||
)->render();
|
||||
|
||||
@@ -50,7 +50,7 @@ class RuleController extends Controller
|
||||
$actions[$key] = (string)trans('firefly.rule_action_' . $key . '_choice');
|
||||
}
|
||||
try {
|
||||
$view = prefixView('rules.partials.action', compact('actions', 'count'))->render();
|
||||
$view = view('rules.partials.action', compact('actions', 'count'))->render();
|
||||
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
|
||||
@@ -81,7 +81,7 @@ class RuleController extends Controller
|
||||
asort($triggers);
|
||||
|
||||
try {
|
||||
$view = prefixView('rules.partials.trigger', compact('triggers', 'count'))->render();
|
||||
$view = view('rules.partials.trigger', compact('triggers', 'count'))->render();
|
||||
} catch (Throwable $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
|
||||
$view = 'Could not render view.';
|
||||
|
||||
@@ -78,7 +78,7 @@ class NewUserController extends Controller
|
||||
return redirect(route('index'));
|
||||
}
|
||||
|
||||
return prefixView('new-user.index', compact('languages'));
|
||||
return view('new-user.index', compact('languages'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,7 +74,7 @@ class DeleteController extends Controller
|
||||
// put previous url in session
|
||||
$this->rememberPreviousUri('object-groups.delete.uri');
|
||||
|
||||
return prefixView('object-groups.delete', compact('objectGroup', 'subTitle', 'piggyBanks'));
|
||||
return view('object-groups.delete', compact('objectGroup', 'subTitle', 'piggyBanks'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user