From 10dafdd2da0eb78487a963914f1e8cd50a2f93be Mon Sep 17 00:00:00 2001 From: Edsel Date: Fri, 19 Feb 2016 17:39:35 +0530 Subject: [PATCH] CRM-16526 CIVI-3 Modified get lineitem permissioning ---------------------------------------- * CRM-16526: ACLs for Financial Types https://issues.civicrm.org/jira/browse/CRM-16526 --- api/v3/LineItem.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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); } -- 2.25.1