Allow Participant roles to be specified as an array
[civicrm-core.git] / CRM / Event / BAO / Participant.php
index ee1797400e44772f573403658a6988257124dffb..14faa1aee44ad5e7d4005e1024d13b2e61ee0dd8 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -106,6 +106,11 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant {
       $params['fee_amount'] = CRM_Utils_Rule::cleanMoney($params['fee_amount']);
     }
 
+    // ensure that role ids are encoded as a string
+    if (is_array($params['role_id'])) {
+      $params['role_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $params['role_id']);
+    }
+
     $participantBAO = new CRM_Event_BAO_Participant;
     if (CRM_Utils_Array::value('id', $params)) {
       $participantBAO->id = CRM_Utils_Array::value('id', $params);
@@ -469,7 +474,7 @@ SELECT  event.event_full_text,
       return ($returnEmptySeats) ? (int) $eventMaxSeats : FALSE;
     }
 
-    return $evenFullText;
+    return $eventFullText;
   }
 
   /**
@@ -1458,7 +1463,7 @@ UPDATE  civicrm_participant
         $receiptFrom = $eventDetails['confirm_from_name'] . ' <' . $eventDetails['confirm_from_email'] . '>';
       }
 
-      list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate(
+      list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(
         array(
           'groupName' => 'msg_tpl_workflow_event',
           'valueName' => 'participant_' . strtolower($mailType),
@@ -1738,7 +1743,7 @@ WHERE    civicrm_participant.contact_id = {$contactID} AND
     $checkDiscount = CRM_Core_BAO_Discount::findSet($eventID,'civicrm_event');
     if (!empty($checkDiscount)) {
       $feeLevel = current($feeLevel);
-      $priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $eventID, NULL);
+      $priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $eventID, NULL);
       $query = "SELECT cpfv.amount FROM `civicrm_price_field_value` cpfv
 LEFT JOIN civicrm_price_field cpf ON cpfv.price_field_id = cpf.id
 WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2";
@@ -1765,7 +1770,7 @@ WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2";
    *
    * CRM-12155
    *
-   * @param integer $contactId contact id 
+   * @param integer $contactId contact id
    *
    * @access public
    * @static