Merge branch 4.5 into master
[civicrm-core.git] / api / v3 / PledgePayment.php
index a7e2a3ce7ee96ed3800bdc77991726031fba78fb..7e39ff987cc56efb06bd232e45949887b237e5a7 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  */
 
 /**
- * File for the CiviCRM APIv3 Pledge functions
+ * This api exposes CiviCRM Pledge payment.
  *
  * @package CiviCRM_APIv3
- * @subpackage API_Pledge_Payment
- *
- * @copyright CiviCRM LLC (c) 2004-2014
- * @version $Id: PledgePayment.php
- *
  */
 
 /**
- * Add or update a plege payment. Pledge Payment API doesn't actually add a pledge
- *  if the request is to 'create' and 'id' is not passed in
- * the oldest pledge with no associated contribution is updated
+ * Add or update a pledge payment.
+ *
+ * Pledge Payment API doesn't actually add a pledge.
+ * If the request is to 'create' and 'id' is not passed in
+ * the oldest pledge with no associated contribution is updated.
  *
  * @todo possibly add ability to add payment if there are less payments than pledge installments
  * @todo possibly add ability to recalculate dates if the schedule is changed
  *
  * @param array $params
  *   Input parameters.
- * {@getfields PledgePayment_create}
- * @example PledgePaymentCreate.php
  *
  * @return array
  *   API Result
- * @static void
- * @access public
  */
 function civicrm_api3_pledge_payment_create($params) {
 
@@ -69,6 +61,7 @@ function civicrm_api3_pledge_payment_create($params) {
   }
 
   $dao = CRM_Pledge_BAO_PledgePayment::add($paymentParams);
+  $result = array();
   if (empty($dao->pledge_id)) {
     $dao->find(TRUE);
   }
@@ -81,11 +74,12 @@ function civicrm_api3_pledge_payment_create($params) {
 }
 
 /**
- * Adjust Metadata for Create action
+ * Adjust Metadata for Create action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
  *
- * The metadata is used for setting defaults, documentation & validation
  * @param array $params
- *   Array or parameters determined by getfields.
+ *   Array of parameters determined by getfields.
  */
 function _civicrm_api3_pledge_payment_create_spec(&$params) {
   $params['pledge_id']['api.required'] = 1;
@@ -93,17 +87,13 @@ function _civicrm_api3_pledge_payment_create_spec(&$params) {
 }
 
 /**
- * Delete a pledge Payment - Note this deletes the contribution not just the link
+ * Delete a pledge Payment - Note this deletes the contribution not just the link.
  *
  * @param array $params
  *   Input parameters.
- * {@getfields PledgePayment_delete}
- * @example PledgePaymentDelete.php
  *
  * @return array
  *   API result
- * @static void
- * @access public
  */
 function civicrm_api3_pledge_payment_delete($params) {
 
@@ -116,17 +106,13 @@ function civicrm_api3_pledge_payment_delete($params) {
 }
 
 /**
- * Retrieve a set of pledges, given a set of input params
+ * Retrieve a set of pledges, given a set of input params.
  *
  * @param array $params
  *   Input parameters.
- * {@getfields PledgePayment_get}
- * @example PledgePaymentGet.php *
  *
  * @return array
- *   (reference )        array of pledges, if error an array with an error id and error message
- * @static void
- * @access public
+ *   array of pledges, if error an array with an error id and error message
  */
 function civicrm_api3_pledge_payment_get($params) {
 
@@ -134,25 +120,10 @@ function civicrm_api3_pledge_payment_get($params) {
 }
 
 /**
- * @param int $pledgeId
- * @param int $paymentStatusId
- * @param $paymentIds
- *
- * @return mixed
- */
-function updatePledgePayments($pledgeId, $paymentStatusId, $paymentIds) {
-
-  $result = updatePledgePayments($pledgeId, $paymentStatusId, $paymentIds = NULL);
-  return $result;
-}
-
-/**
- * Gets field for civicrm_pledge_payment functions
+ * Gets field for civicrm_pledge_payment functions.
  *
  * @param array $params
- *
- * @return array
- *   fields valid for other functions
+ *   Modifiable list of fields allowed for the PledgePayment.get action.
  */
 function civicrm_api3_pledge_payment_get_spec(&$params) {
   $params['option.create_new'] = array('title' => "Create new field rather than update an unpaid payment");