Merge pull request #21945 from masetto/profile-data-attribute
[civicrm-core.git] / CRM / Pledge / 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 * This class contains all the function that are called using AJAX
20 */
21 class CRM_Pledge_Page_AJAX {
22
23 /**
24 * Function to setDefaults according to Pledge Id
25 * for batch entry pledges
26 */
27 public function getPledgeDefaults() {
28 $details = [];
29 if (!empty($_POST['pid'])) {
30 $pledgeID = CRM_Utils_Type::escape($_POST['pid'], 'Integer');
31 $details = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeID);
32 }
33 CRM_Utils_JSON::output($details);
34 }
35
36 }