diff --git a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php index c5027aa2d4..1cdf6e8bcd 100644 --- a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php +++ b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php @@ -28,6 +28,7 @@ use Carbon\Exceptions\InvalidFormatException; use FireflyIII\JsonApi\Rules\IsValidFilter; use FireflyIII\JsonApi\Rules\IsValidPage; use FireflyIII\Support\Http\Api\AccountFilter; +use FireflyIII\Support\Http\Api\ParsesQueryFilters; use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; @@ -43,6 +44,7 @@ class AutocompleteRequest extends FormRequest use AccountFilter; use ChecksLogin; use ConvertsDataTypes; + use ParsesQueryFilters; /** * Loops over all possible query parameters (these are shared over ALL auto complete requests) @@ -53,25 +55,11 @@ class AutocompleteRequest extends FormRequest public function getParameters(): array { $queryParameters = QueryParameters::cast($this->all()); - - try { - $date = Carbon::createFromFormat('Y-m-d', $queryParameters->filter()?->value('date', date('Y-m-d')), config('app.timezone')); - } catch (InvalidFormatException $e) { - Log::debug(sprintf('Invalid date format in autocomplete request. Using today: %s', $e->getMessage())); - $date = today(); - } - $query = $queryParameters->filter()?->value('query', []) ?? []; - $query = is_string($query) ? [$query] : $query; - $size = (int) ($queryParameters->page()['size'] ?? 50); - $accountTypeRequest = $queryParameters->filter()?->value('account_types', []) ?? []; - $accountTypeRequest = is_string($accountTypeRequest) ? [$accountTypeRequest] : $accountTypeRequest; - $accountTypes = $this->getAccountTypeParameter($accountTypeRequest); - return [ - 'date' => $date, - 'query' => $query, - 'size' => $size, - 'account_types' => $accountTypes, + 'date' => $this->dateOrToday($queryParameters, 'date'), + 'query' => $this->arrayOfStrings($queryParameters, 'query'), + 'size' => $this->integerFromQueryParams($queryParameters,'size', 50), + 'account_types' => $this->getAccountTypeParameter($this->arrayOfStrings($queryParameters, 'account_types')), ]; } diff --git a/app/Api/V2/Request/Chart/ChartRequest.php b/app/Api/V2/Request/Chart/ChartRequest.php new file mode 100644 index 0000000000..78c923afd3 --- /dev/null +++ b/app/Api/V2/Request/Chart/ChartRequest.php @@ -0,0 +1,112 @@ +. + */ + +declare(strict_types=1); + +namespace FireflyIII\Api\V2\Request\Chart; + +use FireflyIII\Enums\UserRoleEnum; +use FireflyIII\JsonApi\Rules\IsValidFilter; +use FireflyIII\JsonApi\Rules\IsValidPage; +use FireflyIII\Support\Http\Api\ParsesQueryFilters; +use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; +use FireflyIII\Support\Request\ChecksLogin; +use FireflyIII\Support\Request\ConvertsDataTypes; +use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Log; +use Illuminate\Validation\Validator; +use LaravelJsonApi\Core\Query\QueryParameters; +use LaravelJsonApi\Validation\Rule as JsonApiRule; + +/** + * Class ChartRequest + */ +class ChartRequest extends FormRequest +{ + use ChecksLogin; + use ConvertsDataTypes; + use ValidatesUserGroupTrait; + use ParsesQueryFilters; + + protected array $acceptedRoles = [UserRoleEnum::READ_ONLY]; + + public function getParameters(): array + { + $queryParameters = QueryParameters::cast($this->all()); + return [ + 'start' => $this->dateOrToday($queryParameters, 'start'), + 'end' => $this->dateOrToday($queryParameters, 'end'), + + // preselected heeft maar een paar toegestane waardes. + +// 'query' => $this->arrayOfStrings($queryParameters, 'query'), +// 'size' => $this->integerFromQueryParams($queryParameters,'size', 50), +// 'account_types' => $this->getAccountTypeParameter($this->arrayOfStrings($queryParameters, 'account_types')), + ]; + } + +// return [ +// 'accounts' => $this->getAccountList(), +// 'preselected' => $this->convertString('preselected'), +// ]; +// } + + /** + * The rules that the incoming request must be matched against. + */ + public function rules(): array + { + return [ + 'fields' => JsonApiRule::notSupported(), + 'filter' => ['nullable', 'array', new IsValidFilter(['start', 'end', 'preselected','accounts'])], + 'include' => JsonApiRule::notSupported(), + 'page' => JsonApiRule::notSupported(), + 'sort' => JsonApiRule::notSupported(), + ]; + +// return [ +// 'start' => 'required|date|after:1900-01-01|before:2099-12-31', +// 'end' => 'required|date|after_or_equal:start|before:2099-12-31|after:1900-01-01', +// 'preselected' => sprintf('in:%s', implode(',', config('firefly.preselected_accounts'))), +// 'accounts.*' => 'exists:accounts,id', +// ]; + } + + public function withValidator(Validator $validator): void + { + $validator->after( + static function (Validator $validator): void { + // validate transaction query data. + $data = $validator->getData(); + if (!array_key_exists('accounts', $data)) { + // $validator->errors()->add('accounts', trans('validation.filled', ['attribute' => 'accounts'])); + return; + } + if (!is_array($data['accounts'])) { + $validator->errors()->add('accounts', trans('validation.filled', ['attribute' => 'accounts'])); + } + } + ); + if ($validator->fails()) { + Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray()); + } + } +} diff --git a/app/JsonApi/Rules/IsValidFilter.php b/app/JsonApi/Rules/IsValidFilter.php index 065d346508..e10e4b6061 100644 --- a/app/JsonApi/Rules/IsValidFilter.php +++ b/app/JsonApi/Rules/IsValidFilter.php @@ -32,6 +32,7 @@ class IsValidFilter implements ValidationRule public function __construct(array $keys) { $this->allowed = $keys; + $this->allowed[] = 'user_group_id'; } #[\Override] @@ -45,7 +46,7 @@ class IsValidFilter implements ValidationRule } foreach ($value as $key => $val) { if (!in_array($key, $this->allowed, true)) { - $fail('validation.bad_api_filter')->translate(); + $fail('validation.bad_api_filter')->translate(['filter' => $key]); } } } diff --git a/app/Support/Http/Api/ParsesQueryFilters.php b/app/Support/Http/Api/ParsesQueryFilters.php new file mode 100644 index 0000000000..4ba27c3d96 --- /dev/null +++ b/app/Support/Http/Api/ParsesQueryFilters.php @@ -0,0 +1,57 @@ +filter()?->value($field, date('Y-m-d')), config('app.timezone')); + } catch (InvalidFormatException $e) { + Log::debug(sprintf('Invalid date format in request. Using today: %s', $e->getMessage())); + } + return $date; + + } + + private function arrayOfStrings(QueryParameters $parameters, string $field): array + { + $array = $parameters->filter()?->value($field, []) ?? []; + return is_string($array) ? [$array] : $array; + } + + private function integerFromQueryParams(QueryParameters $parameters, string $field, int $default): int + { + return (int) ($parameters->page()[$field] ?? $default); + } + +} diff --git a/app/Support/Http/Api/ValidatesUserGroupTrait.php b/app/Support/Http/Api/ValidatesUserGroupTrait.php index 9ea5bf6546..14e7678e1f 100644 --- a/app/Support/Http/Api/ValidatesUserGroupTrait.php +++ b/app/Support/Http/Api/ValidatesUserGroupTrait.php @@ -38,6 +38,11 @@ use Illuminate\Support\Facades\Log; trait ValidatesUserGroupTrait { /** + * An "undocumented" filter + * + * + * TODO add this filter to the API docs. + * * @throws AuthorizationException * @throws AuthenticationException */ @@ -50,6 +55,11 @@ trait ValidatesUserGroupTrait throw new AuthenticationException(); } + + + + + /** @var User $user */ $user = auth()->user(); $groupId = 0; diff --git a/config/firefly.php b/config/firefly.php index 8cceceafac..6342a2b4b1 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -118,7 +118,7 @@ return [ // see cer.php for exchange rates feature flag. ], 'version' => 'develop/2024-05-18', - 'api_version' => '2.0.14', + 'api_version' => '2.1.0', 'db_version' => 24, // generic settings diff --git a/resources/lang/en_US/validation.php b/resources/lang/en_US/validation.php index 141cd04f75..1349ac7a60 100644 --- a/resources/lang/en_US/validation.php +++ b/resources/lang/en_US/validation.php @@ -25,158 +25,159 @@ declare(strict_types=1); return [ - 'bad_type_source' => 'Firefly III can\'t determine the transaction type based on this source account.', - 'bad_type_destination' => 'Firefly III can\'t determine the transaction type based on this destination account.', - 'missing_where' => 'Array is missing "where"-clause', - 'missing_update' => 'Array is missing "update"-clause', - 'invalid_where_key' => 'JSON contains an invalid key for the "where"-clause', - 'invalid_update_key' => 'JSON contains an invalid key for the "update"-clause', - 'invalid_query_data' => 'There is invalid data in the %s:%s field of your query.', - 'invalid_query_account_type' => 'Your query contains accounts of different types, which is not allowed.', - 'invalid_query_currency' => 'Your query contains accounts that have different currency settings, which is not allowed.', - 'iban' => 'This is not a valid IBAN.', - 'zero_or_more' => 'The value cannot be negative.', - 'more_than_zero' => 'The value must be more than zero.', - 'more_than_zero_correct' => 'The value must be zero or more.', - 'no_asset_account' => 'This is not an asset account.', - 'date_or_time' => 'The value must be a valid date or time value (ISO 8601).', - 'source_equals_destination' => 'The source account equals the destination account.', - 'unique_account_number_for_user' => 'It looks like this account number is already in use.', - 'unique_iban_for_user' => 'It looks like this IBAN is already in use.', - 'reconciled_forbidden_field' => 'This transaction is already reconciled, you cannot change the ":field"', - 'deleted_user' => 'Due to security constraints, you cannot register using this email address.', - 'rule_trigger_value' => 'This value is invalid for the selected trigger.', - 'rule_action_expression' => 'Invalid expression. :error', - 'rule_action_value' => 'This value is invalid for the selected action.', - 'file_already_attached' => 'Uploaded file ":name" is already attached to this object.', - 'file_attached' => 'Successfully uploaded file ":name".', - 'file_zero' => 'The file is zero bytes in size.', - 'must_exist' => 'The ID in field :attribute does not exist in the database.', - 'all_accounts_equal' => 'All accounts in this field must be equal.', - 'group_title_mandatory' => 'A group title is mandatory when there is more than one transaction.', - 'transaction_types_equal' => 'All splits must be of the same type.', - 'invalid_transaction_type' => 'Invalid transaction type.', - 'invalid_selection' => 'Your selection is invalid.', - 'belongs_user' => 'This value is linked to an object that does not seem to exist.', - 'belongs_user_or_user_group' => 'This value is linked to an object that does not seem to exist in your current financial administration.', - 'no_access_group' => 'The user has no access to this user group.', - 'no_accepted_roles_defined' => 'No access roles have been defined for this endpoint, access denied.', - 'at_least_one_transaction' => 'Need at least one transaction.', - 'recurring_transaction_id' => 'Need at least one transaction.', - 'need_id_to_match' => 'You need to submit this entry with an ID for the API to be able to match it.', - 'too_many_unmatched' => 'Too many submitted transactions cannot be matched to their respective database entries. Make sure existing entries have a valid ID.', - 'id_does_not_match' => 'Submitted ID #:id does not match expected ID. Make sure it matches or omit the field.', - 'at_least_one_repetition' => 'Need at least one repetition.', - 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeat_until). Not both.', - 'require_currency_info' => 'The content of this field is invalid without currency information.', - 'not_transfer_account' => 'This account is not an account that can be used for transfers.', - 'require_currency_amount' => 'The content of this field is invalid without foreign amount information.', - 'require_foreign_currency' => 'This field requires a number', - 'require_foreign_dest' => 'This field value must match the currency of the destination account.', - 'require_foreign_src' => 'This field value must match the currency of the source account.', - 'equal_description' => 'Transaction description should not equal global description.', - 'file_invalid_mime' => 'File ":name" is of type ":mime" which is not accepted as a new upload.', - 'file_too_large' => 'File ":name" is too large.', - 'belongs_to_user' => 'The value of :attribute is unknown.', - 'accepted' => 'The :attribute must be accepted.', - 'bic' => 'This is not a valid BIC.', - 'at_least_one_trigger' => 'Rule must have at least one trigger.', - 'at_least_one_active_trigger' => 'Rule must have at least one active trigger.', - 'at_least_one_action' => 'Rule must have at least one action.', - 'at_least_one_active_action' => 'Rule must have at least one active action.', - 'base64' => 'This is not valid base64 encoded data.', - 'model_id_invalid' => 'The given ID seems invalid for this model.', - 'less' => ':attribute must be less than 10,000,000', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'date_after' => 'The start date must be before the end date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'unique_for_user' => 'There already is an entry with this :attribute.', - 'before' => 'The :attribute must be a date before :date.', - 'unique_object_for_user' => 'This name is already in use.', - 'unique_account_for_user' => 'This account name is already in use.', + 'bad_api_filter' => 'This API endpoint does not support ":filter" as a filter.', + 'bad_type_source' => 'Firefly III can\'t determine the transaction type based on this source account.', + 'bad_type_destination' => 'Firefly III can\'t determine the transaction type based on this destination account.', + 'missing_where' => 'Array is missing "where"-clause', + 'missing_update' => 'Array is missing "update"-clause', + 'invalid_where_key' => 'JSON contains an invalid key for the "where"-clause', + 'invalid_update_key' => 'JSON contains an invalid key for the "update"-clause', + 'invalid_query_data' => 'There is invalid data in the %s:%s field of your query.', + 'invalid_query_account_type' => 'Your query contains accounts of different types, which is not allowed.', + 'invalid_query_currency' => 'Your query contains accounts that have different currency settings, which is not allowed.', + 'iban' => 'This is not a valid IBAN.', + 'zero_or_more' => 'The value cannot be negative.', + 'more_than_zero' => 'The value must be more than zero.', + 'more_than_zero_correct' => 'The value must be zero or more.', + 'no_asset_account' => 'This is not an asset account.', + 'date_or_time' => 'The value must be a valid date or time value (ISO 8601).', + 'source_equals_destination' => 'The source account equals the destination account.', + 'unique_account_number_for_user' => 'It looks like this account number is already in use.', + 'unique_iban_for_user' => 'It looks like this IBAN is already in use.', + 'reconciled_forbidden_field' => 'This transaction is already reconciled, you cannot change the ":field"', + 'deleted_user' => 'Due to security constraints, you cannot register using this email address.', + 'rule_trigger_value' => 'This value is invalid for the selected trigger.', + 'rule_action_expression' => 'Invalid expression. :error', + 'rule_action_value' => 'This value is invalid for the selected action.', + 'file_already_attached' => 'Uploaded file ":name" is already attached to this object.', + 'file_attached' => 'Successfully uploaded file ":name".', + 'file_zero' => 'The file is zero bytes in size.', + 'must_exist' => 'The ID in field :attribute does not exist in the database.', + 'all_accounts_equal' => 'All accounts in this field must be equal.', + 'group_title_mandatory' => 'A group title is mandatory when there is more than one transaction.', + 'transaction_types_equal' => 'All splits must be of the same type.', + 'invalid_transaction_type' => 'Invalid transaction type.', + 'invalid_selection' => 'Your selection is invalid.', + 'belongs_user' => 'This value is linked to an object that does not seem to exist.', + 'belongs_user_or_user_group' => 'This value is linked to an object that does not seem to exist in your current financial administration.', + 'no_access_group' => 'The user has no access to this user group.', + 'no_accepted_roles_defined' => 'No access roles have been defined for this endpoint, access denied.', + 'at_least_one_transaction' => 'Need at least one transaction.', + 'recurring_transaction_id' => 'Need at least one transaction.', + 'need_id_to_match' => 'You need to submit this entry with an ID for the API to be able to match it.', + 'too_many_unmatched' => 'Too many submitted transactions cannot be matched to their respective database entries. Make sure existing entries have a valid ID.', + 'id_does_not_match' => 'Submitted ID #:id does not match expected ID. Make sure it matches or omit the field.', + 'at_least_one_repetition' => 'Need at least one repetition.', + 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeat_until). Not both.', + 'require_currency_info' => 'The content of this field is invalid without currency information.', + 'not_transfer_account' => 'This account is not an account that can be used for transfers.', + 'require_currency_amount' => 'The content of this field is invalid without foreign amount information.', + 'require_foreign_currency' => 'This field requires a number', + 'require_foreign_dest' => 'This field value must match the currency of the destination account.', + 'require_foreign_src' => 'This field value must match the currency of the source account.', + 'equal_description' => 'Transaction description should not equal global description.', + 'file_invalid_mime' => 'File ":name" is of type ":mime" which is not accepted as a new upload.', + 'file_too_large' => 'File ":name" is too large.', + 'belongs_to_user' => 'The value of :attribute is unknown.', + 'accepted' => 'The :attribute must be accepted.', + 'bic' => 'This is not a valid BIC.', + 'at_least_one_trigger' => 'Rule must have at least one trigger.', + 'at_least_one_active_trigger' => 'Rule must have at least one active trigger.', + 'at_least_one_action' => 'Rule must have at least one action.', + 'at_least_one_active_action' => 'Rule must have at least one active action.', + 'base64' => 'This is not valid base64 encoded data.', + 'model_id_invalid' => 'The given ID seems invalid for this model.', + 'less' => ':attribute must be less than 10,000,000', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'date_after' => 'The start date must be before the end date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'unique_for_user' => 'There already is an entry with this :attribute.', + 'before' => 'The :attribute must be a date before :date.', + 'unique_object_for_user' => 'This name is already in use.', + 'unique_account_for_user' => 'This account name is already in use.', // Ignore this comment - 'between.numeric' => 'The :attribute must be between :min and :max.', - 'between.file' => 'The :attribute must be between :min and :max kilobytes.', - 'between.string' => 'The :attribute must be between :min and :max characters.', - 'between.array' => 'The :attribute must have between :min and :max items.', - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'email' => 'The :attribute must be a valid email address.', - 'filled' => 'The :attribute field is required.', - 'exists' => 'The selected :attribute is invalid.', - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'max.numeric' => 'The :attribute may not be greater than :max.', - 'max.file' => 'The :attribute may not be greater than :max kilobytes.', - 'max.string' => 'The :attribute may not be greater than :max characters.', - 'max.array' => 'The :attribute may not have more than :max items.', - 'mimes' => 'The :attribute must be a file of type: :values.', - 'min.numeric' => 'The :attribute must be at least :min.', - 'lte.numeric' => 'The :attribute must be less than or equal :value.', - 'min.file' => 'The :attribute must be at least :min kilobytes.', - 'min.string' => 'The :attribute must be at least :min characters.', - 'min.array' => 'The :attribute must have at least :min items.', - 'not_in' => 'The selected :attribute is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'scientific_notation' => 'The :attribute cannot use the scientific notation.', - 'numeric_native' => 'The native amount must be a number.', - 'numeric_destination' => 'The destination amount must be a number.', - 'numeric_source' => 'The source amount must be a number.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values is present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size.numeric' => 'The :attribute must be :size.', - 'amount_min_over_max' => 'The minimum amount cannot be larger than the maximum amount.', - 'size.file' => 'The :attribute must be :size kilobytes.', - 'size.string' => 'The :attribute must be :size characters.', - 'size.array' => 'The :attribute must contain :size items.', - 'unique' => 'The :attribute has already been taken.', - 'string' => 'The :attribute must be a string.', - 'url' => 'The :attribute format is invalid.', - 'timezone' => 'The :attribute must be a valid zone.', - '2fa_code' => 'The :attribute field is invalid.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'file' => 'The :attribute must be a file.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'present' => 'The :attribute field must be present.', - 'amount_zero' => 'The total amount cannot be zero.', - 'current_target_amount' => 'The current amount must be less than the target amount.', - 'unique_piggy_bank_for_user' => 'The name of the piggy bank must be unique.', - 'unique_object_group' => 'The group name must be unique', - 'starts_with' => 'The value must start with :values.', - 'unique_webhook' => 'You already have a webhook with this combination of URL, trigger, response and delivery.', - 'unique_existing_webhook' => 'You already have another webhook with this combination of URL, trigger, response and delivery.', - 'same_account_type' => 'Both accounts must be of the same account type', - 'same_account_currency' => 'Both accounts must have the same currency setting', + 'between.numeric' => 'The :attribute must be between :min and :max.', + 'between.file' => 'The :attribute must be between :min and :max kilobytes.', + 'between.string' => 'The :attribute must be between :min and :max characters.', + 'between.array' => 'The :attribute must have between :min and :max items.', + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'email' => 'The :attribute must be a valid email address.', + 'filled' => 'The :attribute field is required.', + 'exists' => 'The selected :attribute is invalid.', + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'json' => 'The :attribute must be a valid JSON string.', + 'max.numeric' => 'The :attribute may not be greater than :max.', + 'max.file' => 'The :attribute may not be greater than :max kilobytes.', + 'max.string' => 'The :attribute may not be greater than :max characters.', + 'max.array' => 'The :attribute may not have more than :max items.', + 'mimes' => 'The :attribute must be a file of type: :values.', + 'min.numeric' => 'The :attribute must be at least :min.', + 'lte.numeric' => 'The :attribute must be less than or equal :value.', + 'min.file' => 'The :attribute must be at least :min kilobytes.', + 'min.string' => 'The :attribute must be at least :min characters.', + 'min.array' => 'The :attribute must have at least :min items.', + 'not_in' => 'The selected :attribute is invalid.', + 'numeric' => 'The :attribute must be a number.', + 'scientific_notation' => 'The :attribute cannot use the scientific notation.', + 'numeric_native' => 'The native amount must be a number.', + 'numeric_destination' => 'The destination amount must be a number.', + 'numeric_source' => 'The source amount must be a number.', + 'regex' => 'The :attribute format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values is present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute and :other must match.', + 'size.numeric' => 'The :attribute must be :size.', + 'amount_min_over_max' => 'The minimum amount cannot be larger than the maximum amount.', + 'size.file' => 'The :attribute must be :size kilobytes.', + 'size.string' => 'The :attribute must be :size characters.', + 'size.array' => 'The :attribute must contain :size items.', + 'unique' => 'The :attribute has already been taken.', + 'string' => 'The :attribute must be a string.', + 'url' => 'The :attribute format is invalid.', + 'timezone' => 'The :attribute must be a valid zone.', + '2fa_code' => 'The :attribute field is invalid.', + 'dimensions' => 'The :attribute has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'file' => 'The :attribute must be a file.', + 'in_array' => 'The :attribute field does not exist in :other.', + 'present' => 'The :attribute field must be present.', + 'amount_zero' => 'The total amount cannot be zero.', + 'current_target_amount' => 'The current amount must be less than the target amount.', + 'unique_piggy_bank_for_user' => 'The name of the piggy bank must be unique.', + 'unique_object_group' => 'The group name must be unique', + 'starts_with' => 'The value must start with :values.', + 'unique_webhook' => 'You already have a webhook with this combination of URL, trigger, response and delivery.', + 'unique_existing_webhook' => 'You already have another webhook with this combination of URL, trigger, response and delivery.', + 'same_account_type' => 'Both accounts must be of the same account type', + 'same_account_currency' => 'Both accounts must have the same currency setting', // Ignore this comment - 'secure_password' => 'This is not a secure password. Please try again. For more information, visit https://bit.ly/FF3-password', - 'valid_recurrence_rep_type' => 'Invalid repetition type for recurring transactions.', - 'valid_recurrence_rep_moment' => 'Invalid repetition moment for this type of repetition.', - 'invalid_account_info' => 'Invalid account information.', - 'attributes' => [ + 'secure_password' => 'This is not a secure password. Please try again. For more information, visit https://bit.ly/FF3-password', + 'valid_recurrence_rep_type' => 'Invalid repetition type for recurring transactions.', + 'valid_recurrence_rep_moment' => 'Invalid repetition moment for this type of repetition.', + 'invalid_account_info' => 'Invalid account information.', + 'attributes' => [ 'email' => 'email address', 'description' => 'description', 'amount' => 'amount', @@ -215,58 +216,58 @@ return [ ], // validation of accounts: - 'withdrawal_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.', - 'withdrawal_source_bad_data' => '[a] Could not find a valid source account when searching for ID ":id" or name ":name".', - 'withdrawal_dest_need_data' => '[a] Need to get a valid destination account ID and/or valid destination account name to continue.', - 'withdrawal_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".', + 'withdrawal_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.', + 'withdrawal_source_bad_data' => '[a] Could not find a valid source account when searching for ID ":id" or name ":name".', + 'withdrawal_dest_need_data' => '[a] Need to get a valid destination account ID and/or valid destination account name to continue.', + 'withdrawal_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".', - 'withdrawal_dest_iban_exists' => 'This destination account IBAN is already in use by an asset account or a liability and cannot be used as a withdrawal destination.', - 'deposit_src_iban_exists' => 'This source account IBAN is already in use by an asset account or a liability and cannot be used as a deposit source.', + 'withdrawal_dest_iban_exists' => 'This destination account IBAN is already in use by an asset account or a liability and cannot be used as a withdrawal destination.', + 'deposit_src_iban_exists' => 'This source account IBAN is already in use by an asset account or a liability and cannot be used as a deposit source.', - 'reconciliation_source_bad_data' => 'Could not find a valid reconciliation account when searching for ID ":id" or name ":name".', + 'reconciliation_source_bad_data' => 'Could not find a valid reconciliation account when searching for ID ":id" or name ":name".', - 'generic_source_bad_data' => '[e] Could not find a valid source account when searching for ID ":id" or name ":name".', + 'generic_source_bad_data' => '[e] Could not find a valid source account when searching for ID ":id" or name ":name".', - 'deposit_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.', - 'deposit_source_bad_data' => '[b] Could not find a valid source account when searching for ID ":id" or name ":name".', - 'deposit_dest_need_data' => '[b] Need to get a valid destination account ID and/or valid destination account name to continue.', - 'deposit_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".', - 'deposit_dest_wrong_type' => 'The submitted destination account is not of the right type.', + 'deposit_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.', + 'deposit_source_bad_data' => '[b] Could not find a valid source account when searching for ID ":id" or name ":name".', + 'deposit_dest_need_data' => '[b] Need to get a valid destination account ID and/or valid destination account name to continue.', + 'deposit_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".', + 'deposit_dest_wrong_type' => 'The submitted destination account is not of the right type.', // Ignore this comment - 'transfer_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.', - 'transfer_source_bad_data' => '[c] Could not find a valid source account when searching for ID ":id" or name ":name".', - 'transfer_dest_need_data' => '[c] Need to get a valid destination account ID and/or valid destination account name to continue.', - 'transfer_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".', - 'need_id_in_edit' => 'Each split must have transaction_journal_id (either valid ID or 0).', + 'transfer_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.', + 'transfer_source_bad_data' => '[c] Could not find a valid source account when searching for ID ":id" or name ":name".', + 'transfer_dest_need_data' => '[c] Need to get a valid destination account ID and/or valid destination account name to continue.', + 'transfer_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".', + 'need_id_in_edit' => 'Each split must have transaction_journal_id (either valid ID or 0).', - 'ob_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.', - 'lc_source_need_data' => 'Need to get a valid source account ID to continue.', - 'ob_dest_need_data' => '[d] Need to get a valid destination account ID and/or valid destination account name to continue.', - 'ob_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".', - 'reconciliation_either_account' => 'To submit a reconciliation, you must submit either a source or a destination account. Not both, not neither.', + 'ob_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.', + 'lc_source_need_data' => 'Need to get a valid source account ID to continue.', + 'ob_dest_need_data' => '[d] Need to get a valid destination account ID and/or valid destination account name to continue.', + 'ob_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".', + 'reconciliation_either_account' => 'To submit a reconciliation, you must submit either a source or a destination account. Not both, not neither.', - 'generic_invalid_source' => 'You can\'t use this account as the source account.', - 'generic_invalid_destination' => 'You can\'t use this account as the destination account.', + 'generic_invalid_source' => 'You can\'t use this account as the source account.', + 'generic_invalid_destination' => 'You can\'t use this account as the destination account.', - 'generic_no_source' => 'You must submit source account information or submit a transaction journal ID.', - 'generic_no_destination' => 'You must submit destination account information or submit a transaction journal ID.', + 'generic_no_source' => 'You must submit source account information or submit a transaction journal ID.', + 'generic_no_destination' => 'You must submit destination account information or submit a transaction journal ID.', - 'gte.numeric' => 'The :attribute must be greater than or equal to :value.', - 'gt.numeric' => 'The :attribute must be greater than :value.', - 'gte.file' => 'The :attribute must be greater than or equal to :value kilobytes.', - 'gte.string' => 'The :attribute must be greater than or equal to :value characters.', - 'gte.array' => 'The :attribute must have :value items or more.', + 'gte.numeric' => 'The :attribute must be greater than or equal to :value.', + 'gt.numeric' => 'The :attribute must be greater than :value.', + 'gte.file' => 'The :attribute must be greater than or equal to :value kilobytes.', + 'gte.string' => 'The :attribute must be greater than or equal to :value characters.', + 'gte.array' => 'The :attribute must have :value items or more.', 'amount_required_for_auto_budget' => 'The amount is required.', 'auto_budget_amount_positive' => 'The amount must be more than zero.', - 'auto_budget_period_mandatory' => 'The auto budget period is a mandatory field.', + 'auto_budget_period_mandatory' => 'The auto budget period is a mandatory field.', // no access to administration: - 'no_access_user_group' => 'You do not have the correct access rights for this administration.', - 'administration_owner_rename' => 'You can\'t rename your standard administration.', + 'no_access_user_group' => 'You do not have the correct access rights for this administration.', + 'administration_owner_rename' => 'You can\'t rename your standard administration.', ]; // Ignore this comment