CRM-15427 Additional Fixes
authoratif-shaikh <shaikh388@gmail.com>
Wed, 29 Oct 2014 08:24:52 +0000 (13:54 +0530)
committeratif-shaikh <shaikh388@gmail.com>
Wed, 29 Oct 2014 08:24:52 +0000 (13:54 +0530)
----------------------------------------
* CRM-15427: Profiles using Participants (Event type), Participants (Event Name) and Participants (Role) custom fields are not available for online registration
  https://issues.civicrm.org/jira/browse/CRM-15427

CRM/Core/BAO/UFGroup.php
CRM/Event/Form/ManageEvent/Registration.php
js/model/crm.uf.js

index 4e2662488e91e79033b1f82d16742f2609f56d0f..14cb13cb23726ff1cbc7f47ce5b984cf6591fde6 100644 (file)
@@ -1405,6 +1405,10 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup {
     $params['limit_listings_group_id'] = CRM_Utils_Array::value('group', $params);
     $params['add_to_group_id'] = CRM_Utils_Array::value('add_contact_to_group', $params);
 
+    //CRM-15427
+    if (!empty($params['group_type']) && is_array($params['group_type'])) {
+      $params['group_type'] = implode(',', $params['group_type']);
+    }
     $ufGroup = new CRM_Core_DAO_UFGroup();
     $ufGroup->copyValues($params);
 
index 040f42e09895c180393b1fbcba2ac820746b8e30..4075c3c39d306c42bb7773618a54e7ee8f4e1e8a 100644 (file)
@@ -380,12 +380,13 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent
     $configs['allowCoreTypes'][] = 'Individual';
     $configs['allowCoreTypes'][] = 'Participant';
     //CRM-15427
-    $participantEventType = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $_GET['id'], 'event_type_id', 'id');
-    $participantRole  = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $_GET['id'], 'default_role_id');
-    $configs['allowSubTypes']['ParticipantEventName'] = array($_GET['id']);
-    $configs['allowSubTypes']['ParticipantEventType'] = array($participantEventType);
-    $configs['allowSubTypes']['ParticipantRole'] = array($participantRole);
-
+    if (!empty($_GET['id']) && is_numeric($_GET['id'])) {
+      $participantEventType = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $_GET['id'], 'event_type_id', 'id');
+      $participantRole  = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $_GET['id'], 'default_role_id');
+      $configs['allowSubTypes']['ParticipantEventName'] = array($_GET['id']);
+      $configs['allowSubTypes']['ParticipantEventType'] = array($participantEventType);
+      $configs['allowSubTypes']['ParticipantRole'] = array($participantRole);
+    }
     $configs['profileEntities'][] = array('entity_name' => 'contact_1', 'entity_type' => 'IndividualModel');
     $configs['profileEntities'][] = array('entity_name' => 'participant_1', 'entity_type' => 'ParticipantModel', 'entity_sub_type' => '*');
 
index 392d0a44141cd4e1c44823eb452f8dfd6dae2936..b28f876140c58246ac74c984d12b9d3955f0efd8 100644 (file)
      * @return {Boolean}
      */
     //CRM-15427
-    checkGroupType: function(validTypesExpr, allowAllSubtypes = false) {
+    checkGroupType: function(validTypesExpr, allowAllSubtypes) {
       var allMatched = true;
+      allowAllSubtypes = allowAllSubtypes || false;
       if (! this.get('group_type') || this.get('group_type') == '') {
         return true;
       }