Merge branch 'develop' into 5.8-dev

# Conflicts:
#	app/Http/Requests/RuleFormRequest.php
This commit is contained in:
James Cole 2022-12-28 06:51:59 +01:00
commit d3a619cb15
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
3 changed files with 105 additions and 62 deletions

View File

@ -1,4 +1,5 @@
<?php
/**
* RuleFormRequest.php
* Copyright (c) 2019 james@firefly-iii.org
@ -75,6 +76,7 @@ class RuleFormRequest extends FormRequest
'stop_processing' => 1 === (int)$stopProcessing,
'prohibited' => 1 === (int)$prohibited,
];
$set = self::replaceAmountTrigger($set);
$return[] = $set;
}
}
@ -82,6 +84,34 @@ class RuleFormRequest extends FormRequest
return $return;
}
/**
* @param array $array
* @return array
*/
public static function replaceAmountTrigger(array $array): array
{
// do some sneaky search and replace.
$amountFields = [
'amount_is',
'amount',
'amount_exactly',
'amount_less',
'amount_max',
'amount_more',
'amount_min',
'foreign_amount_is',
'foreign_amount',
'foreign_amount_less',
'foreign_amount_max',
'foreign_amount_more',
'foreign_amount_min',
];
if (in_array($array['type'], $amountFields, true) && '0' === $array['value']) {
$array['value'] = '0.00';
}
return $array;
}
/**
* @return array
*/

View File

@ -27,6 +27,7 @@ use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Exceptions\ValidationException;
use FireflyIII\Helpers\Help\HelpInterface;
use FireflyIII\Http\Requests\RuleFormRequest;
use FireflyIII\Http\Requests\TestRuleFormRequest;
use FireflyIII\Support\Binder\AccountList;
use FireflyIII\User;
@ -70,14 +71,15 @@ trait RequestInformation
$data = $request->get('triggers');
if (is_array($data)) {
foreach ($data as $triggerInfo) {
$triggers[] = [
$current = [
'type' => $triggerInfo['type'] ?? '',
'value' => $triggerInfo['value'] ?? '',
'stop_processing' => 1 === (int)($triggerInfo['stop_processing'] ?? '0'),
];
$current = RuleFormRequest::replaceAmountTrigger($current);
$triggers[] = $current;
}
}
return $triggers;
}

93
composer.lock generated
View File

