CRM-15595 - Individual sub-type custom fields don't appear in online event registration
authoratif-shaikh <shaikh388@gmail.com>
Tue, 18 Nov 2014 05:58:22 +0000 (11:28 +0530)
committeratif-shaikh <shaikh388@gmail.com>
Tue, 18 Nov 2014 05:58:22 +0000 (11:28 +0530)
https://issues.civicrm.org/jira/browse/CRM-15595

CRM/Event/Form/ManageEvent/Registration.php
CRM/UF/Page/ProfileEditor.php
js/jquery/jquery.crmProfileSelector.js
js/model/crm.uf.js

index cdf24e26bb2c6ed9f15568c70b85b67743a0c538..95f4e5c67a94b1f506bd5c83c963fa20300fa4a2 100644 (file)
@@ -376,8 +376,7 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent
       'profileEntities' => array(),
     );
 
-    $configs['allowCoreTypes'][] = 'Contact';
-    $configs['allowCoreTypes'][] = 'Individual';
+    $configs['allowCoreTypes'] = array_merge(array('Contact', 'Individual'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
     $configs['allowCoreTypes'][] = 'Participant';
     //CRM-15427
     $id = CRM_Utils_Request::retrieve( 'id' , 'Integer' );
index 441e6b7e2eb98623b5bc4a198c0cb1c53ed1225b..0991bd7894a2f00bee33fdacff4e304ba0b88e5d 100644 (file)
@@ -31,6 +31,7 @@ class CRM_UF_Page_ProfileEditor extends CRM_Core_Page {
             'is_active' => 1,
             'rowCount' => 1000, // FIXME
           )),
+          'contactSubTypes' => CRM_Contact_BAO_ContactType::subTypes(),
           'profilePreviewKey' => CRM_Core_Key::get('CRM_UF_Form_Inline_Preview', TRUE),
         );
       })
@@ -195,7 +196,9 @@ class CRM_UF_Page_ProfileEditor extends CRM_Core_Page {
         case 'Individual':
         case 'Organization':
         case 'Household':
-          if ($field['field_type'] != $extends && $field['field_type'] != 'Contact') {
+          if ($field['field_type'] != $extends && $field['field_type'] != 'Contact'
+            //CRM-15595 check if subtype
+            && !in_array($field['field_type'], CRM_Contact_BAO_ContactType::subTypes($extends))) {
             continue 2;
           }
           break;
index 8bb4a51e4f50b065cb94f835a0214f8e2c1742b7..9dc5cf8d7bfb736a44c473aefa774012035b5219 100644 (file)
         else {
           civiComponent = 'Contribution';
         }
-        CRM.alert(ts('The selected profile is using a custom field which is not assigned to the '+civiComponent+' being configured.'),ts('Warning'));
+        CRM.alert(
+          ts('The selected profile is using a custom field which is not assigned to the "%1" being configured.', {
+            1: civiComponent
+          }),
+          ts('Warning')
+        );
       }
       var view = new CRM.ProfileSelector.View({
         ufGroupId: $select.val(),
index b28f876140c58246ac74c984d12b9d3955f0efd8..cdb0ad24a9fec45ee6cb291483fb69a6645a11ed 100644 (file)
       case 'Case':
         return 'case_1';
       default:
-        throw "Cannot guess entity name for field_type=" + field_type;
+        if (!$.isEmptyObject(CRM.contactSubTypes) &&
+        ($.inArray(field_type,CRM.contactSubTypes) > -1)) {
+          return 'contact_1';
+        }
+        else {
+          throw "Cannot guess entity name for field_type=" + field_type;
+        }
     }
   }