From: Edsel Date: Fri, 19 Feb 2016 12:09:35 +0000 (+0530) Subject: CRM-16526 CIVI-3 Modified get lineitem permissioning X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=10dafdd2da0eb78487a963914f1e8cd50a2f93be;p=civicrm-core.git CRM-16526 CIVI-3 Modified get lineitem permissioning ---------------------------------------- * CRM-16526: ACLs for Financial Types https://issues.civicrm.org/jira/browse/CRM-16526 --- diff --git a/api/v3/LineItem.php b/api/v3/LineItem.php index 764e0f93b7..d9a503504e 100644 --- a/api/v3/LineItem.php +++ b/api/v3/LineItem.php @@ -78,7 +78,18 @@ function _civicrm_api3_line_item_create_spec(&$params) { function civicrm_api3_line_item_get($params) { if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) { CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types); - $params['financial_type_id'] = array('IN' => array_keys($types)); + if (empty($params['financial_type_id'])) { + $params['financial_type_id'] = array('IN' => array_keys($types)); + } + else { + if (is_array($params['financial_type_id'])) { + $invalidFts = array_diff($params['financial_type_id'], array_keys($types)); + } + elseif (!in_array($params['financial_type_id'], array_keys($types))) { + $invalidFts = $params['financial_type_id']; + } + $params['financial_type_id'] = array('NOT IN' => $invalidFts); + } } return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); }