Skip to content

Commit bffcae3

Browse files
authored
[LINST] fix survey and date issues (#8858)
Add fields to XIN validation which are not parts of groups
1 parent d7a599b commit bffcae3

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

php/libraries/NDB_BVL_Instrument_LINST.class.inc

+19-4
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,10 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
677677
// The question should be added to the LinstQuestions in this
678678
// order, before the _date is stripped below for standard
679679
// dates to allow XINValidation to recognize the field name
680-
$this->LinstQuestions[$pieces[1]] = ['type' => 'date'];
680+
$this->LinstQuestions[$pieces[1]] = [
681+
'type' => 'date',
682+
'dateFormat' => $dateFormat,
683+
];
681684

682685
if ($dateFormat === 'MonthYear') {
683686
// Shows date without day of month
@@ -980,15 +983,27 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
980983
$q['UserRules'] = true;
981984

982985
switch ($q['type']) {
986+
// Selects (including multiselects), Basic Dates and MonthYears
987+
// are the only type of rules that aren't part of a group
988+
// the rest include a _status element
983989
case 'select':
984-
// Selects are the only type of rules that aren't part
985-
// of a group, the rest include a _status element
986990
$this->XINRegisterRule($question, $rules, $message);
987991
break;
992+
case 'date':
993+
if ($q['dateFormat'] === 'BasicDate'
994+
|| $q['dateFormat'] === 'MonthYear'
995+
) {
996+
$this->XINRegisterRule($question, $rules, $message);
997+
break;
998+
}
988999
default:
1000+
$rules_array = array_merge(
1001+
$rules,
1002+
[$question.'_status{@}=={@}']
1003+
);
9891004
$this->XINRegisterRule(
9901005
$question,
991-
$rules,
1006+
$rules_array,
9921007
$message,
9931008
$question . "_group"
9941009
);

0 commit comments

Comments
 (0)