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 @@ -32,8 +32,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '7.1', '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/RegistrationAnswerTextBehavior.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'] == RegistrationsComponent::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('registrations', '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'][] = sprintf(
__d('registrations', 'Please enter the answer between %s and %s.'),
Expand Down