close #464 Fixed: 0 Money payment in invoice and bill;
Transfer, Bill, Bill Payment, Bill Total, Payment, Invoice, Invoice Payment, Invoice Total, Revenue.
This commit is contained in:
@ -18,20 +18,36 @@ class ValidationServiceProvider extends ServiceProvider
|
||||
$currency_code = null;
|
||||
|
||||
Validator::extend('currency', function ($attribute, $value, $parameters, $validator) use(&$currency_code) {
|
||||
$status = false;
|
||||
$status = false;
|
||||
|
||||
$currencies = Currency::enabled()->pluck('name', 'code')->toArray();
|
||||
$currencies = Currency::enabled()->pluck('name', 'code')->toArray();
|
||||
|
||||
if (array_key_exists($value, $currencies)) {
|
||||
$status = true;
|
||||
}
|
||||
if (array_key_exists($value, $currencies)) {
|
||||
$status = true;
|
||||
}
|
||||
|
||||
$currency_code = $value;
|
||||
$currency_code = $value;
|
||||
|
||||
return $status;
|
||||
},
|
||||
return $status;
|
||||
},
|
||||
trans('validation.custom.invalid_currency', ['attribute' => $currency_code])
|
||||
);
|
||||
|
||||
$amount = null;
|
||||
|
||||
Validator::extend('amount', function ($attribute, $value, $parameters, $validator) use (&$amount) {
|
||||
$status = false;
|
||||
|
||||
if ($value > 0) {
|
||||
$status = true;
|
||||
}
|
||||
|
||||
$amount = $value;
|
||||
|
||||
return $status;
|
||||
},
|
||||
trans('validation.custom.invalid_amount', ['attribute' => $amount])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user