Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
4799975f
Commit
4799975f
authored
Feb 08, 2018
by
Elias Villiger
Browse files
Feature #5064 - Throw user form exception on invalid date.
parent
84fd1a0c
Changes
2
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/Constants.php
View file @
4799975f
...
...
@@ -187,6 +187,7 @@ const ERROR_MAX_FILE_SIZE_TOO_BIG = 1082;
const
ERROR_SMALLER_THAN_MIN
=
1083
;
const
ERROR_LARGER_THAN_MAX
=
1084
;
const
ERROR_INVALID_DECIMAL_FORMAT
=
1085
;
const
ERROR_INVALID_DATE
=
1086
;
// Subrecord
const
ERROR_SUBRECORD_MISSING_COLUMN_ID
=
1100
;
...
...
extension/qfq/qfq/store/FillStoreForm.php
View file @
4799975f
...
...
@@ -319,9 +319,17 @@ class FillStoreForm {
throw
new
UserFormException
(
"DateTime format not recognized:
$placeholder
/
$value
"
,
ERROR_DATE_TIME_FORMAT_NOT_RECOGNISED
);
}
$showTime
=
$formElement
[
FE_TYPE
]
==
'date'
?
'0'
:
'1'
;
$showTime
=
$formElement
[
FE_TYPE
]
==
FE_TYPE_DATE
?
'0'
:
'1'
;
$value
=
Support
::
convertDateTime
(
$value
,
FORMAT_DATE_INTERNATIONAL
,
'1'
,
$showTime
,
$formElement
[
FE_SHOW_SECONDS
]);
if
(
$formElement
[
FE_TYPE
]
!==
FE_TYPE_TIME
)
{
// Validate date (e.g. 2010-02-31)
$dateValue
=
explode
(
' '
,
$value
)[
0
];
$dateParts
=
explode
(
'-'
,
$dateValue
);
if
(
!
checkdate
(
$dateParts
[
1
],
$dateParts
[
2
],
$dateParts
[
0
]))
throw
new
UserFormException
(
"
$dateValue
is not a valid date."
,
ERROR_INVALID_DATE
);
}
return
$value
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment