CRM-20368 contact relationship report
authorBrian Shaughnessy <brian@lcdservices.biz>
Sat, 1 Apr 2017 17:34:19 +0000 (13:34 -0400)
committerBrian Shaughnessy <brian@lcdservices.biz>
Sat, 1 Apr 2017 17:34:19 +0000 (13:34 -0400)
CRM/Report/Form/Contact/Relationship.php

index 431b2b8fb19e0fe36d48ff73f7236b3549282b66..c08a7a7e11787082e9eb45b1b16b0b60e8ed2d1f 100644 (file)
@@ -112,6 +112,13 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form {
             'type' => CRM_Utils_Type::T_STRING,
           ),
         ),
+        'order_bys' => array(
+          'sort_name_a' => array(
+            'title' => ts('Contact A'),
+            'name' => 'sort_name',
+            'default_weight' => '1',
+          ),
+        ),
         'grouping' => 'contact_a_fields',
       ),
       'civicrm_contact_b' => array(
@@ -155,6 +162,13 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form {
             'type' => CRM_Utils_Type::T_STRING,
           ),
         ),
+        'order_bys' => array(
+          'sort_name_b' => array(
+            'title' => ts('Contact B'),
+            'name' => 'sort_name',
+            'default_weight' => '2',
+          ),
+        ),
         'grouping' => 'contact_b_fields',
       ),
       'civicrm_email' => array(
@@ -220,6 +234,16 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form {
             'default' => TRUE,
           ),
         ),
+        'order_bys' => array(
+          'label_a_b' => array(
+            'title' => ts('Relationship A-B'),
+            'name' => 'label_a_b',
+          ),
+          'label_b_A' => array(
+            'title' => ts('Relationship B-A'),
+            'name' => 'label_b_a',
+          ),
+        ),
         'grouping' => 'relation-fields',
       ),
       'civicrm_relationship' => array(
@@ -581,10 +605,6 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form {
     $this->_groupBy = CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, $groupBy);
   }
 
-  public function orderBy() {
-    $this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact_b']}.sort_name ";
-  }
-
   public function postProcess() {
     $this->beginPostProcess();