CRM-12623, improvements w.r.t custom table joins and notice fixes
authorDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Tue, 4 Jun 2013 12:49:57 +0000 (18:19 +0530)
committerDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Tue, 4 Jun 2013 12:49:57 +0000 (18:19 +0530)
----------------------------------------
* CRM-12623: Create CiviHR Report Template
  http://issues.civicrm.org/jira/browse/CRM-12623

CRM/Report/Form.php

index 0a17416244f039dbbad4eb6748ef82007e079f18..73e7cf691cd8f764f2fce00597a40c4dabd391e8 100644 (file)
@@ -137,6 +137,7 @@ class CRM_Report_Form extends CRM_Core_Form {
   protected $_customGroupExtends = NULL;
   protected $_customGroupFilters = TRUE;
   protected $_customGroupGroupBy = FALSE;
+  protected $_customGroupJoin    = 'LEFT JOIN';
 
   /**
    * build tags filter
@@ -2819,8 +2820,9 @@ ORDER BY cg.weight, cf.weight";
           continue;
         }
 
+        $customJoin   = is_array($this->_customGroupJoin) ? $this->_customGroupJoin[$table] : $this->_customGroupJoin;
         $this->_from .= "
-LEFT JOIN $table {$this->_aliases[$table]} ON {$this->_aliases[$table]}.entity_id = {$this->_aliases[$extendsTable]}.id";
+{$customJoin} {$table} {$this->_aliases[$table]} ON {$this->_aliases[$table]}.entity_id = {$this->_aliases[$extendsTable]}.id";
         // handle for ContactReference
         if (array_key_exists('fields', $prop)) {
           foreach ($prop['fields'] as $fieldName => $field) {
@@ -2959,7 +2961,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
   function selectedTables() {
     if (!$this->_selectedTables) {
       $orderByColumns = array();
-      if (is_array($this->_params['order_bys'])) {
+      if (array_key_exists('order_bys', $this->_params) && is_array($this->_params['order_bys'])) {
         foreach ($this->_params['order_bys'] as $orderBy) {
           $orderByColumns[] = $orderBy['column'];
         }