ImportExport: Fix all custom field types were showing up as filterable. Now limited to the ones we can handle.

This commit is contained in:
nathangray 2020-07-10 11:25:49 -06:00
parent 510a6419c5
commit bc253e0bd7

View File

@ -609,6 +609,9 @@ class importexport_helper_functions {
*/ */
public static function get_filter_fields($app_name, $plugin_name, $wizard_plugin = null, $record_classname = null) public static function get_filter_fields($app_name, $plugin_name, $wizard_plugin = null, $record_classname = null)
{ {
// We only filter on these field types. Others could be added, but they need the UI figured out
static $allowed_types = array('select','select-cat','select-account','date','date-time');
$fields = array(); $fields = array();
try { try {
$plugin = is_object($plugin_name) ? $plugin_name : new $plugin_name(); $plugin = is_object($plugin_name) ? $plugin_name : new $plugin_name();
@ -640,7 +643,7 @@ class importexport_helper_functions {
foreach($record_classname::$types as $type => $type_fields) foreach($record_classname::$types as $type => $type_fields)
{ {
// Only these for now, until filter methods for others are figured out // Only these for now, until filter methods for others are figured out
if(!in_array($type, array('select','select-cat','select-account','date','date-time'))) continue; if(!in_array($type, $allowed_types)) continue;
foreach($type_fields as $field_name) foreach($type_fields as $field_name)
{ {
$fields[$field_name] = array( $fields[$field_name] = array(
@ -654,6 +657,7 @@ class importexport_helper_functions {
$custom = Api\Storage\Customfields::get($app_name); $custom = Api\Storage\Customfields::get($app_name);
foreach($custom as $field_name => $settings) foreach($custom as $field_name => $settings)
{ {
if(!in_array($settings['type'], $allowed_types)) continue;
$settings['name'] = '#'.$field_name; $settings['name'] = '#'.$field_name;
$fields['#'.$field_name] = $settings; $fields['#'.$field_name] = $settings;
} }