Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[LINST] fix survey and date issues #8858

Merged
merged 3 commits into from
Dec 12, 2023
Merged
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
23 changes: 19 additions & 4 deletions php/libraries/NDB_BVL_Instrument_LINST.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,10 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
// The question should be added to the LinstQuestions in this
// order, before the _date is stripped below for standard
// dates to allow XINValidation to recognize the field name
$this->LinstQuestions[$pieces[1]] = ['type' => 'date'];
$this->LinstQuestions[$pieces[1]] = [
'type' => 'date',
'dateFormat' => $dateFormat,
];

if ($dateFormat === 'MonthYear') {
// Shows date without day of month
Expand Down Expand Up @@ -978,15 +981,27 @@ class NDB_BVL_Instrument_LINST extends \NDB_BVL_Instrument
$q['UserRules'] = true;

switch ($q['type']) {
// Selects (including multiselects), Basic Dates and MonthYears
// are the only type of rules that aren't part of a group
// the rest include a _status element
case 'select':
// Selects are the only type of rules that aren't part
// of a group, the rest include a _status element
$this->XINRegisterRule($question, $rules, $message);
break;
case 'date':
if ($q['dateFormat'] === 'BasicDate'
|| $q['dateFormat'] === 'MonthYear'
) {
$this->XINRegisterRule($question, $rules, $message);
break;
}
default:
$rules_array = array_merge(
$rules,
[$question.'_status{@}=={@}']
);
$this->XINRegisterRule(
$question,
$rules,
$rules_array,
$message,
$question . "_group"
);
Expand Down
Loading