Skip to content
Snippets Groups Projects
Commit c7b8b4e4 authored by lobo's avatar lobo
Browse files

CRM-12600 - redirect to search builder if we have the needed info

----------------------------------------
* CRM-12600: Fix behavior of CiviCRM on specific screen(s)when the session has timed out / deleted
  http://issues.civicrm.org/jira/browse/CRM-12600
parent c02edd0e
Branches
Tags
No related merge requests found
......@@ -66,7 +66,7 @@ class CRM_Contact_Controller_Search extends CRM_Core_Controller {
}
public function invalidKey() {
$message = ts('Because your session is timed out, we have reset the search page.');
$message = ts('Because your session timed out, we have reset the search page.');
CRM_Core_Session::setStatus($message);
// see if we can figure out the url and redirect to the right search form
......@@ -74,17 +74,23 @@ class CRM_Contact_Controller_Search extends CRM_Core_Controller {
// variables
$config = CRM_Core_Config::singleton();
$qString = $_GET[$config->userFrameworkURLVar];
$args = "reset=1";
$path = 'civicrm/contact/search/advanced';
if (strpos($qString, 'basic') !== FALSE) {
$path = 'civicrm/contact/search/basic';
}
else if (strpos($qString, 'builder') !== FALSE) {
$path = 'civicrm/contact/search/builder';
}
else {
$path = 'civicrm/contact/search/advanced';
else if (
strpos($qString, 'custom') !== FALSE &&
isset($_REQUEST['csid'])
) {
$path = 'civicrm/contact/search/custom';
$args = "reset=1&csid={$_REQUEST['csid']}";
}
$url = CRM_Utils_System::url($path, 'reset=1');
$url = CRM_Utils_System::url($path, $args);
CRM_Utils_System::redirect($url);
}
......
......@@ -45,7 +45,8 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search {
$ssID = CRM_Utils_Request::retrieve('ssID', 'Integer', $this);
$gID = CRM_Utils_Request::retrieve('gid', 'Integer', $this);
list($this->_customSearchID,
list(
$this->_customSearchID,
$this->_customSearchClass,
$formValues
) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID);
......@@ -54,6 +55,10 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search {
CRM_Core_Error::fatal('Could not get details for custom search.');
}
// stash this as a hidden element so we can potentially go there if the session
// is reset but this is available in the POST
$this->addElement('hidden', 'csid', $csID);
if (!empty($formValues)) {
$this->_formValues = $formValues;
}
......
......@@ -478,21 +478,6 @@ GROUP BY et.entity_id
$contactSQL[] = "
SELECT distinct ca.id
FROM civicrm_activity ca
INNER JOIN civicrm_contact c ON ca.source_contact_id = c.id
LEFT JOIN civicrm_email e ON e.contact_id = c.id
LEFT JOIN civicrm_option_group og ON og.name = 'activity_type'
LEFT JOIN civicrm_option_value ov ON ( ov.option_group_id = og.id )
WHERE ( (c.sort_name LIKE {$this->_text} OR c.display_name LIKE {$this->_text}) OR
(e.email LIKE {$this->_text} AND
ca.activity_type_id = ov.value AND
ov.name IN ('Inbound Email', 'Email') ) )
AND (ca.is_deleted = 0 OR ca.is_deleted IS NULL)
AND (c.is_deleted = 0 OR c.is_deleted IS NULL)
";
$contactSQL[] = "
SELECT distinct ca.id
FROM civicrm_activity ca
INNER JOIN civicrm_activity_contact cat ON cat.activity_id = ca.id
INNER JOIN civicrm_contact c ON cat.contact_id = c.id
LEFT JOIN civicrm_email e ON cat.contact_id = e.contact_id
......@@ -916,9 +901,7 @@ INSERT INTO {$this->_tableName}
( table_name, activity_id, subject, details, contact_id, sort_name, record_type,
activity_type_id, case_id, client_id )
SELECT 'Activity', ca.id, substr(ca.subject, 1, 50), substr(ca.details, 1, 250),
c1.id, c1.sort_name,
c2.id, c2.sort_name,
c3.id, c3.sort_name,
c1.id, c1.sort_name, cac.record_type_id,
ca.activity_type_id,
cca.case_id,
ccc.contact_id as client_id
......
......@@ -144,8 +144,10 @@ class CRM_Contact_Selector_Custom extends CRM_Contact_Selector {
$this->_search = new $customSearchClass( $formValues );
}
else {
$customSearchFile = $ext->keyToPath($customSearchClass, 'search');
$this->_search = new $ext->keyToClass($customSearchClass, 'search')( $formValues );
$fnName = $ext->keyToPath;
$customSearchFile = $fnName($customSearchClass, 'search');
$className = $ext->keyToClass($customSearchClass, 'search');
$this->_search = new $className($formValues);
}
}
//end of constructor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment