Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[survey_accounts] notices, warnings and filter options #8859

Merged
merged 1 commit into from Aug 10, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions modules/survey_accounts/js/survey_accounts_helper.js
Expand Up @@ -16,11 +16,13 @@ $(document).ready(function () {
// Handles cases where there was an error on the page and we're resubmitting
var email2 = $("input[name=Email2]").val();
var email = $("input[name=Email]").val();
if (email.length > 0 && email2.length > 0 && email == email2)
{
$('#email_survey').removeAttr('disabled');
} else {
$('#email_survey').attr('disabled','disabled');
if (email && email2) {
if (email.length > 0 && email2.length > 0 && email == email2)
{
$('#email_survey').removeAttr('disabled');
} else {
$('#email_survey').attr('disabled','disabled');
}
}
// Reset Test_name so that the template can be loaded by ajax below
$("select[name=Test_name]").val("");
Expand Down Expand Up @@ -93,7 +95,7 @@ $(document).ready(function () {
$("#emailContent").val(content);
}
);


});
});
6 changes: 5 additions & 1 deletion modules/survey_accounts/jsx/surveyAccountsIndex.js
Expand Up @@ -112,7 +112,11 @@ class SurveyAccountsIndex extends Component {
options: options.instruments,
}},
{label: 'URL', show: true},
{label: 'Status', show: true},
{label: 'Status', show: true, filter: {
name: 'Status',
type: 'select',
options: options.statusOptions,
}},
];
const addSurvey = () => {
location.href='/survey_accounts/addSurvey/';
Expand Down
9 changes: 5 additions & 4 deletions modules/survey_accounts/php/addsurvey.class.inc
Expand Up @@ -162,8 +162,9 @@ class AddSurvey extends \NDB_Form
];
}
}

if ($_REQUEST['fire_away'] !== 'Create survey') {
if (!isset($_REQUEST['fire_away'])
|| ($_REQUEST['fire_away'] !== 'Create survey')
) {
if (!filter_var(
$values['Email'],
FILTER_VALIDATE_EMAIL
Expand Down Expand Up @@ -241,11 +242,11 @@ class AddSurvey extends \NDB_Form
'CommentID' => $commentID,
]
);
$this->tpl_data['success'] = true;
} catch (\DatabaseException $e) {
error_log($e->getMessage());
$this->tpl_data['success'] = false;
}
$this->tpl_data['success'] = true;

if ($email && ($values['send_email'] == 'true')) {
$config = \NDB_Config::singleton();
Expand Down Expand Up @@ -291,7 +292,7 @@ class AddSurvey extends \NDB_Form
"Instrument",
array_merge(
['' => ''],
\Utility::getDirectInstruments()
\NDB_BVL_Instrument::getDirectEntryInstrumentNamesList($this->loris)
)
);
$this->addBasicText("Email", "Email address");
Expand Down
12 changes: 10 additions & 2 deletions modules/survey_accounts/php/survey_accounts.class.inc
Expand Up @@ -74,14 +74,22 @@ class Survey_Accounts extends \DataFrameworkMenu
*/
public function getFieldOptions() : array
{
$statusOptions = [
'Created' => 'Created',
'Sent' => 'Sent',
'In Progress' => 'In Progress',
'Complete' => 'Complete',
];

$instruments
= \NDB_BVL_Instrument::getDirectEntryInstrumentNamesList(
$this->loris
);

return [
'visits' => \Utility::getVisitList(),
'instruments' => $instruments,
'visits' => \Utility::getVisitList(),
'instruments' => $instruments,
'statusOptions' => $statusOptions,
];
}

Expand Down