Merge pull request #16001 from agileware/CIVICRM-1383
[civicrm-core.git] / CRM / Contribute / Page / AJAX.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 *
17 */
18
19 /**
20 * This class contains all the function that are called using AJAX (jQuery)
21 */
22 class CRM_Contribute_Page_AJAX {
23
24 /**
25 * Get Soft credit to list in DT
26 */
27 public static function getSoftContributionRows() {
28 $requiredParameters = [
29 'cid' => 'Integer',
30 'context' => 'String',
31 ];
32 $optionalParameters = [
33 'entityID' => 'Integer',
34 'isTest' => 'Integer',
35 ];
36
37 $params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
38 $params += CRM_Core_Page_AJAX::validateParams($requiredParameters, $optionalParameters);
39
40 $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionSelector($params);
41
42 if (!empty($_GET['is_unit_test'])) {
43 return $softCreditList;
44 }
45
46 CRM_Utils_JSON::output($softCreditList);
47 }
48
49 }