mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix issue validating budget amounts.
This commit is contained in:
parent
09a25957d0
commit
85bde79fd1
@ -157,7 +157,6 @@ class CreateController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,6 @@ class EditController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string) trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string) trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,6 @@ class CreateController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,6 @@ class EditController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string) trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string) trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,6 @@ class CreateController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,6 @@ class EditController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,6 @@ class CreateController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,6 @@ class EditController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,21 +121,4 @@ abstract class Controller extends BaseController
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function auditLogAttachmentInfo(?array $files): void
|
|
||||||
{
|
|
||||||
if (null === $files) {
|
|
||||||
Log::channel('audit')->info('No files found');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int $index
|
|
||||||
* @var UploadedFile $file
|
|
||||||
*/
|
|
||||||
foreach ($files as $index => $file) {
|
|
||||||
Log::channel('audit')->info(sprintf('File [%d/%d] upload attachment "%s", mime is: "%s".', $index + 1, count($files), $file->getClientOriginalName(), $file->getMimeType()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,6 @@ class CreateController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,6 @@ class EditController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,6 @@ class CreateController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,6 @@ class EditController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,6 @@ class TagController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +341,6 @@ class TagController extends Controller
|
|||||||
}
|
}
|
||||||
if (null !== $files && auth()->user()->hasRole('demo')) {
|
if (null !== $files && auth()->user()->hasRole('demo')) {
|
||||||
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__));
|
||||||
$this->auditLogAttachmentInfo($files);
|
|
||||||
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,12 @@ trait ValidatesAutoBudgetRequest
|
|||||||
if ('' === $type || 0 === $type) {
|
if ('' === $type || 0 === $type) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// TODO should be present at more places, stop scientific notification
|
||||||
|
if (str_contains(strtoupper($amount), 'E')) {
|
||||||
|
$amount = '';
|
||||||
|
}
|
||||||
// basic float check:
|
// basic float check:
|
||||||
if (!is_numeric($amount)) {
|
if (!is_numeric($amount) || '' === $amount) {
|
||||||
$validator->errors()->add('auto_budget_amount', (string) trans('validation.amount_required_for_auto_budget'));
|
$validator->errors()->add('auto_budget_amount', (string) trans('validation.amount_required_for_auto_budget'));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user