From cfba316e4bf9b4abbde0c5023eb59fc7d9708553 Mon Sep 17 00:00:00 2001 From: Edsel Date: Mon, 22 Feb 2016 12:40:26 +0530 Subject: [PATCH] CRM-16526 CIVI-3 Removed mandatory lineitem check from create api and added only if ACL is enabled ---------------------------------------- * CRM-16526: ACLs for Financial Types https://issues.civicrm.org/jira/browse/CRM-16526 --- CRM/Price/BAO/LineItem.php | 3 +++ api/v3/LineItem.php | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index d6150a6998..b813d3c3b9 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -70,6 +70,9 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem { unset($params['entity_id'], $params['entity_table']); } if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) { + if (empty($params['financial_type_id'])) { + throw new Exception('Mandatory key(s) missing from params array: financial_type_id'); + } CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types, $op); if (!in_array($params['financial_type_id'], array_keys($types))) { throw new Exception('You do not have permission to create this line item'); diff --git a/api/v3/LineItem.php b/api/v3/LineItem.php index e35e22d343..e74175524e 100644 --- a/api/v3/LineItem.php +++ b/api/v3/LineItem.php @@ -61,7 +61,6 @@ function _civicrm_api3_line_item_create_spec(&$params) { $params['qty']['api.required'] = 1; $params['unit_price']['api.required'] = 1; $params['line_total']['api.required'] = 1; - $params['financial_type_id']['api.required'] = 1; $params['label']['api.default'] = 'line item'; } -- 2.25.1