From: Coleman Watts Date: Wed, 30 May 2018 23:10:37 +0000 (-0400) Subject: dev/core/#152 - Remove AdvMulti-Select custom field type X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6cc845adbac29008d2d05c0975e6ac64aee59954;p=civicrm-core.git dev/core/#152 - Remove AdvMulti-Select custom field type --- diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index a04f15928e..420cb70de2 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -1246,7 +1246,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { $htmlType = array( 'CheckBox', 'Multi-Select', - 'AdvMulti-Select', 'Select', 'Radio', 'Multi-Select State/Province', @@ -1260,7 +1259,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { } // check for values for custom fields for checkboxes and multiselect - if ($customFields[$customFieldID]['html_type'] == 'CheckBox' || $customFields[$customFieldID]['html_type'] == 'AdvMulti-Select' || $customFields[$customFieldID]['html_type'] == 'Multi-Select') { + if ($customFields[$customFieldID]['html_type'] == 'CheckBox' || $customFields[$customFieldID]['html_type'] == 'Multi-Select') { $value = trim($value); $value = str_replace('|', ',', $value); $mulValues = explode(',', $value); diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index ce816c53d1..06e8bc0ae7 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -99,7 +99,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { 'Radio' => 'Radio', 'CheckBox' => 'CheckBox', 'Multi-Select' => 'Multi-Select', - 'AdvMulti-Select' => 'AdvMulti-Select', 'Autocomplete-Select' => 'Autocomplete-Select', ), array('Text' => 'Text', 'Select' => 'Select', 'Radio' => 'Radio'), @@ -167,7 +166,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { break; case 'CheckBox': - case 'AdvMulti-Select': case 'Multi-Select': if (isset($params['default_checkbox_option'])) { $tempArray = array_keys($params['default_checkbox_option']); @@ -819,7 +817,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { 'Multi-Select State/Province', 'Select Country', 'Multi-Select Country', - 'AdvMulti-Select', 'CheckBox', 'Radio', ))); @@ -828,7 +825,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $options = $field->getOptions($search ? 'search' : 'create'); // Consolidate widget types to simplify the below switch statement - if ($search || ($widget !== 'AdvMulti-Select' && strpos($widget, 'Select') !== FALSE)) { + if ($search || (strpos($widget, 'Select') !== FALSE)) { $widget = 'Select'; } @@ -970,27 +967,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { } break; - case 'AdvMulti-Select': - $element = $qf->addElement( - 'advmultiselect', - $elementName, - $label, $options, - array( - 'size' => 5, - 'style' => '', - 'class' => 'advmultiselect', - 'data-crm-custom' => $dataCrmCustomVal, - ) - ); - - $element->setButtonAttributes('add', array('value' => ts('Add >>'))); - $element->setButtonAttributes('remove', array('value' => ts('<< Remove'))); - - if ($useRequired && !$search) { - $qf->addRule($elementName, ts('%1 is a required field.', array(1 => $label)), 'required'); - } - break; - case 'CheckBox': $check = array(); foreach ($options as $v => $l) { @@ -1204,7 +1180,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { case 'Select Country': case 'Select State/Province': case 'CheckBox': - case 'AdvMulti-Select': case 'Multi-Select': case 'Multi-Select State/Province': case 'Multi-Select Country': @@ -1373,7 +1348,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { } switch ($customField->html_type) { case 'CheckBox': - case 'AdvMulti-Select': case 'Multi-Select': $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldId, FALSE); $defaults[$elementName] = array(); @@ -1385,9 +1359,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { if ($customField->html_type == 'CheckBox') { $defaults[$elementName][$val['value']] = 1; } - elseif ($customField->html_type == 'Multi-Select' || - $customField->html_type == 'AdvMulti-Select' - ) { + elseif ($customField->html_type == 'Multi-Select') { $defaults[$elementName][$val['value']] = $val['value']; } } @@ -1597,9 +1569,7 @@ SELECT id } } - if ($customFields[$customFieldId]['html_type'] == 'Multi-Select' || - $customFields[$customFieldId]['html_type'] == 'AdvMulti-Select' - ) { + if ($customFields[$customFieldId]['html_type'] == 'Multi-Select') { if ($value) { $value = CRM_Utils_Array::implodePadded($value); } @@ -1609,7 +1579,6 @@ SELECT id } if (($customFields[$customFieldId]['html_type'] == 'Multi-Select' || - $customFields[$customFieldId]['html_type'] == 'AdvMulti-Select' || $customFields[$customFieldId]['html_type'] == 'CheckBox' ) && $customFields[$customFieldId]['data_type'] == 'String' && diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index 282bc2e7db..a60def47e9 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -1386,7 +1386,6 @@ ORDER BY civicrm_custom_group.weight, switch ($field['html_type']) { case 'Multi-Select': - case 'AdvMulti-Select': case 'CheckBox': $defaults[$elementName] = array(); $customOption = CRM_Core_BAO_CustomOption::getCustomOption($field['id'], $inactiveNeeded); @@ -1506,7 +1505,6 @@ ORDER BY civicrm_custom_group.weight, //added Multi-Select option in the below if-statement if ($field['html_type'] == 'CheckBox' || $field['html_type'] == 'Radio' || - $field['html_type'] == 'AdvMulti-Select' || $field['html_type'] == 'Multi-Select' ) { $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = 'NULL'; @@ -1542,10 +1540,6 @@ ORDER BY civicrm_custom_group.weight, } break; - //added for Advanced Multi-Select - - case 'AdvMulti-Select': - //added for Multi-Select case 'Multi-Select': if (!empty($v)) { $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = CRM_Core_DAO::VALUE_SEPARATOR @@ -1663,7 +1657,6 @@ ORDER BY civicrm_custom_group.weight, $htmlType = array( 'CheckBox', 'Multi-Select', - 'AdvMulti-Select', 'Select', 'Radio', ); @@ -1684,7 +1677,6 @@ ORDER BY civicrm_custom_group.weight, $valid = CRM_Core_BAO_CustomValue::typecheck($field['data_type'], $value); } if ($field['html_type'] == 'CheckBox' || - $field['html_type'] == 'AdvMulti-Select' || $field['html_type'] == 'Multi-Select' ) { $value = str_replace("|", ",", $value); diff --git a/CRM/Core/BAO/CustomOption.php b/CRM/Core/BAO/CustomOption.php index 6f52aa034b..3fc2bf6942 100644 --- a/CRM/Core/BAO/CustomOption.php +++ b/CRM/Core/BAO/CustomOption.php @@ -155,7 +155,7 @@ class CRM_Core_BAO_CustomOption { $action -= CRM_Core_Action::DELETE; } - if (in_array($field->html_type, array('CheckBox', 'AdvMulti-Select', 'Multi-Select'))) { + if (in_array($field->html_type, ['CheckBox', 'Multi-Select'])) { if (isset($defVal) && in_array($dao->value, $defVal)) { $options[$dao->id]['is_default'] = ''; } @@ -291,7 +291,6 @@ WHERE id = %2"; ); break; - case 'AdvMulti-Select': case 'Multi-Select': case 'CheckBox': $oldString = CRM_Core_DAO::VALUE_SEPARATOR . $oldValue . CRM_Core_DAO::VALUE_SEPARATOR; diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 02055aa760..722fc4b9df 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -1321,7 +1321,6 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { elseif (in_array($htmlType, array( 'CheckBox', 'Multi-Select', - 'AdvMulti-Select', 'Multi-Select State/Province', 'Multi-Select Country', ))) { @@ -2388,7 +2387,6 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) switch ($customFields[$customFieldId]['html_type']) { case 'Multi-Select State/Province': case 'Multi-Select Country': - case 'AdvMulti-Select': case 'Multi-Select': $v = explode(CRM_Core_DAO::VALUE_SEPARATOR, $details[$name]); foreach ($v as $item) { diff --git a/CRM/Core/Page/AJAX/Location.php b/CRM/Core/Page/AJAX/Location.php index 96b5df2d1a..5749c923e6 100644 --- a/CRM/Core/Page/AJAX/Location.php +++ b/CRM/Core/Page/AJAX/Location.php @@ -171,7 +171,7 @@ class CRM_Core_Page_AJAX_Location { $elements["onbehalf_{$key}"]['value'][$k] = $v; } } - elseif (strstr($htmlType, 'Multi-Select') && $htmlType != 'AdvMulti-Select') { + elseif (strstr($htmlType, 'Multi-Select')) { $elements["onbehalf_{$key}"]['type'] = 'Multi-Select'; $elements["onbehalf_{$key}"]['value'] = array_values($defaults[$key]); } diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 73d92562d0..6f4ed3c8b4 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -203,7 +203,6 @@ class CRM_Core_SelectValues { 'RichTextEditor' => ts('Rich Text Editor'), 'Autocomplete-Select' => ts('Autocomplete-Select'), 'Multi-Select' => ts('Multi-Select'), - 'AdvMulti-Select' => ts('AdvMulti-Select'), 'Link' => ts('Link'), 'ContactReference' => ts('Autocomplete-Select'), ); diff --git a/CRM/Custom/Form/ChangeFieldType.php b/CRM/Custom/Form/ChangeFieldType.php index 9fbc7bc571..1b05717e2f 100644 --- a/CRM/Custom/Form/ChangeFieldType.php +++ b/CRM/Custom/Form/ChangeFieldType.php @@ -155,7 +155,6 @@ class CRM_Custom_Form_ChangeFieldType extends CRM_Core_Form { $mutliValueOps = array( 'CheckBox', 'Multi-Select', - 'AdvMulti-Select', ); $srcHtmlType = $this->_values['html_type']; @@ -220,7 +219,6 @@ class CRM_Custom_Form_ChangeFieldType extends CRM_Core_Form { $mutliValueOps = array( 'CheckBox' => 'CheckBox', 'Multi-Select' => 'Multi-Select', - 'AdvMulti-Select' => 'AdvMulti-Select', ); switch ($dataType) { diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php index ab82214a85..5326a2ff10 100644 --- a/CRM/Custom/Form/Field.php +++ b/CRM/Custom/Form/Field.php @@ -135,7 +135,6 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { 'Radio' => ts('Radio'), 'CheckBox' => ts('CheckBox'), 'Multi-Select' => ts('Multi-Select'), - 'AdvMulti-Select' => ts('Adv Multi-Select (obsolete)'), 'Autocomplete-Select' => ts('Autocomplete-Select'), ), array( @@ -708,7 +707,7 @@ SELECT count(*) if (isset($fields['data_type'][1])) { $dataField = $fields['data_type'][1]; } - $optionFields = array('Select', 'Multi-Select', 'CheckBox', 'Radio', 'AdvMulti-Select'); + $optionFields = array('Select', 'Multi-Select', 'CheckBox', 'Radio'); if (isset($fields['option_type']) && $fields['option_type'] == 1) { //capture duplicate Custom option values diff --git a/CRM/Custom/Form/Option.php b/CRM/Custom/Form/Option.php index b861c7f344..96a45c0089 100644 --- a/CRM/Custom/Form/Option.php +++ b/CRM/Custom/Form/Option.php @@ -115,7 +115,6 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { if ($fieldDefaults['html_type'] == 'CheckBox' || $fieldDefaults['html_type'] == 'Multi-Select' - || $fieldDefaults['html_type'] == 'AdvMulti-Select' ) { if (!empty($fieldDefaults['default_value'])) { $defaultCheckValues = explode(CRM_Core_DAO::VALUE_SEPARATOR, @@ -434,7 +433,6 @@ SELECT count(*) $customField->find(TRUE) && ( $customField->html_type == 'CheckBox' || - $customField->html_type == 'AdvMulti-Select' || $customField->html_type == 'Multi-Select' ) ) { diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index e5229c7d3e..86b3ff0312 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -1633,7 +1633,6 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m break; case 'CheckBox': - case 'AdvMulti-Select': case 'Multi-Select': case 'Multi-Select Country': case 'Multi-Select State/Province': @@ -1667,7 +1666,6 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m if (in_array($htmlType, array( 'CheckBox', 'Multi-Select', - 'AdvMulti-Select', ))) { $submitted[$key] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $mergeValue diff --git a/CRM/Member/Import/Parser/Membership.php b/CRM/Member/Import/Parser/Membership.php index 0e03811cb2..195d14b802 100644 --- a/CRM/Member/Import/Parser/Membership.php +++ b/CRM/Member/Import/Parser/Membership.php @@ -658,7 +658,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) { $values[$key] = $value; $type = $customFields[$customFieldID]['html_type']; - if ($type == 'CheckBox' || $type == 'Multi-Select' || $type == 'AdvMulti-Select') { + if ($type == 'CheckBox' || $type == 'Multi-Select') { $mulValues = explode(',', $value); $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE); $values[$key] = array(); diff --git a/CRM/Upgrade/Incremental/sql/5.3.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.3.alpha1.mysql.tpl index 520a37a29c..cb1a7511c1 100644 --- a/CRM/Upgrade/Incremental/sql/5.3.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/5.3.alpha1.mysql.tpl @@ -13,3 +13,6 @@ ALTER TABLE civicrm_custom_field ALTER column is_active SET DEFAULT 1; SET @UKCountryId = (SELECT id FROM civicrm_country cc WHERE cc.name = 'United Kingdom'); INSERT INTO civicrm_state_province (country_id, abbreviation, name) VALUES (@UKCountryId, 'MON', 'Monmouthshire'); + +{* dev/core/#152 *} +UPDATE `civicrm_custom_field` set `html_type` = "Multi-Select" WHERE `html_type` = "AdvMulti-Select"; diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 81b4924978..00afe4332e 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -863,7 +863,6 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { $htmlType = CRM_Utils_Array::value('html_type', $customFields[$customFieldID]); switch ($htmlType) { case 'CheckBox': - case 'AdvMulti-Select': case 'Multi-Select': if ($val) { $mulValues = explode(',', $val); diff --git a/api/v3/CustomField.php b/api/v3/CustomField.php index 43f2ce2afd..32ef50f8c0 100644 --- a/api/v3/CustomField.php +++ b/api/v3/CustomField.php @@ -243,7 +243,7 @@ SELECT count(*) } if (in_array($htmlType, array( - 'Select', 'Multi-Select', 'CheckBox', 'Radio', 'AdvMulti-Select')) && + 'Select', 'Multi-Select', 'CheckBox', 'Radio')) && !isset($errors[$fieldName]) ) { $options = CRM_Core_OptionGroup::valuesByID($fieldDetails['option_group_id']); diff --git a/templates/CRM/Custom/Form/ChangeFieldType.tpl b/templates/CRM/Custom/Form/ChangeFieldType.tpl index a2a90253cd..3977814ef2 100644 --- a/templates/CRM/Custom/Form/ChangeFieldType.tpl +++ b/templates/CRM/Custom/Form/ChangeFieldType.tpl @@ -45,7 +45,7 @@ function checkCustomDataField( ) { var srcHtmlType = '{/literal}{$srcHtmlType}{literal}'; var singleValOps = ['Text', 'Select', 'Radio', 'Autocomplete-Select']; - var multiValOps = ['CheckBox', 'Multi-Select', 'AdvMulti-Select']; + var multiValOps = ['CheckBox', 'Multi-Select']; var dstHtmlType = cj('#dst_html_type').val( ); if ( !dstHtmlType ) { return true; diff --git a/templates/CRM/Custom/Form/Field.tpl b/templates/CRM/Custom/Form/Field.tpl index 8517a9236d..32723fd6b3 100644 --- a/templates/CRM/Custom/Form/Field.tpl +++ b/templates/CRM/Custom/Form/Field.tpl @@ -184,19 +184,8 @@