@ -5092,42 +5092,53 @@
},
{
"name": "ramsey/collection",
"version": "1.2.2",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/ramsey/collection.git",
"reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a"
"reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/collection/zipball/cccc74ee5e328031b15640b51056ee8d3bb66c0a",
"reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a",
"url": "https://api.github.com/repos/ramsey/collection/zipball/ad7475d1c9e70b190ecffc58f2d989416af339b4",
"reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4",
"shasum": ""
},
"require": {
"php": "^7.3 || ^8",
"php": "^7.4 || ^8.0",
"symfony/polyfill-php81": "^1.23"
},
"require-dev": {
"captainhook/captainhook": "^5.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"ergebnis/composer-normalize": "^2.6",
"fakerphp/faker": "^1.5",
"hamcrest/hamcrest-php": "^2",
"jangregor/phpstan-prophecy": "^0.8",
"mockery/mockery": "^1.3",
"captainhook/plugin-composer": "^5.3",
"ergebnis/composer-normalize": "^2.28.3",
"fakerphp/faker": "^1.21",
"hamcrest/hamcrest-php": "^2.0",
"jangregor/phpstan-prophecy": "^1.0",
"mockery/mockery": "^1.5",
"php-parallel-lint/php-console-highlighter": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcsstandards/phpcsutils": "^1.0.0-rc1",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1",
"phpstan/phpstan": "^0.12.32",
"phpstan/phpstan-mockery": "^0.12.5",
"phpstan/phpstan-phpunit": "^0.12.11",
"phpunit/phpunit": "^8.5 || ^9",
"psy/psysh": "^0.10.4",
"slevomat/coding-standard": "^6.3",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.4"
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.9",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^9.5",
"psalm/plugin-mockery": "^1.1",
"psalm/plugin-phpunit": "^0.18.4",
"ramsey/coding-standard": "^2.0.3",
"ramsey/conventional-commits": "^1.3",
"vimeo/psalm": "^5.4"
},
"type": "library",
"extra": {
"captainhook": {
"force-install": true
},
"ramsey/conventional-commits": {
"configFile": "conventional-commits.json"
}
},
"autoload": {
"psr-4": {
"Ramsey\\Collection\\": "src/"
@ -5155,7 +5166,7 @@
],
"support": {
"issues": "https://github.com/ramsey/collection/issues",
"source": "https://github.com/ramsey/collection/tree/1.2.2"
"source": "https://github.com/ramsey/collection/tree/1.3.0"
},
"funding": [
{
@ -5167,7 +5178,7 @@
"type": "tidelift"
}
],
"time": "2021-10-10T03:01:02+00:00"
"time": "2022-12-27T19:12:24+00:00"
},
{
"name": "ramsey/uuid",
@ -5465,16 +5476,16 @@
},
{
"name": "spatie/flare-client-php",
"version": "1.3.1",
"version": "1.3.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/flare-client-php.git",
"reference": "ebb9ae0509b75e02f128b39537eb9a3ef5ce18e8"
"reference": "609903bd154ba3d71f5e23a91c3b431fa8f71868"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/flare-client-php/zipball/ebb9ae0509b75e02f128b39537eb9a3ef5ce18e8",
"reference": "ebb9ae0509b75e02f128b39537eb9a3ef5ce18e8",
"url": "https://api.github.com/repos/spatie/flare-client-php/zipball/609903bd154ba3d71f5e23a91c3b431fa8f71868",
"reference": "609903bd154ba3d71f5e23a91c3b431fa8f71868",
"shasum": ""
},
"require": {
@ -5522,7 +5533,7 @@
],
"support": {
"issues": "https://github.com/spatie/flare-client-php/issues",
"source": "https://github.com/spatie/flare-client-php/tree/1.3.1"
"source": "https://github.com/spatie/flare-client-php/tree/1.3.2"
},
"funding": [
{
@ -5530,7 +5541,7 @@
"type": "github"
}
],
"time": "2022-11-16T08:30:20+00:00"
"time": "2022-12-26T14:36:46+00:00"
},
{
"name": "spatie/ignition",
@ -5609,16 +5620,16 @@
},
{
"name": "spatie/laravel-ignition",
"version": "1.6.2",
"version": "1.6.3",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-ignition.git",
"reference": "d6e1e1ad93abe280abf41c33f8ea7647dfc0c233"
"reference": "2db918babd96f87b73fc26e4195f5a19328dd123"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/d6e1e1ad93abe280abf41c33f8ea7647dfc0c233",
"reference": "d6e1e1ad93abe280abf41c33f8ea7647dfc0c233",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/2db918babd96f87b73fc26e4195f5a19328dd123",
"reference": "2db918babd96f87b73fc26e4195f5a19328dd123",
"shasum": ""
},
"require": {
@ -5695,7 +5706,7 @@
"type": "github"
}
],
"time": "2022-12-08T15:31:38+00:00"
"time": "2022-12-26T15:13:03+00:00"
},
{
"name": "stella-maris/clock",
@ -8392,16 +8403,16 @@
},
{
"name": "twig/twig",
"version": "v3.4.3",
"version": "v3.5.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58"
"reference": "3ffcf4b7d890770466da3b2666f82ac054e7ec72"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58",
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/3ffcf4b7d890770466da3b2666f82ac054e7ec72",
"reference": "3ffcf4b7d890770466da3b2666f82ac054e7ec72",
"shasum": ""
},
"require": {
@ -8416,7 +8427,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.4-dev"
"dev-master": "3.5-dev"
}
},
"autoload": {
@ -8452,7 +8463,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.4.3"
"source": "https://github.com/twigphp/Twig/tree/v3.5.0"
},
"funding": [
{
@ -8464,7 +8475,7 @@
"type": "tidelift"
}
],
"time": "2022-09-28T08:42:51+00:00"
"time": "2022-12-27T12:28:18+00:00"
},
{
"name": "vlucas/phpdotenv",