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
8dfadeca
Commit
8dfadeca
authored
Apr 18, 2016
by
Carsten Rose
Browse files
FillStoreForm.php, Constants.php: fixed bug that empty values are not stored.
parent
2d0d6fc3
Changes
2
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/Constants.php
View file @
8dfadeca
...
@@ -129,6 +129,7 @@ const ERROR_UNKNOWN_SQL_LOG_MODE = 1051;
...
@@ -129,6 +129,7 @@ const ERROR_UNKNOWN_SQL_LOG_MODE = 1051;
const
ERROR_FORM_NOT_FOUND
=
1052
;
const
ERROR_FORM_NOT_FOUND
=
1052
;
const
ERROR_DATE_TIME_FORMAT_NOT_RECOGNISED
=
1053
;
const
ERROR_DATE_TIME_FORMAT_NOT_RECOGNISED
=
1053
;
const
ERROR_SANATIZE_INVALID_VALUE
=
1054
;
const
ERROR_SANATIZE_INVALID_VALUE
=
1054
;
const
ERROR_REQUIRED_VALUE_EMPTY
=
1055
;
// Store
// Store
const
ERROR_STORE_VALUE_ALREADY_CODPIED
=
1100
;
const
ERROR_STORE_VALUE_ALREADY_CODPIED
=
1100
;
...
...
extension/qfq/qfq/store/FillStoreForm.php
View file @
8dfadeca
...
@@ -106,12 +106,18 @@ class FillStoreForm {
...
@@ -106,12 +106,18 @@ class FillStoreForm {
continue
;
continue
;
}
}
if
(
$formElement
[
'mode'
]
===
FE_MODE_REQUIRED
)
{
if
(
!
isset
(
$clientValues
[
$clientFieldName
])
||
(
$clientValues
[
$clientFieldName
]
===
''
))
{
throw
new
UserFormException
(
"Missing required value."
,
ERROR_REQUIRED_VALUE_EMPTY
);
}
}
switch
(
$formElement
[
'mode'
])
{
switch
(
$formElement
[
'mode'
])
{
case
FE_MODE_SHOW
:
case
FE_MODE_REQUIRED
:
case
FE_MODE_REQUIRED
:
if
(
isset
(
$clientValues
[
$clientFieldName
])
&&
(
$clientValues
[
$clientFieldName
]
!=
''
))
{
case
FE_MODE_SHOW
:
if
(
isset
(
$clientValues
[
$clientFieldName
]))
{
// SELECT
with multiple values, or Multi
CHECKBOX
are
delivered as array
:
implode them
// SELECT
MULTI or
CHECKBOX
MULTI:
delivered as array
-
implode them
.
if
(
is_array
(
$clientValues
[
$clientFieldName
]))
{
if
(
is_array
(
$clientValues
[
$clientFieldName
]))
{
// E.g. Checkboxes needs a 'HIDDEN' HTML input to detect 'unset' of values. These 'HIDDEN' element
// E.g. Checkboxes needs a 'HIDDEN' HTML input to detect 'unset' of values. These 'HIDDEN' element
// needs to be removed, if there is at least one checkbox is checked (=submitted)
// needs to be removed, if there is at least one checkbox is checked (=submitted)
...
@@ -121,18 +127,8 @@ class FillStoreForm {
...
@@ -121,18 +127,8 @@ class FillStoreForm {
$clientValues
[
$clientFieldName
]
=
implode
(
','
,
$clientValues
[
$clientFieldName
]);
$clientValues
[
$clientFieldName
]
=
implode
(
','
,
$clientValues
[
$clientFieldName
]);
}
}
// try {
$newValues
[
$formElement
[
'name'
]]
=
Sanitize
::
sanitize
(
$clientValues
[
$clientFieldName
],
$newValues
[
$formElement
[
'name'
]]
=
Sanitize
::
sanitize
(
$clientValues
[
$clientFieldName
],
$formElement
[
'checkType'
],
$formElement
[
'checkPattern'
],
SANATIZE_EXCEPTION
);
$formElement
[
'checkType'
],
$formElement
[
'checkPattern'
],
SANATIZE_EXCEPTION
);
// } catch (UserFormException $e) {
// $msg = "Form element '" . $formElement['name'] . ' / ' . $formElement['label'] . "': " . $e->formatMessage();
// throw new UserFormException($msg, ERROR_SANATIZE_INVALID_VALUE);
// }
}
else
{
if
(
$formElement
[
'mode'
]
===
FE_MODE_REQUIRED
)
{
throw
new
UserFormException
(
"Missing required value for '"
.
$formElement
[
'name'
]
.
' / '
.
$formElement
[
'label'
]
.
"'"
,
ERROR_UNKNOWN_MODE
);
}
}
}
break
;
break
;
...
...
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