Compare commits

..

22 Commits

Author SHA1 Message Date
github-actions
89ce2838d5 Auto commit for release 'develop' on 2024-02-22 2024-02-22 01:29:01 +01:00
James Cole
356b217692 Add missing array 2024-02-20 20:33:33 +01:00
James Cole
950e39b753 Clean up methods. 2024-02-20 20:05:43 +01:00
James Cole
8f14979717 Clean up rule set. 2024-02-20 19:59:55 +01:00
James Cole
aa2afd162e Fix https://github.com/orgs/firefly-iii/discussions/8557 2024-02-20 19:51:13 +01:00
James Cole
fe33352ec1 Fix translation for https://github.com/firefly-iii/firefly-iii/issues/8555 2024-02-19 05:57:06 +01:00
github-actions
65c5249815 Auto commit for release 'develop' on 2024-02-19 2024-02-19 01:30:23 +01:00
James Cole
b1afaea1aa Various updates. 2024-02-18 11:35:08 +01:00
James Cole
997dc3814b Add host header validation 2024-02-17 08:18:49 +01:00
James Cole
b37b5b86d4 Fix https://github.com/firefly-iii/firefly-iii/issues/8544 2024-02-16 20:42:04 +01:00
github-actions
b13a4e1016 Auto commit for release 'develop' on 2024-02-15 2024-02-15 01:29:20 +01:00
James Cole
7897ebc4d5 Update code 2024-02-14 19:47:35 +01:00
James Cole
ac17b82d85 Do not complain when the category is already set. 2024-02-14 19:34:36 +01:00
James Cole
1b1712d998 Make sure that errors in the incoming webhook url are caught. 2024-02-14 19:32:15 +01:00
James Cole
a2c0d9f7d0 The update checker can handle the development releases 2024-02-14 06:34:38 +01:00
James Cole
5b68b25c85 Merge pull request #8538 from firefly-iii/dependabot/composer/develop/phpunit/phpunit-11.0.3
Bump phpunit/phpunit from 10.5.10 to 11.0.3
2024-02-12 19:52:51 +01:00
dependabot[bot]
d3a215b575 Bump phpunit/phpunit from 10.5.10 to 11.0.3
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.5.10 to 11.0.3.
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/11.0.3/ChangeLog-11.0.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/10.5.10...11.0.3)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 03:35:09 +00:00
github-actions
5c352a0d3e Auto commit for release 'develop' on 2024-02-12 2024-02-12 01:29:15 +01:00
James Cole
fded058ea6 Rebuild frontend. 2024-02-11 19:16:27 +01:00
James Cole
99f041b114 Editable up until date. 2024-02-11 10:43:14 +01:00
James Cole
283b594995 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
# Conflicts:
#	app/Helpers/Collector/GroupCollector.php
2024-02-10 08:29:59 +01:00
James Cole
723aa65e7a Inline edit for v2 2024-02-10 08:28:59 +01:00
665 changed files with 4953 additions and 17699 deletions

View File

@@ -35,36 +35,39 @@ $finder = PhpCsFixer\Finder::create()
$config = new PhpCsFixer\Config();
return $config->setRules([
'no_unused_imports' => true,
'@PhpCsFixer' => true,
'@PHP83Migration' => true,
'@PhpCsFixer:risky' => true,
'@PSR12:risky' => true,
'declare_strict_types' => true,
'strict_param' => true,
'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm.
'array_syntax' => ['syntax' => 'short'],
'native_function_invocation' => false, // annoying
'php_unit_data_provider_name' => false, // bloody annoying long test names
'static_lambda' => false, // breaks the Response macro for API's.
'phpdoc_summary' => false, // annoying.
'single_space_around_construct' => [
'constructs_followed_by_a_single_space' => [
'protected',
],
],
'statement_indentation' => true,
'type_declaration_spaces' => false,
'cast_spaces' => false,
'binary_operator_spaces' => [
'default' => 'at_least_single_space',
'operators' => [
'=>' => 'align_single_space_by_scope',
'=' => 'align_single_space_minimal_by_scope',
'??=' => 'align_single_space_minimal_by_scope',
],
],
'void_return' => true,
])
return $config->setRules(
[
// rule sets
'@PHP83Migration' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'@PSR12' => true,
'@PSR12:risky' => true,
'declare_strict_types' => true,
'strict_param' => true,
'no_unused_imports' => true,
'single_space_around_construct' => true,
'statement_indentation' => true,
'void_return' => true,
// disabled rules
'native_function_invocation' => false, // annoying
'php_unit_data_provider_name' => false, // bloody annoying long test names
'static_lambda' => false, // breaks the Response macro for API's.
'phpdoc_summary' => false, // annoying.
'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm.
'type_declaration_spaces' => false,
'cast_spaces' => false,
// complex rules
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'at_least_single_space',
'operators' => [
'=>' => 'align_single_space_by_scope',
'=' => 'align_single_space_minimal_by_scope',
'??=' => 'align_single_space_minimal_by_scope',
],
],
])
->setFinder($finder);

