From: Pradeep Nayak Date: Tue, 26 Jan 2016 20:30:38 +0000 (+0530) Subject: CRM-16188, added get Order api X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=31a99426187d9883f38fc0e6d6d66dce01e072a3;p=civicrm-core.git CRM-16188, added get Order api ---------------------------------------- * CRM-16188: Create an order API https://issues.civicrm.org/jira/browse/CRM-16188 --- diff --git a/api/v3/Order.php b/api/v3/Order.php new file mode 100644 index 0000000000..4ef1b32b25 --- /dev/null +++ b/api/v3/Order.php @@ -0,0 +1,61 @@ + array('<>' => 0)); + $isSequential = FALSE; + if (CRM_Utils_Array::value('sequential', $params)) { + $params['sequential'] = 0; + $isSequential = TRUE; + } + $result = civicrm_api3('Contribution', 'get', $params); + if (!empty($result['values'])) { + foreach ($result['values'] as $key => $contribution) { + $contributions[$key] = $contribution; + $contributions[$key]['line_items'] = $contribution['api.line_item.get']['values']; + unset($contributions[$key]['api.line_item.get']); + } + } + $params['sequential'] = $isSequential; + return civicrm_api3_create_success($contributions, $params, 'Order', 'get'); +}