From 31a99426187d9883f38fc0e6d6d66dce01e072a3 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 27 Jan 2016 02:00:38 +0530 Subject: [PATCH] CRM-16188, added get Order api ---------------------------------------- * CRM-16188: Create an order API https://issues.civicrm.org/jira/browse/CRM-16188 --- api/v3/Order.php | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 api/v3/Order.php 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'); +} -- 2.25.1