Skip to content

Commit

Permalink
Merge pull request #7262 from ridz1208/PUSH_21.0.7_INTO_22.0-release
Browse files Browse the repository at this point in the history
Push 21.0.7 into 22.0 release
  • Loading branch information
driusan authored Dec 23, 2020
2 parents d2901e4 + 351c8b6 commit 3328023
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
2 changes: 2 additions & 0 deletions SQL/Archive/21.0/Cleanup/2020-12-18-Remove_survey_emails.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE participant_accounts DROP COLUMN Email;
DELETE FROM history WHERE tbl='participant_accounts' AND col='Email';
4 changes: 0 additions & 4 deletions modules/survey_accounts/jsx/surveyAccountsIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ class SurveyAccountsIndex extends Component {
type: 'select',
options: options.visits,
}},
{label: 'Email', show: true, filter: {
name: 'email',
type: 'text',
}},
{label: 'Instrument', show: true, filter: {
name: 'instrument',
type: 'select',
Expand Down
29 changes: 15 additions & 14 deletions modules/survey_accounts/php/addsurvey.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class AddSurvey extends \NDB_Form
$db = \Database::singleton();

$numCandidates = $db->pselectOne(
"SELECT COUNT(*) FROM candidate
WHERE PSCID=:v_PSCID
"SELECT COUNT(*) FROM candidate
WHERE PSCID=:v_PSCID
AND CandID=:v_CandID AND Active='Y'",
array(
'v_PSCID' => $values['PSCID'],
Expand All @@ -78,9 +78,9 @@ class AddSurvey extends \NDB_Form
}

$numSessions = $db->pselectOne(
"SELECT COUNT(*) FROM session
WHERE CandID=:v_CandID
AND UPPER(Visit_label)=UPPER(:v_VL)
"SELECT COUNT(*) FROM session
WHERE CandID=:v_CandID
AND UPPER(Visit_label)=UPPER(:v_VL)
AND Active='Y'",
array(
'v_CandID' => $values['CandID'],
Expand All @@ -99,8 +99,8 @@ class AddSurvey extends \NDB_Form
$instrument_list = $db->pselect(
"SELECT f.Test_name FROM flag f
JOIN session s on s.ID = f.SessionID
WHERE s.CandID=:v_CandID
AND UPPER(s.Visit_label)=UPPER(:v_VL)
WHERE s.CandID=:v_CandID
AND UPPER(s.Visit_label)=UPPER(:v_VL)
AND s.Active='Y'",
array(
'v_CandID' => $values['CandID'],
Expand Down Expand Up @@ -160,7 +160,9 @@ class AddSurvey extends \NDB_Form
*/
function _process($values)
{
$db = \Database::singleton();
$db = \Database::singleton();
$email = $values['Email'];
unset($values['Email']);
$SessionID = $db->pselectOne(
"SELECT ID FROM session".
" WHERE CandID=:v_CandID AND Visit_label=:v_VL",
Expand Down Expand Up @@ -190,11 +192,11 @@ class AddSurvey extends \NDB_Form

$key = $this->_generateSurveyKey();

$email = false;
$sendEmail = false;
if (isset($_REQUEST['send_email'])) {
$email = true;
$sendEmail = true;
}
if ($email) {
if ($sendEmail) {
$status = 'Sent';
} else {
$status = 'Created';
Expand All @@ -206,7 +208,6 @@ class AddSurvey extends \NDB_Form
array(
'SessionID' => $SessionID,
'Test_name' => $values['Test_name'],
'Email' => $values['Email'],
'Status' => $status,
'OneTimePassword' => $key,
'CommentID' => $commentID,
Expand All @@ -218,7 +219,7 @@ class AddSurvey extends \NDB_Form
}
$this->tpl_data['success'] = true;

if ($email) {
if ($sendEmail) {
$config = \NDB_Config::singleton();
$www = $config->getSetting("www");

Expand All @@ -228,7 +229,7 @@ class AddSurvey extends \NDB_Form
urlencode($key),
'EmailForm' => $values['email_dialog'],
);
\Email::send($values['Email'], 'new_survey.tpl', $msg_data);
\Email::send($email, 'new_survey.tpl', $msg_data);
}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/survey_accounts/php/survey_accounts.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Survey_Accounts extends \NDB_Menu_Filter
function _setupVariables()
{
// the base query
$query = " FROM participant_accounts p
$query = " FROM participant_accounts p
JOIN session s ON (p.SessionID=s.ID)
JOIN candidate c ON (c.CandID=s.CandID)
WHERE c.Active = 'Y'
Expand All @@ -57,11 +57,11 @@ class Survey_Accounts extends \NDB_Menu_Filter
$this->columns = array(
'c.PSCID AS PSCID',
's.Visit_label AS Visit',
'p.Email as Email',
'p.Test_name as SurveyName',
'p.OneTimePassword as URL',
'p.Status',
);

$this->query = $query;
$this->order_by = 'PSCID';
$this->fieldOptions = [
Expand Down

0 comments on commit 3328023

Please # to comment.