Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-04-21-08-12-12
[civicrm-core.git] / api / v3 / PledgePayment.php
index e95516eb7d97045f2abd058c9dd3848aed414a52..0d17e109658e7efb0235a2162326a1daf8736695 100644 (file)
@@ -1,11 +1,10 @@
 <?php
-// $Id$
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  * @package CiviCRM_APIv3
  * @subpackage API_Pledge_Payment
  *
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * @version $Id: PledgePayment.php
  *
  */
 
-/**
- * Include utility functions
- */
-require_once 'CRM/Pledge/BAO/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
@@ -62,7 +56,7 @@ require_once 'CRM/Pledge/BAO/PledgePayment.php';
 function civicrm_api3_pledge_payment_create($params) {
 
   $paymentParams = $params;
-  if (empty($params['id']) && !CRM_Utils_Array::value('option.create_new', $params)) {
+  if (empty($params['id']) && empty($params['option.create_new'])) {
     $paymentDetails = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($params['pledge_id']);
     if (empty($paymentDetails)) {
       return civicrm_api3_create_error("There are no unmatched payment on this pledge. Pass in the pledge_payment id to specify one or 'option.create_new' to create one");
@@ -84,7 +78,8 @@ function civicrm_api3_pledge_payment_create($params) {
 
   return civicrm_api3_create_success($result, $params, 'pledge_payment', 'create', $dao);
 }
-/*
+
+/**
  * Adjust Metadata for Create action
  *
  * The metadata is used for setting defaults, documentation & validation
@@ -139,7 +134,7 @@ function updatePledgePayments($pledgeId, $paymentStatusId, $paymentIds) {
   return $result;
 }
 
-/*
+/**
  * Gets field for civicrm_pledge_payment functions
  *
  * @return array fields valid for other functions