+ if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) {
+ if (empty($params['id'])) {
+ $op = 'add';
+ }
+ else {
+ if (empty($params['financial_type_id'])) {
+ $params['financial_type_id'] = civicrm_api3('Contribution', 'getvalue', array(
+ 'id' => $params['id'],
+ 'return' => 'financial_type_id',
+ ));
+ }
+ $op = 'edit';
+ }
+ CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types, $op);
+ if (!in_array($params['financial_type_id'], array_keys($types))) {
+ return civicrm_api3_create_error('You do not have permission to create this contribution');
+ }
+ }