$this->_fields = [];
CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values);
- if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
- && !CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($this->_values['financial_type_id']))
- ) {
- CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
- }
if (empty($this->_values['is_active'])) {
throw new CRM_Contribute_Exception_InactiveContributionPageException(ts('The page you requested is currently unavailable.'), $this->_id);
}
foreach ($feeBlock as $key => $value) {
foreach ($value['options'] as $k => $options) {
- if (!CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($options['financial_type_id']))) {
+ if (!CRM_Core_Permission::check('add contributions of type ' . CRM_Core_PseudoConstant::getName('CRM_Contribute_DAO_Contribution', 'financial_type_id', $options['financial_type_id']))) {
unset($feeBlock[$key]['options'][$k]);
}
}
$menu['civicrm/admin/financial/financialType']['access_arguments'] = [['administer CiviCRM Financial Types']];
}
+/**
+ * @param string $formName
+ * @param \CRM_Core_Form $form
+ */
+function financialacls_civicrm_preProcess(string $formName, \CRM_Core_Form $form): void {
+ if (!financialacls_is_acl_limiting_enabled()) {
+ return;
+ }
+ if (str_starts_with($formName, 'CRM_Contribute_Form_Contribution_')) {
+ /* @var \CRM_Contribute_Form_Contribution_Main $form */
+ if (!CRM_Core_Permission::check('add contributions of type ' . $form->getContributionPageValue('financial_type_id:name'))) {
+ CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
+ }
+ }
+
+}
+
/**
* Hide edit/enable/disable links for memberships of a given Financial Type
* Note: The $objectID param can be an int, string or null, hence not typed