From bc1f381d630fc16bf9cf6a731bf615940e93d983 Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Mon, 22 Sep 2014 14:51:52 -0400 Subject: [PATCH] CRM-15351 relationship report: filter contact type on contact table --- CRM/Report/Form/Contact/Relationship.php | 45 +++++++++--------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/CRM/Report/Form/Contact/Relationship.php b/CRM/Report/Form/Contact/Relationship.php index 1eaa692145..db3adbd89c 100644 --- a/CRM/Report/Form/Contact/Relationship.php +++ b/CRM/Report/Form/Contact/Relationship.php @@ -44,12 +44,6 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'Relationship'); public $_drilldownReport = array('contact/detail' => 'Link to Detail Report'); - /** - * - */ - /** - * - */ function __construct() { $contact_type = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, '_'); @@ -89,6 +83,13 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING, ), + 'contact_type_a' => + array('title' => ts('Contact Type A'), + 'name' => 'contact_type', + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => $contact_type, + 'type' => CRM_Utils_Type::T_STRING, + ), ), 'grouping' => 'conact_a_fields', ), @@ -127,6 +128,13 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING, ), + 'contact_type_b' => + array('title' => ts('Contact Type B'), + 'name' => 'contact_type', + 'operatorType' => CRM_Report_Form::OP_MULTISELECT, + 'options' => $contact_type, + 'type' => CRM_Utils_Type::T_STRING, + ), ), 'grouping' => 'conact_b_fields', ), @@ -207,21 +215,6 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'default' => TRUE, ), ), - 'filters' => - array( - 'contact_type_a' => - array('title' => ts('Contact Type A'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => $contact_type, - 'type' => CRM_Utils_Type::T_STRING, - ), - 'contact_type_b' => - array('title' => ts('Contact Type B'), - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => $contact_type, - 'type' => CRM_Utils_Type::T_STRING, - ), - ), 'grouping' => 'relation-fields', ), 'civicrm_relationship' => @@ -408,8 +401,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { else { $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params); if ($op) { - - if ($tableName == 'civicrm_relationship_type' && + if (($tableName == 'civicrm_contact' || $tableName == 'civicrm_contact_b') && ($fieldName == 'contact_type_a' || $fieldName == 'contact_type_b') ) { $cTypes = CRM_Utils_Array::value("{$fieldName}_value", $this->_params); @@ -436,12 +428,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { } if (!empty($contactSubTypes)) { - if ($fieldName == 'contact_type_a') { - $field['name'] = 'contact_sub_type_a'; - } - else { - $field['name'] = 'contact_sub_type_b'; - } + $field['name'] = 'contact_sub_type'; $field['dbAlias'] = $field['alias'] . '.' . $field['name']; $subTypeClause = $this->whereClause($field, $op, -- 2.25.1