mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix validation for #3532
This commit is contained in:
parent
26d19fab32
commit
32e0a5bd80
@ -67,7 +67,7 @@ class AvailableBudgetRequest extends Request
|
||||
return [
|
||||
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'amount' => 'required|numeric|more:0',
|
||||
'amount' => 'required|numeric|gt:0',
|
||||
'start' => 'required|date|before:end',
|
||||
'end' => 'required|date|after:start',
|
||||
];
|
||||
|
@ -85,8 +85,8 @@ class BillRequest extends Request
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'between:1,255|uniqueObjectForUser:bills,name',
|
||||
'amount_min' => 'numeric|more:0',
|
||||
'amount_max' => 'numeric|more:0',
|
||||
'amount_min' => 'numeric|gt:0',
|
||||
'amount_max' => 'numeric|gt:0',
|
||||
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'date' => 'date',
|
||||
|
@ -70,7 +70,7 @@ class BudgetLimitRequest extends Request
|
||||
'budget_id' => 'required|exists:budgets,id|belongsToUser:budgets,id',
|
||||
'start' => 'required|before:end|date',
|
||||
'end' => 'required|after:start|date',
|
||||
'amount' => 'required|more:0',
|
||||
'amount' => 'required|gt:0',
|
||||
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
];
|
||||
|
@ -91,7 +91,7 @@ class PiggyBankRequest extends Request
|
||||
$piggyBank = $this->route()->parameter('piggyBank');
|
||||
$rules['name'] = 'between:1,255|uniquePiggyBankForUser:' . $piggyBank->id;
|
||||
$rules['account_id'] = ['belongsToUser:accounts', new IsAssetAccountId];
|
||||
$rules['target_amount'] = 'numeric|more:0';
|
||||
$rules['target_amount'] = 'numeric|gt:0';
|
||||
$rules['current_amount'] = ['numeric', new ZeroOrMore, new LessThanPiggyTarget];
|
||||
break;
|
||||
}
|
||||
|
@ -104,8 +104,8 @@ class RecurrenceStoreRequest extends Request
|
||||
'repetitions.*.skip' => 'required|numeric|between:0,31',
|
||||
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
|
||||
'transactions.*.description' => 'required|between:1,255',
|
||||
'transactions.*.amount' => 'required|numeric|more:0',
|
||||
'transactions.*.foreign_amount' => 'numeric|more:0',
|
||||
'transactions.*.amount' => 'required|numeric|gt:0',
|
||||
'transactions.*.foreign_amount' => 'numeric|gt:0',
|
||||
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
|
@ -107,8 +107,8 @@ class RecurrenceUpdateRequest extends Request
|
||||
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
|
||||
|
||||
'transactions.*.description' => 'required|between:1,255',
|
||||
'transactions.*.amount' => 'required|numeric|more:0',
|
||||
'transactions.*.foreign_amount' => 'numeric|more:0',
|
||||
'transactions.*.amount' => 'required|numeric|gt:0',
|
||||
'transactions.*.foreign_amount' => 'numeric|gt:0',
|
||||
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||
|
@ -51,7 +51,7 @@ class TransferRequest extends Request
|
||||
return [
|
||||
'source' => ['required', new IsTransferAccount],
|
||||
'destination' => ['required', new IsTransferAccount],
|
||||
'amount' => 'required|numeric|more:0',
|
||||
'amount' => 'required|numeric|gt:0',
|
||||
'description' => 'required|min:1',
|
||||
'date' => 'required|date',
|
||||
];
|
||||
|
@ -98,7 +98,7 @@ class TransactionStoreRequest extends Request
|
||||
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code|nullable',
|
||||
|
||||
// amount
|
||||
'transactions.*.amount' => 'required|numeric|more:0',
|
||||
'transactions.*.amount' => 'required|numeric|gt:0',
|
||||
'transactions.*.foreign_amount' => 'numeric',
|
||||
|
||||
// description
|
||||
|
@ -172,7 +172,7 @@ class TransactionUpdateRequest extends Request
|
||||
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
|
||||
|
||||
// amount
|
||||
'transactions.*.amount' => 'numeric|more:0|max:100000000000',
|
||||
'transactions.*.amount' => 'numeric|gt:0|max:100000000000',
|
||||
'transactions.*.foreign_amount' => 'numeric|gte:0',
|
||||
|
||||
// description
|
||||
|
@ -69,8 +69,8 @@ class BillStoreRequest extends Request
|
||||
{
|
||||
return [
|
||||
'name' => 'required|between:1,255|uniqueObjectForUser:bills,name',
|
||||
'amount_min' => 'required|numeric|more:0|max:1000000000',
|
||||
'amount_max' => 'required|numeric|more:0|max:1000000000',
|
||||
'amount_min' => 'required|numeric|gt:0|max:1000000000',
|
||||
'amount_max' => 'required|numeric|gt:0|max:1000000000',
|
||||
'transaction_currency_id' => 'required|exists:transaction_currencies,id',
|
||||
'date' => 'required|date',
|
||||
'repeat_freq' => 'required|in:weekly,monthly,quarterly,half-year,yearly',
|
||||
|
@ -74,8 +74,8 @@ class BillUpdateRequest extends Request
|
||||
|
||||
return [
|
||||
'name' => sprintf('required|between:1,255|uniqueObjectForUser:bills,name,%d', $bill->id),
|
||||
'amount_min' => 'required|numeric|more:0|max:1000000000',
|
||||
'amount_max' => 'required|numeric|more:0|max:1000000000',
|
||||
'amount_min' => 'required|numeric|gt:0|max:1000000000',
|
||||
'amount_max' => 'required|numeric|gt:0|max:1000000000',
|
||||
'transaction_currency_id' => 'required|exists:transaction_currencies,id',
|
||||
'date' => 'required|date',
|
||||
'repeat_freq' => 'required|in:weekly,monthly,quarterly,half-year,yearly',
|
||||
|
@ -160,7 +160,7 @@ class RecurrenceFormRequest extends Request
|
||||
'transaction_description' => 'required|between:1,255',
|
||||
'transaction_type' => 'required|in:withdrawal,deposit,transfer',
|
||||
'transaction_currency_id' => 'required|exists:transaction_currencies,id',
|
||||
'amount' => 'numeric|required|more:0|max:1000000000',
|
||||
'amount' => 'numeric|required|gt:0|max:1000000000',
|
||||
// mandatory account info:
|
||||
'source_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
||||
'source_name' => 'between:1,255|nullable',
|
||||
@ -168,7 +168,7 @@ class RecurrenceFormRequest extends Request
|
||||
'destination_name' => 'between:1,255|nullable',
|
||||
|
||||
// foreign amount data:
|
||||
'foreign_amount' => 'nullable|more:0|max:1000000000',
|
||||
'foreign_amount' => 'nullable|gt:0|max:1000000000',
|
||||
|
||||
// optional fields:
|
||||
'budget_id' => 'mustExist:budgets,id|belongsToUser:budgets,id|nullable',
|
||||
|
@ -57,7 +57,6 @@ return [
|
||||
'at_least_one_action' => 'Rule must have at least one action.',
|
||||
'base64' => 'This is not valid base64 encoded data.',
|
||||
'model_id_invalid' => 'The given ID seems invalid for this model.',
|
||||
'more' => ':attribute must be larger than ":more".',
|
||||
'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.',
|
||||
@ -199,6 +198,7 @@ return [
|
||||
'generic_invalid_destination' => 'You can\'t use this account as the destination account.',
|
||||
|
||||
'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.',
|
||||
|
Loading…
Reference in New Issue
Block a user