CRM-20459: Actively deprecate CRM_Core_OptionGroup::getValue
authordeb.monish <monish.deb@jmaconsulting.biz>
Thu, 3 May 2018 07:11:16 +0000 (12:41 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Thu, 3 May 2018 07:11:16 +0000 (12:41 +0530)
CRM/Contribute/Form/Contribution/Main.php
CRM/Core/BAO/UFGroup.php
CRM/Core/DAO/CustomGroup.php
CRM/Event/Form/Registration/AdditionalParticipant.php
CRM/Event/Form/Registration/Register.php
xml/schema/Core/CustomGroup.xml

index da9214d221194f09085473c995870d3e5d37bd8d..9d7ed7c59b4bce1644644daddaa3a094a34c2080 100644 (file)
@@ -956,7 +956,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
 
     foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
       if ($greetingType = CRM_Utils_Array::value($greeting, $fields)) {
-        $customizedValue = CRM_Core_OptionGroup::getValue($greeting, 'Customized', 'name');
+        $customizedValue = CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $greeting . '_id', 'Customized');
         if ($customizedValue == $greetingType && empty($fielse[$greeting . '_custom'])) {
           $errors[$greeting . '_custom'] = ts('Custom %1 is a required field if %1 is of type Customized.',
             array(1 => ucwords(str_replace('_', " ", $greeting)))
index 5543a560150d8a2b7cb14c38c84c8a62621a9f0c..02055aa760955eb70ea5aa6210cb3d042a524763 100644 (file)
@@ -2161,7 +2161,7 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
       //else (for contribution), use configured SCT default value
       $SCTDefaultValue = CRM_Core_OptionGroup::getDefaultValue("soft_credit_type");
       if ($field['field_type'] == 'Membership') {
-        $SCTDefaultValue = CRM_Core_OptionGroup::getValue('soft_credit_type', 'Gift', 'name');
+        $SCTDefaultValue = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_ContributionSoft', 'soft_credit_type_id', 'gift');
       }
       $form->addElement('hidden', 'sct_default_id', $SCTDefaultValue, array('id' => 'sct_default_id'));
     }
@@ -3041,7 +3041,7 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
 
         $groupTypeName = "{$customGroups->extends}Type";
         if ($customGroups->extends == 'Participant' && $customGroups->extends_entity_column_id) {
-          $groupTypeName = CRM_Core_OptionGroup::getValue('custom_data_type', $customGroups->extends_entity_column_id, 'value', 'String', 'name');
+          $groupTypeName = CRM_Core_PseudoConstant::getName('CRM_Core_DAO_CustomGroup', 'extends_entity_column_id', $customGroups->extends_entity_column_id);
         }
 
         foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $customGroups->extends_entity_column_value) as $val) {
index 839c61fb9cf003e2752401952d132537e445f4b5..f747321fd9eff8750dd7bbcc77a692302d653077 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/CustomGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4b960c311aed67174e9c55901ba3993b)
+ * (GenCodeChecksum:e0236d574279679e242f45bc73c4680a)
  */
 
 /**
@@ -265,6 +265,13 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'entity' => 'CustomGroup',
           'bao' => 'CRM_Core_BAO_CustomGroup',
           'localizable' => 0,
+          'html' => [
+            'type' => 'Select',
+          ],
+          'pseudoconstant' => [
+            'optionGroupName' => 'custom_data_type',
+            'optionEditPath' => 'civicrm/admin/options/custom_data_type',
+          ]
         ],
         'extends_entity_column_value' => [
           'name' => 'extends_entity_column_value',
index 160c0132b3e90d5753713b7ec5bfec3f34af48c4..f107d94157be17109f4be9e477fd1502bebb8ce6 100644 (file)
@@ -583,7 +583,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R
 
     foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
       if ($greetingType = CRM_Utils_Array::value($greeting, $self->_params[0])) {
-        $customizedValue = CRM_Core_OptionGroup::getValue($greeting, 'Customized', 'name');
+        $customizedValue = CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $greeting . '_id', 'Customized');
         if ($customizedValue == $greetingType && empty($self->_params[0][$greeting . '_custom'])) {
           return FALSE;
         }
index af1519a35172efa6b4b25a8d9828c46288f14261..f9844dedcadcc7520666738813ab3e959191b85c 100644 (file)
@@ -904,7 +904,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
 
     foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
       if ($greetingType = CRM_Utils_Array::value($greeting, $fields)) {
-        $customizedValue = CRM_Core_OptionGroup::getValue($greeting, 'Customized', 'name');
+        $customizedValue = CRM_Core_PseudoConstant::getKey('CRM_Contact_BAO_Contact', $greeting . '_id', 'Customized');
         if ($customizedValue == $greetingType && empty($fields[$greeting . '_custom'])) {
           $errors[$greeting . '_custom'] = ts('Custom %1 is a required field if %1 is of type Customized.',
             array(1 => ucwords(str_replace('_', ' ', $greeting)))
index de3a4d70f168cf8e0f9332820d2ec0c0d0e95aad..49df6dc5c43bad0f29659da38c2f24a1f926a2a2 100644 (file)
     <title>Custom Group Subtype List</title>
     <default>NULL</default>
     <comment>FK to civicrm_option_value.id (for option group custom_data_type.)</comment>
+    <pseudoconstant>
+      <optionGroupName>custom_data_type</optionGroupName>
+    </pseudoconstant>
     <add>2.2</add>
+    <html>
+      <type>Select</type>
+    </html>
   </field>
   <field>
     <name>extends_entity_column_value</name>