From 2344a42b4c00af8ae63bd942276865fe77df816e Mon Sep 17 00:00:00 2001 From: Edsel Date: Tue, 16 Feb 2016 19:42:41 +0530 Subject: [PATCH] CRM-16526 CIVI-3 Added restriction for retrieving lineitems ---------------------------------------- * CRM-16526: ACLs for Financial Types https://issues.civicrm.org/jira/browse/CRM-16526 --- api/v3/LineItem.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/api/v3/LineItem.php b/api/v3/LineItem.php index 463aab2b88..6b9494d140 100644 --- a/api/v3/LineItem.php +++ b/api/v3/LineItem.php @@ -95,6 +95,18 @@ function _civicrm_api3_line_item_create_spec(&$params) { * Array of matching line_items */ function civicrm_api3_line_item_get($params) { + if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) { + CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types); + $lineItems = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); + if ($lineItems['count'] > 0) { + foreach ($lineItems['values'] as $key => $items) { + if (!in_array($items['financial_type_id'], array_keys($types))) { + unset($lineItems['values'][$key]); + } + } + return $lineItems; + } + } return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } -- 2.25.1