Allow Participant roles to be specified as an array
authorKirk Jackson <kirk@caat.org.uk>
Mon, 2 Dec 2013 15:26:21 +0000 (15:26 +0000)
committerKirk Jackson <kirk@caat.org.uk>
Mon, 2 Dec 2013 15:26:21 +0000 (15:26 +0000)
CRM/Event/BAO/Participant.php

index 2f26fe66aaddbcdd9176e78fe07a36c13a71d5f7..14faa1aee44ad5e7d4005e1024d13b2e61ee0dd8 100644 (file)
@@ -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);