Skip to content

Commit

Permalink
Fixed issue: Using URL prefill you could post longer strings than all…
Browse files Browse the repository at this point in the history
…owed to a List type question resulting in a DB error
  • Loading branch information
c-schmitz committed Feb 20, 2024
1 parent 695e3e6 commit ccf4d07
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion application/helpers/expressions/em_manager_helper.php
Expand Up @@ -5126,7 +5126,7 @@ private function _UpdateValuesInDatabase($finished = false)
$val = (is_null($value) ? null : $value['value']);
$type = (is_null($value) ? null : $value['type']);
// Clean up the values to cope with database storage requirements : some value are fitered in ProcessCurrentResponses
// @todo fix whole type according to DB : use Yii for this ?
// @todo These validations need to be moved to the question models
switch ($type) {
case Question::QT_D_DATE: //DATE
if (trim((string) $val) == '' || $val == "INVALID") {// otherwise will already be in yyyy-mm-dd format after ProcessCurrentResponses() (not for default value, GET value, Expression set value etc ... cf todo
Expand All @@ -5142,6 +5142,11 @@ private function _UpdateValuesInDatabase($finished = false)
$val = null;
}
break;
case Question::QT_L_LIST: //NUMERICAL QUESTION TYPE
if ($val !== null) {
$val = substr($val, 0, 5);
}
break;
default:
// @todo : control length of DB string, if answers in single choice is valid too (for example) ?
break;
Expand Down

0 comments on commit ccf4d07

Please sign in to comment.