Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '7.2', '7.3', '7.4' ]
mysql: [ '5.7', '8.0' ]
php: [ '7.4' ]
mysql: [ '8.0' ]

env:
NC3_BUILD_DIR: "/opt/nc3"
Expand Down
5 changes: 3 additions & 2 deletions Model/Behavior/QuestionnaireAnswerTextBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function answerMaxLength($model, $data, $question, $max) {
* @param array $question 回答データに対応する質問
* @param array $allAnswers 入力された回答すべて
* @return bool
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function answerTextValidation($model, $data, $question, $allAnswers) {
if (! in_array($question['question_type'], $this->_textValidateType)) {
Expand All @@ -77,7 +78,7 @@ public function answerTextValidation($model, $data, $question, $allAnswers) {
$ret = true;
// 数値型回答を望まれている場合
if ($question['question_type_option'] == QuestionnairesComponent::TYPE_OPTION_NUMERIC) {
if (!Validation::numeric($data['answer_value'])) {
if (mb_strlen($data['answer_value']) !== 0 && !Validation::numeric($data['answer_value'])) {
$ret = false;
$model->validationErrors['answer_value'][] = __d('questionnaires', 'Number required');
}
Expand All @@ -86,7 +87,7 @@ public function answerTextValidation($model, $data, $question, $allAnswers) {
$data['answer_value'],
intval($question['min']),
intval($question['max']));
if (!$rangeRes) {
if (mb_strlen($data['answer_value']) !== 0 && !$rangeRes) {
$ret = false;
$model->validationErrors['answer_value'][] = __d('questionnaires',
'Please enter the answer between %s and %s.',
Expand Down