Merge pull request #5980 from marcov4lente/CRM-15829+CRM15881-for-4.6
[civicrm-core.git] / CRM / Case / XMLProcessor / Report.php
index 5408b52a98f27943d00fb9799445e502525734f2..cdbe24399eef2196d7645e519222ad0a1740b445 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
 class CRM_Case_XMLProcessor_Report extends CRM_Case_XMLProcessor {
 
   /**
-   * The default variable defined
+   * The default variable defined.
    *
    * @var boolean
    */
@@ -588,6 +588,7 @@ WHERE      a.id = %1
             'label' => $typeValue['label'],
             'value' => $value,
             'type' => $typeValue['type'],
+            'fieldID' => $typeValue['fieldID'],
           );
         }
         $customGroups[$dao->groupTitle] = $customGroup;
@@ -624,7 +625,8 @@ SELECT cg.title           as groupTitle,
 FROM   civicrm_custom_group cg,
        civicrm_custom_field cf
 WHERE  cf.custom_group_id = cg.id
-AND    cg.extends = 'Activity'";
+AND    cg.extends = 'Activity'
+AND " . CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW, 'cg.');
 
       if ($activityTypeID) {
         $query .= "AND ( cg.extends_entity_column_value IS NULL OR cg.extends_entity_column_value LIKE '%" . CRM_Core_DAO::VALUE_SEPARATOR . "%1" . CRM_Core_DAO::VALUE_SEPARATOR . "%' )";
@@ -987,4 +989,5 @@ LIMIT  1
     echo $printReport;
     CRM_Utils_System::civiExit();
   }
+
 }