+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
+ | Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
$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';
}
* Array of matching line_items
*/
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 (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
+ CRM_Price_BAO_LineItem::getAPILineItemParams($params);
}
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
*
* @param array $params
* Array containing id of the group to be deleted.
- *
- * @return array
- * API result array
+ * @return array API result array
+ * @throws API_Exception
*/
function civicrm_api3_line_item_delete($params) {
- if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) {
+ if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types, CRM_Core_Action::DELETE);
if (empty($params['financial_type_id'])) {
- $params['financial_type_id'] = civicrm_api3('LineItem', 'getvalue', array(
- 'id' => $params['id'],
- 'return' => 'financial_type_id',
- ));
+ $params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_LineItem', $params['id'], 'financial_type_id');
}
if (!in_array($params['financial_type_id'], array_keys($types))) {
throw new API_Exception('You do not have permission to delete this line item');