$form->_contactIds = [];
$form->_contactTypes = [];
- $useTable = (CRM_Utils_System::getClassName($form->controller->getStateMachine()) == 'CRM_Export_StateMachine_Standalone');
-
$isStandAlone = in_array('task', $form->urlPath) || in_array('standalone', $form->urlPath);
if ($isStandAlone) {
list($form->_task, $title) = CRM_Contact_Task::getTaskAndTitleByClass(get_class($form));
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
- $form->_task = CRM_Utils_Array::value('task', self::$_searchFormValues);
+ $form->_task = self::$_searchFormValues['task'] ?? NULL;
$crmContactTaskTasks = CRM_Contact_Task::taskTitles();
$form->assign('taskName', CRM_Utils_Array::value($form->_task, $crmContactTaskTasks));
- if ($useTable) {
- $tempTable = CRM_Utils_SQL_TempTable::build()->setCategory('tskact')->setDurable()->setId($qfKey);
- $form->_componentTable = $tempTable->getName();
- $tempTable->drop();
- $tempTable->createWithColumns('contact_id int primary key');
- }
-
// all contacts or action = save a search
if ((CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_all') ||
($form->_task == CRM_Contact_Task::SAVE_SEARCH)
// since we don't store all contacts in prevnextcache, when user selects "all" use query to retrieve contacts
// rather than prevnext cache table for most of the task actions except export where we rebuild query to fetch
// final result set
- if ($useTable) {
- $allCids = Civi::service('prevnext')->getSelection($cacheKey, "getall");
- }
- else {
- $allCids[$cacheKey] = self::getContactIds($form);
- }
+ $allCids[$cacheKey] = self::getContactIds($form);
$form->_contactIds = [];
- if ($useTable) {
- $count = 0;
- $insertString = [];
- foreach ($allCids[$cacheKey] as $cid => $ignore) {
- $count++;
- $insertString[] = " ( {$cid} ) ";
- if ($count % 200 == 0) {
- $string = implode(',', $insertString);
- $sql = "REPLACE INTO {$form->_componentTable} ( contact_id ) VALUES $string";
- CRM_Core_DAO::executeQuery($sql);
- $insertString = [];
- }
- }
- if (!empty($insertString)) {
- $string = implode(',', $insertString);
- $sql = "REPLACE INTO {$form->_componentTable} ( contact_id ) VALUES $string";
- CRM_Core_DAO::executeQuery($sql);
- }
- }
- elseif (empty($form->_contactIds)) {
+ if (empty($form->_contactIds)) {
// filter duplicates here
// CRM-7058
// might be better to do this in the query, but that logic is a bit complex
// need to perform action on only selected contacts
foreach (self::$_searchFormValues as $name => $value) {
if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
- $contactID = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
- if ($useTable) {
- $insertString[] = " ( {$contactID} ) ";
- }
- else {
- $form->_contactIds[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
- }
+ $form->_contactIds[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
}
}
}
// fetching selected contact ids of passed cache key
$selectedCids = Civi::service('prevnext')->getSelection($cacheKey);
foreach ($selectedCids[$cacheKey] as $selectedCid => $ignore) {
- if ($useTable) {
- $insertString[] = " ( {$selectedCid} ) ";
- }
- else {
- $form->_contactIds[] = $selectedCid;
- }
+ $form->_contactIds[] = $selectedCid;
}
}
if (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel'
&& ($form->_action != CRM_Core_Action::COPY)
) {
- $sel = CRM_Utils_Array::value('radio_ts', self::$_searchFormValues);
+ $sel = self::$_searchFormValues['radio_ts'] ?? NULL;
$form->assign('searchtype', $sel);
$result = self::getSelectedContactNames();
$form->assign("value", $result);
/**
* Replace ids of household members in $this->_contactIds with the id of their household.
*
- * CRM-8338
+ * @see https://issues.civicrm.org/jira/browse/CRM-8338
*/
public function mergeContactIdsByHousehold() {
if (empty($this->_contactIds)) {