if (!is_array($params) || empty($params)) {
return $voterClause;
}
- $surveyId = CRM_Utils_Array::value('campaign_survey_id', $params);
- $searchVoterFor = CRM_Utils_Array::value('campaign_search_voter_for', $params);
+ $surveyId = $params['campaign_survey_id'] ?? NULL;
+ $searchVoterFor = $params['campaign_search_voter_for'] ?? NULL;
//get the survey activities.
$activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
) {
$voterIds = [];
foreach ($voterActValues as $values) {
- $numOfDays = CRM_Utils_Array::value($values['result'], $recontactInterval);
+ $numOfDays = $recontactInterval[$values['result']] ?? NULL;
if ($numOfDays &&
$values['status_id'] == $completedStatusId
) {
$voterIdCount = count($voterIds);
//create temporary table to store voter ids.
- $tempTableName = CRM_Core_DAO::createTempTableName('civicrm_survey_respondent');
+ $tempTable = CRM_Utils_SQL_TempTable::build();
+ $tempTableName = $tempTable->getName();
CRM_Core_DAO::executeQuery("DROP TEMPORARY TABLE IF EXISTS {$tempTableName}");
-
- $query = "
- CREATE TEMPORARY TABLE {$tempTableName} (
- id int unsigned NOT NULL AUTO_INCREMENT,
- survey_contact_id int unsigned NOT NULL,
- PRIMARY KEY ( id )
-);
-";
- CRM_Core_DAO::executeQuery($query);
+ $tempTable->createWithColumns('id int unsigned NOT NULL AUTO_INCREMENT, survey_contact_id int unsigned NOT NULL, PRIMARY KEY ( id )');
$batch = 100;
$insertedCount = 0;