ICM-18 Fixed issues that were reported by Jenkins test
[civicrm-core.git] / CRM / Member / Form / MembershipView.php
index 60a404b701d09a6cdf0487e60a9509a68c76f803..b72fff1a92420b201dbbb96d073552d11d9b262a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
@@ -158,8 +158,15 @@ class CRM_Member_Form_MembershipView extends CRM_Core_Form {
 
     if ($id) {
       $params = array('id' => $id);
-
       CRM_Member_BAO_Membership::retrieve($params, $values);
+      if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) {
+        $finTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $values['membership_type_id'], 'financial_type_id');
+        $finType = CRM_Contribute_PseudoConstant::financialType($finTypeId);
+        if (!CRM_Core_Permission::check('view contributions of type ' . $finType)) {
+          CRM_Core_Error::fatal(ts('You do not have permissionn to access this page.'));
+        }
+      }
+      $this->assign('financialTypeId', $finType);
       $membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($values['membership_type_id']);
 
       // Do the action on related Membership if needed