Merge pull request #5980 from marcov4lente/CRM-15829+CRM15881-for-4.6
[civicrm-core.git] / CRM / Case / XMLProcessor / Report.php
index 4ad1e9e58d78c1e24892f709ceb8156db2901a8c..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.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -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 . "%' )";