more changes to code
This commit is contained in:
parent
e3e27bbcb6
commit
9fdb1ac12b
@ -66,7 +66,7 @@ class CRM_ConstituentsOnly_BAO_ConstituentsOnly {
|
|||||||
* @param string $query
|
* @param string $query
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function updateSearchRows($rows) {
|
public static function updateSearchRows($rows, $headers) {
|
||||||
$contactIds = array_keys($rows);
|
$contactIds = array_keys($rows);
|
||||||
$sql = "SELECT MAX(contact_a.id) AS contact_id, cc.id AS og_contact_id
|
$sql = "SELECT MAX(contact_a.id) AS contact_id, cc.id AS og_contact_id
|
||||||
FROM civicrm_contact contact_a
|
FROM civicrm_contact contact_a
|
||||||
@ -91,11 +91,32 @@ class CRM_ConstituentsOnly_BAO_ConstituentsOnly {
|
|||||||
|
|
||||||
if (!empty($relContactIds)) {
|
if (!empty($relContactIds)) {
|
||||||
$formValues = ['contact_id' => $relContactIds];
|
$formValues = ['contact_id' => $relContactIds];
|
||||||
|
|
||||||
|
$url = CRM_Utils_Array::value('q', $_GET);
|
||||||
|
$returnProperties = NULL;
|
||||||
|
$request = $_REQUEST;
|
||||||
|
if (!empty($_REQUEST['has_js'])) {
|
||||||
|
$qfKey = $_REQUEST['qfKey'];
|
||||||
|
$formValuesFromSession = CRM_Core_Session::singleton()->get("CRM_Contact_Controller_Search_{$qfKey}");
|
||||||
|
if (!empty($formValuesFromSession['formValues'])) {
|
||||||
|
$request = $formValuesFromSession['formValues'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (in_array($url, ['civicrm/contact/search/builder']) || !empty($request['uf_group_id'])) {
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
if (!empty($header['sort'])) {
|
||||||
|
$returnProperties[$header['sort']] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$returnProperties['contact_sub_type'] = 1;
|
||||||
|
$returnProperties['contact_type'] = 1;
|
||||||
|
}
|
||||||
$queryParams = CRM_Contact_BAO_Query::convertFormValues($formValues);
|
$queryParams = CRM_Contact_BAO_Query::convertFormValues($formValues);
|
||||||
$selector = new CRM_Contact_Selector(
|
$selector = new CRM_Contact_Selector(
|
||||||
'',
|
'',
|
||||||
$queryParams,
|
$queryParams,
|
||||||
$queryParams
|
$queryParams,
|
||||||
|
$returnProperties
|
||||||
);
|
);
|
||||||
list($select, $from, $where, $having) = $selector->getQuery()->query();
|
list($select, $from, $where, $having) = $selector->getQuery()->query();
|
||||||
$newRows = $selector->getRows('', '', '', '');
|
$newRows = $selector->getRows('', '', '', '');
|
||||||
|
@ -165,6 +165,6 @@ function constituentsonly_civicrm_selectWhereClause($entity, &$clauses) {
|
|||||||
*/
|
*/
|
||||||
function constituentsonly_civicrm_searchColumns($objectName, &$headers, &$rows, &$selector) {
|
function constituentsonly_civicrm_searchColumns($objectName, &$headers, &$rows, &$selector) {
|
||||||
if (in_array($objectName, ['contact']) && !empty($rows)) {
|
if (in_array($objectName, ['contact']) && !empty($rows)) {
|
||||||
$rows = CRM_ConstituentsOnly_BAO_ConstituentsOnly::updateSearchRows($rows);
|
$rows = CRM_ConstituentsOnly_BAO_ConstituentsOnly::updateSearchRows($rows, $headers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user