View File

@@ -680,16 +680,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.28.0",
"version": "v1.29.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb"
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4",
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4",
"shasum": ""
},
"require": {
@@ -703,9 +703,6 @@
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
@@ -742,7 +739,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0"
},
"funding": [
{
@@ -758,20 +755,20 @@
"type": "tidelift"
}
],
"time": "2023-01-26T09:26:14+00:00"
"time": "2024-01-29T20:11:03+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.28.0",
"version": "v1.29.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "42292d99c55abe617799667f454222c54c60e229"
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229",
"reference": "42292d99c55abe617799667f454222c54c60e229",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
"shasum": ""
},
"require": {
@@ -785,9 +782,6 @@
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
@@ -825,7 +819,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0"
},
"funding": [
{
@@ -841,7 +835,7 @@
"type": "tidelift"
}
],
"time": "2023-07-28T09:04:16+00:00"
"time": "2024-01-29T20:11:03+00:00"
},
{
"name": "symfony/service-contracts",

View File

@@ -1,6 +1,6 @@
# You can leave this on "local". If you change it to production most console commands will ask for extra confirmation.
# Never set it to "testing".
APP_ENV=local
APP_ENV=production
# Set to true if you want to see debug information in error screens.
APP_DEBUG=false
@@ -332,15 +332,7 @@ DEMO_PASSWORD=
FIREFLY_III_LAYOUT=v1
#
# If you have trouble configuring your Firefly III installation, DON'T BOTHER setting this variable.
# It won't work. It doesn't do ANYTHING. Don't believe the lies you read online. I'm not joking.
# This configuration value WILL NOT HELP.
#
# Notable exception to this rule is Synology, which, according to some users, will use APP_URL to rewrite stuff.
#
# This variable is ONLY used in some of the emails Firefly III sends around. Nowhere else.
# So when configuring anything WEB related this variable doesn't do anything. Nothing
#
# If you're stuck I understand you get desperate but look SOMEWHERE ELSE.
# Please make sure this URL matches the external URL of your Firefly III installation.
# It is used to validate specific requests and to generate URLs in emails.
#
APP_URL=http://localhost

View File

@@ -68,7 +68,7 @@ class DestroyController extends Controller
$allExceptAssets = [AccountType::BENEFICIARY, AccountType::CASH, AccountType::CREDITCARD, AccountType::DEFAULT, AccountType::EXPENSE, AccountType::IMPORT, AccountType::INITIAL_BALANCE, AccountType::LIABILITY_CREDIT, AccountType::RECONCILIATION, AccountType::REVENUE];
$all = [AccountType::ASSET, AccountType::BENEFICIARY, AccountType::CASH, AccountType::CREDITCARD, AccountType::DEBT, AccountType::DEFAULT, AccountType::EXPENSE, AccountType::IMPORT, AccountType::INITIAL_BALANCE, AccountType::LIABILITY_CREDIT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::RECONCILIATION];
$liabilities = [AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD];
$transactions = [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER, TransactionType::RECONCILIATION, TransactionType::OPENING_BALANCE];
$transactions = [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER, TransactionType::RECONCILIATION];
match ($objects) {
'budgets' => $this->destroyBudgets(),

View File

@@ -66,7 +66,7 @@ class DestroyController extends Controller
*/
public function destroy(Attachment $attachment): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();

View File

@@ -75,7 +75,7 @@ class ShowController extends Controller
*/
public function download(Attachment $attachment): LaravelResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();
@@ -123,7 +123,7 @@ class ShowController extends Controller
*/
public function index(): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();
@@ -161,7 +161,7 @@ class ShowController extends Controller
*/
public function show(Attachment $attachment): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();

View File

@@ -74,7 +74,7 @@ class StoreController extends Controller
*/
public function store(StoreRequest $request): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();
@@ -98,7 +98,7 @@ class StoreController extends Controller
*/
public function upload(Request $request, Attachment $attachment): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();

View File

@@ -69,7 +69,7 @@ class UpdateController extends Controller
*/
public function update(UpdateRequest $request, Attachment $attachment): JsonResponse
{
if(true === auth()->user()->hasRole('demo')) {
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
throw new NotFoundHttpException();

View File

@@ -70,7 +70,7 @@ class AttemptController extends Controller
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('200040: Webhook and webhook message are no match');
}
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User lists webhook attempts of webhook #%d and message #%d, but webhooks are DISABLED.', $webhook->id, $message->id));
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -114,7 +114,7 @@ class AttemptController extends Controller
throw new FireflyException('200041: Webhook message and webhook attempt are no match');
}
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User views single webhook attempt #%d of webhook #%d and message #%d, but webhooks are DISABLED', $attempt->id, $webhook->id, $message->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -62,7 +62,7 @@ class DestroyController extends Controller
*/
public function destroy(Webhook $webhook): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -120,7 +120,7 @@ class DestroyController extends Controller
throw new FireflyException('200040: Webhook and webhook message are no match');
}
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, but webhooks are DISABLED.', $webhook->id, $message->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -66,7 +66,7 @@ class MessageController extends Controller
*/
public function index(Webhook $webhook): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User tries to view messages of webhook #%d, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -106,7 +106,7 @@ class MessageController extends Controller
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('200040: Webhook and webhook message are no match');
}
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User tries to view message #%d of webhook #%d, but webhooks are DISABLED.', $message->id, $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -71,7 +71,7 @@ class ShowController extends Controller
*/
public function index(): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info('User tries to view all webhooks, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -106,7 +106,7 @@ class ShowController extends Controller
*/
public function show(Webhook $webhook): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info(sprintf('User tries to view webhook #%d, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');
@@ -131,7 +131,7 @@ class ShowController extends Controller
*/
public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info(sprintf('User tries to trigger webhook #%d on transaction group #%d, but webhooks are DISABLED.', $webhook->id, $group->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -60,7 +60,7 @@ class StoreController extends Controller
public function store(CreateRequest $request): JsonResponse
{
$data = $request->getData();
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info('User tries to store new webhook, but webhooks are DISABLED.', $data);
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -57,7 +57,7 @@ class SubmitController extends Controller
*/
public function submit(Webhook $webhook): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info(sprintf('User tries to submit webhook #%d, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -60,7 +60,7 @@ class UpdateController extends Controller
public function update(Webhook $webhook, UpdateRequest $request): JsonResponse
{
$data = $request->getData();
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->info(sprintf('User tries to update webhook #%d, but webhooks are DISABLED.', $webhook->id), $data);
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -73,7 +73,7 @@ class MoveTransactionsRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -73,7 +73,7 @@ class TransactionRequest extends FormRequest
$this->validateTransactionQuery($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -46,7 +46,7 @@ class DateRequest extends FormRequest
{
$start = $this->getCarbonDate('start');
$end = $this->getCarbonDate('end');
if($start->diffInYears($end) > 5) {
if ($start->diffInYears($end) > 5) {
throw new FireflyException('Date range out of range.');
}

View File

@@ -88,7 +88,7 @@ class Request extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -104,7 +104,7 @@ class StoreRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -109,7 +109,7 @@ class UpdateRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -92,7 +92,7 @@ class StoreRequest extends FormRequest
$this->validateAutoBudgetAmount($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -104,7 +104,7 @@ class UpdateRequest extends FormRequest
$this->validateAutoBudgetAmount($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -88,7 +88,7 @@ class UpdateRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -132,7 +132,7 @@ class StoreRequest extends FormRequest
$this->validateAccountInformation($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -142,7 +142,7 @@ class UpdateRequest extends FormRequest
$this->valUpdateAccountInfo($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -109,7 +109,7 @@ class StoreRequest extends FormRequest
$this->atLeastOneActiveAction($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -119,7 +119,7 @@ class UpdateRequest extends FormRequest
$this->atLeastOneValidAction($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -71,7 +71,7 @@ class TriggerRequest extends FormRequest
private function getAccounts(): array
{
if(null === $this->get('accounts')) {
if (null === $this->get('accounts')) {
return [];
}

View File

@@ -192,7 +192,7 @@ class StoreRequest extends FormRequest
$this->validateGroupDescription($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -206,7 +206,7 @@ class UpdateRequest extends FormRequest
$this->validateAccountInformationUpdate($validator, $transactionGroup);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -78,7 +78,7 @@ class StoreRequest extends FormRequest
$this->validateExistingLink($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -78,7 +78,7 @@ class UpdateRequest extends FormRequest
$this->validateUpdate($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -98,7 +98,7 @@ class UserUpdateRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Transaction\List;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Model\Transaction\ListByCountRequest;
use FireflyIII\Api\V2\Request\Model\Transaction\ListRequest;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Transformers\V2\TransactionGroupTransformer;
@@ -34,6 +35,43 @@ use Illuminate\Http\JsonResponse;
*/
class TransactionController extends Controller
{
public function listByCount(ListByCountRequest $request): JsonResponse
{
// collect transactions:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setUserGroup(auth()->user()->userGroup)
->withAPIInformation()
->setStartRow($request->getStartRow())
->setEndRow($request->getEndRow())
->setTypes($request->getTransactionTypes())
;
$start = $this->parameters->get('start');
$end = $this->parameters->get('end');
if (null !== $start) {
$collector->setStart($start);
}
if (null !== $end) {
$collector->setEnd($end);
}
$paginator = $collector->getPaginatedGroups();
$params = $request->buildParams();
$paginator->setPath(
sprintf(
'%s?%s',
route('api.v2.transactions.list'),
$params
)
);
return response()
->json($this->jsonApiList('transactions', $paginator, new TransactionGroupTransformer()))
->header('Content-Type', self::CONTENT_TYPE)
;
}
public function list(ListRequest $request): JsonResponse
{
// collect transactions:

View File

@@ -80,7 +80,7 @@ class BalanceChartRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -78,7 +78,7 @@ class DashboardChartRequest extends FormRequest
}
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -0,0 +1,107 @@
<?php
/*
* ListRequest.php
* Copyright (c) 2023 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V2\Request\Model\Transaction;
use Carbon\Carbon;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class ListRequest
* Used specifically to list transactions.
*/
class ListByCountRequest extends FormRequest
{
use ChecksLogin;
use ConvertsDataTypes;
use TransactionFilter;
public function buildParams(): string
{
$array = [
'start_row' => $this->getStartRow(),
'end_row' => $this->getEndRow(),
];
$start = $this->getStartDate();
$end = $this->getEndDate();
if (null !== $start && null !== $end) {
$array['start'] = $start->format('Y-m-d');
$array['end'] = $end->format('Y-m-d');
}
return http_build_query($array);
}
public function getPage(): int
{
$page = $this->convertInteger('page');
return 0 === $page || $page > 65536 ? 1 : $page;
}
public function getStartRow(): int
{
$startRow = $this->convertInteger('start_row');
return $startRow < 0 || $startRow > 4294967296 ? 0 : $startRow;
}
public function getEndRow(): int
{
$endRow = $this->convertInteger('end_row');
return $endRow <= 0 || $endRow > 4294967296 ? 100 : $endRow;
}
public function getStartDate(): ?Carbon
{
return $this->getCarbonDate('start');
}
public function getEndDate(): ?Carbon
{
return $this->getCarbonDate('end');
}
public function getTransactionTypes(): array
{
$type = (string)$this->get('type', 'default');
return $this->mapTransactionTypes($type);
}
public function rules(): array
{
return [
'start' => 'date',
'end' => 'date|after:start',
'start_row' => 'integer|min:0|max:4294967296',
'end_row' => 'integer|min:0|max:4294967296|gt:start_row',
];
}
}

View File

@@ -212,7 +212,7 @@ class StoreRequest extends FormRequest
$this->validateGroupDescription($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -207,7 +207,7 @@ class UpdateRequest extends Request
$this->validateAccountInformationUpdate($validator, $transactionGroup);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -72,6 +72,16 @@ class UpgradeFireflyInstructions extends Command
}
}
// validate some settings.
if ('' === $text && 'local' === (string)config('app.env')) {
$text = 'Please set APP_ENV=production for a safer environment.';
}
$prefix = 'v';
if (str_starts_with($version, 'develop')) {
$prefix = '';
}
$this->newLine();
$this->showLogo();
$this->newLine();
@@ -79,7 +89,7 @@ class UpgradeFireflyInstructions extends Command
$this->boxed('');
if ('' === $text) {
$this->boxed(sprintf('Thank you for updating to Firefly III, v%s', $version));
$this->boxed(sprintf('Thank you for updating to Firefly III, %s%s', $prefix, $version));
$this->boxedInfo('There are no extra upgrade instructions.');
$this->boxed('Firefly III should be ready for use.');
$this->boxed('');
@@ -88,7 +98,7 @@ class UpgradeFireflyInstructions extends Command
return;
}
$this->boxed(sprintf('Thank you for updating to Firefly III, v%s!', $version));
$this->boxed(sprintf('Thank you for updating to Firefly III, %s%s!', $prefix, $version));
$this->boxedInfo($text);
$this->boxed('');
$this->showLine();
@@ -181,13 +191,24 @@ class UpgradeFireflyInstructions extends Command
$text = (string)$config[$compare];
}
}
// validate some settings.
if ('' === $text && 'local' === (string)config('app.env')) {
$text = 'Please set APP_ENV=production for a safer environment.';
}
$prefix = 'v';
if (str_starts_with($version, 'develop')) {
$prefix = '';
}
$this->newLine();
$this->showLogo();
$this->newLine();
$this->showLine();
$this->boxed('');
if ('' === $text) {
$this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));
$this->boxed(sprintf('Thank you for installing Firefly III, %s%s!', $prefix, $version));
$this->boxedInfo('There are no extra installation instructions.');
$this->boxed('Firefly III should be ready for use.');
$this->boxed('');
@@ -196,7 +217,7 @@ class UpgradeFireflyInstructions extends Command
return;
}
$this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));
$this->boxed(sprintf('Thank you for installing Firefly III, %s%s!', $prefix, $version));
$this->boxedInfo($text);
$this->boxed('');
$this->showLine();

View File

@@ -30,8 +30,8 @@ namespace FireflyIII\Enums;
*/
enum StringPosition
{
case STARTS;
case ENDS;
case CONTAINS;
case IS;
case STARTS;
case ENDS;
case CONTAINS;
case IS;
}

View File

@@ -34,8 +34,7 @@ class RequestedVersionCheckStatus extends Event
{
use SerializesModels;
/** @var User The user */
public $user;
public User $user;
/**
* Create a new event instance. This event is triggered when Firefly III wants to know

View File

@@ -27,6 +27,8 @@ namespace FireflyIII\Handlers\Events\Model;
use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
use FireflyIII\Events\Model\Rule\RuleActionFailedOnObject;
use FireflyIII\Notifications\User\RuleActionFailed;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Notification;
/**
@@ -56,7 +58,11 @@ class RuleHandler
$ruleLink = route('rules.edit', [$rule->id]);
$params = [$mainMessage, $groupTitle, $groupLink, $ruleTitle, $ruleLink];
Notification::send($user, new RuleActionFailed($params));
try {
Notification::send($user, new RuleActionFailed($params));
} catch (ClientException $e) {
Log::error(sprintf('[a] Error sending notification that the rule action failed: %s', $e->getMessage()));
}
}
public function ruleActionFailedOnObject(RuleActionFailedOnObject $event): void
@@ -81,6 +87,10 @@ class RuleHandler
$ruleLink = route('rules.edit', [$rule->id]);
$params = [$mainMessage, $groupTitle, $groupLink, $ruleTitle, $ruleLink];
Notification::send($user, new RuleActionFailed($params));
try {
Notification::send($user, new RuleActionFailed($params));
} catch (ClientException $e) {
Log::error(sprintf('[b] Error sending notification that the rule action failed: %s', $e->getMessage()));
}
}
}

View File

@@ -40,7 +40,7 @@ class BudgetObserver
$budgetLimits = $budget->budgetlimits()->get();
/** @var BudgetLimit $budgetLimit */
foreach($budgetLimits as $budgetLimit) {
foreach ($budgetLimits as $budgetLimit) {
// this loop exists so several events are fired.
$budgetLimit->delete();
}

View File

@@ -50,6 +50,9 @@ trait CollectorProperties
private array $postFilters;
private HasMany $query;
private array $stringFields;
private ?int $startRow;
private ?int $endRow;
/*
* This array is used to collect ALL tags the user may search for (using 'setTags').
* This way the user can call 'setTags' multiple times and get a joined result.

View File

@@ -67,6 +67,8 @@ class GroupCollector implements GroupCollectorInterface
$this->userGroup = null;
$this->limit = null;
$this->page = null;
$this->startRow = null;
$this->endRow = null;
$this->hasAccountInfo = false;
$this->hasCatInformation = false;
@@ -473,6 +475,10 @@ class GroupCollector implements GroupCollectorInterface
return $collection->slice($offset, $this->limit);
}
// OR filter the array according to the start and end row variable
if (null !== $this->startRow && null !== $this->endRow) {
return $collection->slice($this->startRow, $this->endRow);
}
return $collection;
}
@@ -486,6 +492,11 @@ class GroupCollector implements GroupCollectorInterface
if (0 === $this->limit) {
$this->setLimit(50);
}
if (null !== $this->startRow && null !== $this->endRow) {
$total = $this->endRow - $this->startRow;
return new LengthAwarePaginator($set, $this->total, $total, 1);
}
return new LengthAwarePaginator($set, $this->total, $this->limit, $this->page);
}
@@ -678,6 +689,20 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
public function setEndRow(int $endRow): self
{
$this->endRow = $endRow;
return $this;
}
public function setStartRow(int $startRow): self
{
$this->startRow = $startRow;
return $this;
}
private function getCollectedGroupIds(): array
{
return $this->query->get(['transaction_journals.transaction_group_id'])->pluck('transaction_group_id')->toArray();
@@ -1059,6 +1084,7 @@ class GroupCollector implements GroupCollectorInterface
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC')
->orderBy('source.amount', 'DESC');
->orderBy('source.amount', 'DESC')
;
}
}

View File

@@ -526,6 +526,16 @@ interface GroupCollectorInterface
*/
public function setPage(int $page): self;
/**
* Set the page to get.
*/
public function setStartRow(int $startRow): self;
/**
* Set the page to get.
*/
public function setEndRow(int $endRow): self;
/**
* Set the start and end time of the results to return.
*/

View File

@@ -68,6 +68,9 @@ class ForgotPasswordController extends Controller
return view('error', compact('message'));
}
// validate host header.
$this->validateHost();
$this->validateEmail($request);
// verify if the user is not a demo user. If so, we give him back an error.
@@ -118,4 +121,19 @@ class ForgotPasswordController extends Controller
return view('auth.passwords.email')->with(compact('allowRegistration', 'pageTitle'));
}
/**
* @throws FireflyException
*/
private function validateHost(): void
{
$configuredHost = parse_url((string)config('app.url'), PHP_URL_HOST);
if (false === $configuredHost || null === $configuredHost) {
throw new FireflyException('Please set a valid and correct Firefly III URL in the APP_URL environment variable.');
}
$host = request()->host();
if ($configuredHost !== $host) {
throw new FireflyException('The Host-header does not match the host in the APP_URL environment variable. Please make sure these match. See also: https://bit.ly/FF3-host-header');
}
}
}

View File

@@ -80,6 +80,7 @@ class ResetPasswordController extends Controller
return view('error', compact('message'));
}
$rules = [
'token' => 'required',
'email' => 'required|email',
@@ -90,7 +91,7 @@ class ResetPasswordController extends Controller
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
// database. Otherwise, we will parse the error and return the response.
$response = $this->broker()->reset(
$this->credentials($request),
function ($user, $password): void {

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Models\AccountType;
@@ -178,7 +177,9 @@ class DebugController extends Controller
'db_version' => app('fireflyconfig')->get('db_version', 1)->data,
'php_version' => PHP_VERSION,
'php_os' => PHP_OS,
'uname' => php_uname('m'),
'interface' => \PHP_SAPI,
'bits' => \PHP_INT_SIZE * 8,
'bcscale' => bcscale(),
'display_errors' => ini_get('display_errors'),
'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')),

View File

@@ -66,7 +66,7 @@ class IndexController extends Controller
*/
public function export(): LaravelResponse|RedirectResponse
{
if(auth()->user()->hasRole('demo')) {
if (auth()->user()->hasRole('demo')) {
session()->flash('info', (string) trans('firefly.demo_user_export'));
return redirect(route('export.index'));

View File

@@ -78,7 +78,7 @@ class RecurrenceController extends Controller
$weekend = (int) $request->get('weekend');
$repetitionMoment = '';
$skip = (int) $request->get('skip');
$skip = $skip < 1 || $skip > 31 ? 1 : $skip;
$skip = $skip < 0 || $skip > 31 ? 0 : $skip;
$weekend = $weekend < 1 || $weekend > 4 ? 1 : $weekend;
if (false === $start || false === $end || false === $firstDate || false === $endDate) {

View File

@@ -387,7 +387,7 @@ class TagController extends Controller
/** @var array $tag */
foreach ($currency['tags'] as $tag) {
$tagId = $tag['id'];
if(!array_key_exists($tagId, $report)) {
if (!array_key_exists($tagId, $report)) {
continue;
}
foreach ($tag['transaction_journals'] as $journal) {
@@ -425,7 +425,7 @@ class TagController extends Controller
/** @var array $tag */
foreach ($currency['tags'] as $tag) {
$tagId = $tag['id'];
if(!array_key_exists($tagId, $report)) {
if (!array_key_exists($tagId, $report)) {
continue;
}
foreach ($tag['transaction_journals'] as $journal) {

View File

@@ -140,7 +140,7 @@ class SelectController extends Controller
$trigger = new RuleTrigger();
$trigger->trigger_type = $textTrigger['type'];
$trigger->trigger_value = $textTrigger['value'];
if(false === $needsContext) {
if (false === $needsContext) {
$trigger->trigger_value = 'true';
}
$trigger->stop_processing = $textTrigger['stop_processing'];

View File

@@ -59,7 +59,7 @@ class CreateController extends Controller
*/
public function index()
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning('User visits webhook create page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -63,7 +63,7 @@ class DeleteController extends Controller
*/
public function index(Webhook $webhook)
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning('User visits webhook delete page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -62,7 +62,7 @@ class EditController extends Controller
*/
public function index(Webhook $webhook)
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning('User visits webhook edit page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -55,7 +55,7 @@ class IndexController extends Controller
*/
public function index()
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning('User visits webhook index page, but webhooks are DISABLED.');
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -62,7 +62,7 @@ class ShowController extends Controller
*/
public function index(Webhook $webhook)
{
if(false === config('firefly.allow_webhooks')) {
if (false === config('firefly.allow_webhooks')) {
Log::channel('audit')->warning(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id));
throw new NotFoundHttpException('Webhooks are not enabled.');

View File

@@ -0,0 +1,41 @@
<?php
/*
* TrustHosts.php
* Copyright (c) 2024 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\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, null|string>
*/
public function hosts(): array
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View File

@@ -136,7 +136,7 @@ class AccountFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -62,7 +62,7 @@ class AttachmentFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -82,7 +82,7 @@ class BillStoreRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -86,7 +86,7 @@ class BillUpdateRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -83,7 +83,7 @@ class BudgetFormStoreRequest extends FormRequest
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -92,7 +92,7 @@ class BudgetFormUpdateRequest extends FormRequest
$this->validateAutoBudgetAmount($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -51,7 +51,7 @@ class BudgetIncomeRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -51,7 +51,7 @@ class BulkEditJournalRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -72,7 +72,7 @@ class CategoryFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -60,7 +60,7 @@ class ConfigurationRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -84,7 +84,7 @@ class CurrencyFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -48,7 +48,7 @@ class DeleteAccountFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -50,7 +50,7 @@ class EmailFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -50,7 +50,7 @@ class InviteUserFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -79,7 +79,7 @@ class JournalLinkRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -64,7 +64,7 @@ class LinkTypeFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -48,7 +48,7 @@ class MassDeleteJournalRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -54,7 +54,7 @@ class MassEditJournalRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -57,7 +57,7 @@ class NewUserFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -68,7 +68,7 @@ class ObjectGroupFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -73,7 +73,7 @@ class PiggyBankStoreRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -77,7 +77,7 @@ class PiggyBankUpdateRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -50,7 +50,7 @@ class ProfileFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -80,7 +80,7 @@ class ReconciliationStoreRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -247,7 +247,7 @@ class RecurrenceFormRequest extends FormRequest
$this->validateAccountInformation($validator);
}
);
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -250,7 +250,7 @@ class ReportFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -123,7 +123,7 @@ class RuleFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -79,7 +79,7 @@ class RuleGroupFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -57,7 +57,7 @@ class SelectTransactionsRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -82,7 +82,7 @@ class TagFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -54,7 +54,7 @@ class TestRuleFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -48,7 +48,7 @@ class TokenFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -60,7 +60,7 @@ class TriggerRecurrenceRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -68,7 +68,7 @@ class UserFormRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -58,7 +58,7 @@ class UserRegistrationRequest extends FormRequest
public function withValidator(Validator $validator): void
{
if($validator->fails()) {
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -112,11 +112,11 @@ class RuleActionFailed extends Notification
$slackUrl = '';
}
if (UrlValidator::isValidWebhookURL((string)$slackUrl)) {
app('log')->debug('Will send ruleActionFailed through Slack!');
app('log')->debug('Will send ruleActionFailed through Slack or Discord!');
return ['slack'];
}
app('log')->debug('Will NOT send ruleActionFailed through Slack');
app('log')->debug('Will NOT send ruleActionFailed through Slack or Discord');
return [];
}

View File

@@ -142,7 +142,7 @@ class RuleRepository implements RuleRepositoryInterface
continue;
}
$triggerType = $trigger->trigger_type;
if(str_starts_with($trigger->trigger_type, '-')) {
if (str_starts_with($trigger->trigger_type, '-')) {
$triggerType = substr($trigger->trigger_type, 1);
}
$needsContext = config(sprintf('search.operators.%s.needs_context', $triggerType)) ?? true;
@@ -484,7 +484,7 @@ class RuleRepository implements RuleRepositoryInterface
'no_external_id',
'any_external_id',
];
if(in_array($type, $needTrue, true)) {
if (in_array($type, $needTrue, true)) {
$value = '';
}

View File

@@ -80,7 +80,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$tagId = (int)$tag['id'];
$tagName = (string)$tag['name'];
$journalId = (int)$journal['transaction_journal_id'];
if(!in_array($tagId, $tagIds, true)) {
if (!in_array($tagId, $tagIds, true)) {
continue;
}
@@ -164,7 +164,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$tagName = (string)$tag['name'];
$journalId = (int)$journal['transaction_journal_id'];
if(!in_array($tagId, $tagIds, true)) {
if (!in_array($tagId, $tagIds, true)) {
continue;
}

View File

@@ -20,7 +20,7 @@ class IsValidAmount implements ValidationRule
$value = (string)$value;
// must not be empty:
if($this->emptyString($value)) {
if ($this->emptyString($value)) {
$fail('validation.filled')->translate();
$message = sprintf('IsValidAmount: "%s" cannot be empty.', $value);
Log::debug($message);
@@ -30,7 +30,7 @@ class IsValidAmount implements ValidationRule
}
// must be a number:
if(!$this->isValidNumber($value)) {
if (!$this->isValidNumber($value)) {
$fail('validation.numeric')->translate();
$message = sprintf('IsValidAmount: "%s" is not a number.', $value);
Log::debug($message);
@@ -40,7 +40,7 @@ class IsValidAmount implements ValidationRule
}
// must not be scientific notation:
if($this->scientificNumber($value)) {
if ($this->scientificNumber($value)) {
$fail('validation.scientific_notation')->translate();
$message = sprintf('IsValidAmount: "%s" cannot be in the scientific notation.', $value);
Log::debug($message);
@@ -50,7 +50,7 @@ class IsValidAmount implements ValidationRule
}
// must be more than minus a lots:
if($this->lessThanLots($value)) {
if ($this->lessThanLots($value)) {
$amount = bcmul('-1', self::BIG_AMOUNT);
$fail('validation.gte.numeric')->translate(['value' => $amount]);
$message = sprintf('IsValidAmount: "%s" must be more than %s.', $value, $amount);
@@ -61,7 +61,7 @@ class IsValidAmount implements ValidationRule
}
// must be less than a large number
if($this->moreThanLots($value)) {
if ($this->moreThanLots($value)) {
$fail('validation.lte.numeric')->translate(['value' => self::BIG_AMOUNT]);
$message = sprintf('IsValidAmount: "%s" must be more than %s.', $value, self::BIG_AMOUNT);
Log::debug($message);

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