Merge pull request #4899 from colemanw/INFRA-132
[civicrm-core.git] / CRM / Event / BAO / Participant.php
index 01c738d53b513292a131fdd4445e0c1a5db0fdad..76c084bc570400b291d71f0068823838628c348a 100644 (file)
@@ -68,7 +68,6 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant {
   );
 
   /**
-   *
    */
   public function __construct() {
     parent::__construct();
@@ -244,7 +243,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant {
     $hasNoteField = FALSE;
     foreach (array(
                'note',
-               'participant_note'
+               'participant_note',
              ) as $noteFld) {
       if (array_key_exists($noteFld, $params)) {
         $noteValue = $params[$noteFld];
@@ -352,7 +351,9 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant {
    * @param bool $returnWaitingCount
    * @param bool $considerTestParticipant
    *
-   * @return bool|int|null|string 1. false                 => If event having some empty spaces.@static
+   * @return bool|int|null|string
+   *   1. false                 => If event having some empty spaces.
+   * @static
    */
   static function eventFull(
     $eventId,
@@ -495,7 +496,8 @@ SELECT  event.event_full_text,
    * @param bool $considerWaiting
    * @param bool $considerTestParticipants
    *
-   * @return array $optionsCount an array of each option id and total count
+   * @return array
+   *   an array of each option id and total count
    * @static
    */
   static function priceSetOptionsCount(
@@ -573,7 +575,8 @@ INNER JOIN  civicrm_price_field field       ON ( value.price_field_id = field.id
    * @param int $eventId
    *   Event id.
    *
-   * @return int $spaces  Number of Empty Seats/null.
+   * @return int
+   *   $spaces  Number of Empty Seats/null.
    * @static
    */
   public static function pendingToConfirmSpaces($eventId) {
@@ -622,7 +625,8 @@ GROUP BY  participant.event_id
    * @param bool $status
    * @param bool $onlyParticipant
    *
-   * @return array array of importable Fields
+   * @return array
+   *   array of importable Fields
    * @static
    */
   public static function &importableFields($contactType = 'Individual', $status = TRUE, $onlyParticipant = FALSE) {
@@ -646,7 +650,7 @@ GROUP BY  participant.event_id
           'title' => ts('Participant Note'),
           'name' => 'participant_note',
           'headerPattern' => '/(participant.)?note$/i',
-        )
+        ),
       );
 
       // Split status and status id into 2 fields
@@ -656,7 +660,7 @@ GROUP BY  participant.event_id
           'title' => ts('Participant Status'),
           'name' => 'participant_status',
           'data_type' => CRM_Utils_Type::T_STRING,
-        )
+        ),
       );
       $tmpFields['participant_status_id']['title'] = ts('Participant Status Id');
 
@@ -667,7 +671,7 @@ GROUP BY  participant.event_id
           'title' => ts('Participant Role'),
           'name' => 'participant_role',
           'data_type' => CRM_Utils_Type::T_STRING,
-        )
+        ),
       );
       $tmpFields['participant_role_id']['title'] = ts('Participant Role Id');
 
@@ -676,7 +680,7 @@ GROUP BY  participant.event_id
           'title' => ts('Event Type'),
           'name' => 'event_type',
           'data_type' => CRM_Utils_Type::T_STRING,
-        )
+        ),
       );
 
       $tmpContactField = $contactFields = array();
@@ -734,7 +738,8 @@ GROUP BY  participant.event_id
   /**
    * Combine all the exportable fields from the lower levels object
    *
-   * @return array array of exportable Fields
+   * @return array
+   *   array of exportable Fields
    * @static
    */
   public static function &exportableFields() {
@@ -750,21 +755,21 @@ GROUP BY  participant.event_id
         'participant_note' => array(
           'title' => 'Participant Note',
           'name' => 'participant_note',
-        )
+        ),
       );
 
       $participantStatus = array(
         'participant_status' => array(
           'title' => 'Participant Status',
           'name' => 'participant_status',
-        )
+        ),
       );
 
       $participantRole = array(
         'participant_role' => array(
           'title' => 'Participant Role',
           'name' => 'participant_role',
-        )
+        ),
       );
 
       //CRM-13595 add event id to participant export
@@ -772,13 +777,13 @@ GROUP BY  participant.event_id
         'event_id' => array(
           'title' => 'Event ID',
           'name' => 'event_id',
-        )
+        ),
       );
       $eventtitle = array(
         'event_title' => array(
           'title' => 'Event Title',
           'name' => 'event_title',
-        )
+        ),
       );
 
       $discountFields = CRM_Core_DAO_Discount::export();
@@ -799,7 +804,8 @@ GROUP BY  participant.event_id
    * @param int $participantId
    *   Id of the participant.
    *
