CRM-16323 - Show repeating info in entityRef fields
[civicrm-core.git] / CRM / Event / BAO / ParticipantPayment.php
index 4a2008823b2db4605dfb90cc405140cd154ec13c..511e96b7484d96d4029e3c9a82df1fcb82255784 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
 class CRM_Event_BAO_ParticipantPayment extends CRM_Event_DAO_ParticipantPayment {
 
   /**
-   * Creates or updates a participant payment record
+   * Creates or updates a participant payment record.
    *
-   * @param $params
-   *   Array of values to initialize the record with.
-   * @param $ids
-   *   Array with one values of id for this participantPayment record (for update).
+   * @param array $params
+   *   of values to initialize the record with.
+   * @param array $ids
+   *   with one values of id for this participantPayment record (for update).
    *
-   * @return object the partcipant payment record
-   * @static
+   * @return object
+   *   the partcipant payment record
    */
   public static function create(&$params, &$ids) {
     if (isset($ids['id'])) {
@@ -73,26 +73,34 @@ class CRM_Event_BAO_ParticipantPayment extends CRM_Event_DAO_ParticipantPayment
 
     //generally if people are creating participant_payments via the api they won't be setting the line item correctly - we can't help them if they are doing complex transactions
     // but if they have a single line item for the contribution we can assume it should refer to the participant line
-    $lineItemCount = CRM_Core_DAO::singleValueQuery("select count(*) FROM civicrm_line_item WHERE contribution_id = %1", array(1 => array($participantPayment->contribution_id, 'Integer')));
+    $lineItemCount = CRM_Core_DAO::singleValueQuery("select count(*) FROM civicrm_line_item WHERE contribution_id = %1", array(
+        1 => array(
+          $participantPayment->contribution_id,
+          'Integer',
+        ),
+      ));
     if ($lineItemCount == 1) {
       $sql = "UPDATE civicrm_line_item li
       SET entity_table = 'civicrm_participant', entity_id = %1
       WHERE contribution_id = %2 AND entity_table = 'civicrm_contribution'";
-      CRM_Core_DAO::executeQuery($sql, array(1 => array($participantPayment->participant_id, 'Integer'), 2 => array($participantPayment->contribution_id, 'Integer')));
+      CRM_Core_DAO::executeQuery($sql, array(
+          1 => array($participantPayment->participant_id, 'Integer'),
+          2 => array($participantPayment->contribution_id, 'Integer'),
+        ));
     }
 
     return $participantPayment;
   }
 
   /**
-   * Delete the record that are associated with this ParticipantPayment
+   * Delete the record that are associated with this ParticipantPayment.
    * Also deletes the associated contribution for this participant
    *
    * @param array $params
    *   Associative array whose values match the record to be deleted.
    *
-   * @return boolean  true if deleted false otherwise
-   * @static
+   * @return bool
+   *   true if deleted false otherwise
    */
   public static function deleteParticipantPayment($params) {
     $participantPayment = new CRM_Event_DAO_ParticipantPayment();
@@ -118,4 +126,5 @@ class CRM_Event_BAO_ParticipantPayment extends CRM_Event_DAO_ParticipantPayment
     }
     return FALSE;
   }
+
 }