mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Code for #522
This commit is contained in:
@@ -67,8 +67,8 @@ class BillFormRequest extends Request
|
|||||||
$rules = [
|
$rules = [
|
||||||
'name' => $nameRule,
|
'name' => $nameRule,
|
||||||
'match' => $matchRule,
|
'match' => $matchRule,
|
||||||
'amount_min' => 'required|numeric|min:0.01',
|
'amount_min' => 'required|numeric|more:0',
|
||||||
'amount_max' => 'required|numeric|min:0.01',
|
'amount_max' => 'required|numeric|more:0',
|
||||||
'amount_currency_id_amount_min' => 'required|exists:transaction_currencies,id',
|
'amount_currency_id_amount_min' => 'required|exists:transaction_currencies,id',
|
||||||
'amount_currency_id_amount_max' => 'required|exists:transaction_currencies,id',
|
'amount_currency_id_amount_max' => 'required|exists:transaction_currencies,id',
|
||||||
'date' => 'required|date',
|
'date' => 'required|date',
|
||||||
|
@@ -94,7 +94,7 @@ class JournalFormRequest extends Request
|
|||||||
'notes' => 'min:1,max:50000',
|
'notes' => 'min:1,max:50000',
|
||||||
// and then transaction rules:
|
// and then transaction rules:
|
||||||
'description' => 'required|between:1,255',
|
'description' => 'required|between:1,255',
|
||||||
'amount' => 'numeric|required|min:0.01',
|
'amount' => 'numeric|required|more:0',
|
||||||
'budget_id' => 'mustExist:budgets,id|belongsToUser:budgets,id',
|
'budget_id' => 'mustExist:budgets,id|belongsToUser:budgets,id',
|
||||||
'category' => 'between:1,255',
|
'category' => 'between:1,255',
|
||||||
'source_account_id' => 'numeric|belongsToUser:accounts,id',
|
'source_account_id' => 'numeric|belongsToUser:accounts,id',
|
||||||
|
@@ -63,7 +63,7 @@ class PiggyBankFormRequest extends Request
|
|||||||
$rules = [
|
$rules = [
|
||||||
'name' => $nameRule,
|
'name' => $nameRule,
|
||||||
'account_id' => 'required|belongsToUser:accounts',
|
'account_id' => 'required|belongsToUser:accounts',
|
||||||
'targetamount' => 'required|min:0.01',
|
'targetamount' => 'required|numeric|more:0',
|
||||||
'amount_currency_id_targetamount' => 'required|exists:transaction_currencies,id',
|
'amount_currency_id_targetamount' => 'required|exists:transaction_currencies,id',
|
||||||
'startdate' => 'date',
|
'startdate' => 'date',
|
||||||
'targetdate' => $targetDateRule,
|
'targetdate' => $targetDateRule,
|
||||||
|
@@ -496,9 +496,6 @@ class ExpandedForm
|
|||||||
$classes = $this->getHolderClasses($name);
|
$classes = $this->getHolderClasses($name);
|
||||||
$value = $this->fillFieldValue($name, $value);
|
$value = $this->fillFieldValue($name, $value);
|
||||||
$options['step'] = 'any';
|
$options['step'] = 'any';
|
||||||
if ($view !== 'balance') {
|
|
||||||
$options['min'] = '0.01';
|
|
||||||
}
|
|
||||||
$defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();
|
$defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();
|
||||||
$currencies = Amt::getAllCurrencies();
|
$currencies = Amt::getAllCurrencies();
|
||||||
unset($options['currency']);
|
unset($options['currency']);
|
||||||
|
@@ -147,6 +147,20 @@ class FireflyValidator extends Validator
|
|||||||
return (intval($checksum) === 1);
|
return (intval($checksum) === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $attribute
|
||||||
|
* @param $value
|
||||||
|
* @param $parameters
|
||||||
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function validateMore($attribute, $value, $parameters): bool
|
||||||
|
{
|
||||||
|
$compare = $parameters[0] ?? '0';
|
||||||
|
return bccomp($value, $compare) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||||
* @param $attribute
|
* @param $attribute
|
||||||
|
@@ -23,6 +23,7 @@ return [
|
|||||||
'belongs_to_user' => 'The value of :attribute is unknown',
|
'belongs_to_user' => 'The value of :attribute is unknown',
|
||||||
'accepted' => 'The :attribute must be accepted.',
|
'accepted' => 'The :attribute must be accepted.',
|
||||||
'bic' => 'This is not a valid BIC.',
|
'bic' => 'This is not a valid BIC.',
|
||||||
|
'more' => ':attribute must be larger than zero.',
|
||||||
'active_url' => 'The :attribute is not a valid URL.',
|
'active_url' => 'The :attribute is not a valid URL.',
|
||||||
'after' => 'The :attribute must be a date after :date.',
|
'after' => 'The :attribute must be a date after :date.',
|
||||||
'alpha' => 'The :attribute may only contain letters.',
|
'alpha' => 'The :attribute may only contain letters.',
|
||||||
|
Reference in New Issue
Block a user