-   * @return array $name associated array with sort_name and event title
+   * @return array
+   *   associated array with sort_name and event title
    * @static
    */
   public static function participantDetails($participantId) {
@@ -840,7 +846,7 @@ WHERE  civicrm_participant.id = {$participantId}
   }
 
   /**
-   * This function is used to convert associative array names to values
+   * convert associative array names to values
    * and vice-versa.
    *
    * This function is used by both the web form layer and the api. Note that
@@ -1020,7 +1026,7 @@ WHERE  civicrm_participant.id = {$participantId}
    *
    * @param int $oldStatusId
    *
-   * @return array $additionalParticipantIds
+   * @return array
    * @static
    */
   public static function getAdditionalParticipantIds($primaryParticipantId, $excludeCancel = TRUE, $oldStatusId = NULL) {
@@ -1062,7 +1068,7 @@ WHERE  civicrm_participant.id = {$participantId}
    * @param bool $hasLineItems
    *   Do fetch from line items.
    *
-   * @return array $feeDetails
+   * @return array
    * @static
    */
   public function getFeeDetails($participantIds, $hasLineItems = FALSE) {
@@ -1137,7 +1143,8 @@ INNER JOIN civicrm_price_field_value value ON ( value.id = lineItem.price_field_
    * @param int $primaryParticipantID
    *   Id of primary participant record.
    *
-   * @return array $additionalParticipants $displayName => $viewUrl
+   * @return array
+   *   $displayName => $viewUrl
    * @static
    */
   public static function getAdditionalParticipants($primaryParticipantID) {
@@ -1649,7 +1656,7 @@ UPDATE  civicrm_participant
     if (is_string($emptySeats) && $emptySeats !== NULL) {
       $maxParticipants = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $eventId, 'max_participants');
       $eventfullMsg = ts("This event currently has the maximum number of participants registered (%1). However, you can still override this limit and register additional participants using this form.", array(
-          1 => $maxParticipants
+          1 => $maxParticipants,
         )) . '<br />';
     }
 
@@ -1687,7 +1694,8 @@ UPDATE  civicrm_participant
    *
    * @param int $participantId
    *
-   * @return true if participant is primary
+   * @return bool
+   *   true if participant is primary
    */
   public static function isPrimaryParticipant($participantId) {
 
@@ -1710,7 +1718,8 @@ UPDATE  civicrm_participant
    * @param int $newStatusId
    *   New status.
    *
-   * @return true if allowed
+   * @return bool
+   *   true if allowed
    */
   public static function getValidAdditionalIds($participantId, $oldStatusId, $newStatusId) {
 
@@ -1736,7 +1745,8 @@ UPDATE  civicrm_participant
    *
    * @param int $contactID
    *
-   * @return int count of participant records
+   * @return int
+   *   count of participant records
    * @static
    */
   public static function getContactParticipantCount($contactID) {
@@ -1755,7 +1765,7 @@ WHERE    civicrm_participant.contact_id = {$contactID} AND
    * @param bool $excludeCancelled
    *   Exclude cancelled additional participant.
    *
-   * @return array $participantsId
+   * @return array
    * @static
    */
   public static function getParticipantIds($contributionId, $excludeCancelled = FALSE) {
@@ -1772,7 +1782,7 @@ WHERE    civicrm_participant.contact_id = {$contactID} AND
     // get additional participant ids (including cancelled)
     if ($participantId) {
       $ids = array_merge(array(
-        $participantId
+        $participantId,
       ), self::getAdditionalParticipantIds($participantId,
         $excludeCancelled
       ));
@@ -1787,7 +1797,8 @@ WHERE    civicrm_participant.contact_id = {$contactID} AND
    * @param array $participantIds
    *   An array of additional participant ids.
    *
-   * @return array of Urls.
+   * @return array
+   *   of Urls.
    * @static
    */
   public static function getAdditionalParticipantUrl($participantIds) {
@@ -1807,7 +1818,7 @@ WHERE    civicrm_participant.contact_id = {$contactID} AND
   }
 
   /**
-   * To create trxn entry if an event has discount.
+   * create trxn entry if an event has discount.
    *
    * @param int $eventID
    *   Event id.
@@ -1829,7 +1840,7 @@ LEFT JOIN civicrm_price_field cpf ON cpfv.price_field_id = cpf.id
 WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2";
       $params = array(
         1 => array($priceSetId, 'Integer'),
-        2 => array($feeLevel, 'String')
+        2 => array($feeLevel, 'String'),
       );
       $mainAmount = CRM_Core_DAO::singleValueQuery($query, $params);
       $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Discounts Account is' "));
@@ -2127,7 +2138,7 @@ WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantI
           'payment_instrument_id' => $updatedContribution->payment_instrument_id,
           'contribution_id' => $updatedContribution->id,
           'trxn_date' => date('YmdHis'),
-          'currency' => $updatedContribution->currency
+          'currency' => $updatedContribution->currency,
         );
         $adjustedTrxn = CRM_Core_BAO_FinancialTrxn::create($adjustedTrxnValues);
       }