diff --git a/importexport/inc/class.importexport_export_csv.inc.php b/importexport/inc/class.importexport_export_csv.inc.php index 922ed1680b..2cbc0106a4 100644 --- a/importexport/inc/class.importexport_export_csv.inc.php +++ b/importexport/inc/class.importexport_export_csv.inc.php @@ -282,19 +282,20 @@ class importexport_export_csv implements importexport_iface_export_record if($appname) { if(!self::$cf_parse_cache[$appname]) { $c_fields = self::convert_parse_custom_fields($appname, $selects, $links, $methods); - - // Add in any fields that are keys to another app - foreach((array)$fields['links'] as $link_field => $app) - { - if(is_numeric($link_field)) continue; - $links[$link_field] = $app; - // Set it as a normal link field - $fields['links'][] = $link_field; - unset($fields['links'][$link_field]); - } self::$cf_parse_cache[$appname] = array($c_fields, $selects, $links, $methods); } list($c_fields, $c_selects, $links, $methods) = self::$cf_parse_cache[$appname]; + + // Add in any fields that are keys to another app + foreach((array)$fields['links'] as $link_field => $app) + { + if(is_numeric($link_field)) continue; + $links[$link_field] = $app; + // Set it as a normal link field + $fields['links'][] = $link_field; + unset($fields['links'][$link_field]); + } + // Not quite a recursive merge, since only one level foreach($fields as $type => &$list) { if($c_fields[$type]) { @@ -304,7 +305,6 @@ class importexport_export_csv implements importexport_iface_export_record } $fields += $c_fields; $selects += $c_selects; - } foreach((array)$fields['select'] as $name) { if($record->$name != null && is_array($selects) && $selects[$name]) { diff --git a/importexport/inc/class.importexport_import_csv.inc.php b/importexport/inc/class.importexport_import_csv.inc.php index 7c7851bc73..dd93b7e353 100755 --- a/importexport/inc/class.importexport_import_csv.inc.php +++ b/importexport/inc/class.importexport_import_csv.inc.php @@ -272,18 +272,20 @@ class importexport_import_csv implements importexport_iface_import_record { //, if(!self::$cf_parse_cache[$appname]) { $c_fields = importexport_export_csv::convert_parse_custom_fields($appname, $selects, $links, $methods); - // Add in any fields that are keys to another app - foreach((array)$fields['links'] as $link_field => $app) - { - if(is_numeric($link_field)) continue; - $links[$link_field] = $app; - // Set it as a normal link field - $fields['links'][] = $link_field; - unset($fields['links'][$link_field]); - } self::$cf_parse_cache[$appname] = array($c_fields, $selects, $links, $methods); } list($c_fields, $c_selects, $links, $methods) = self::$cf_parse_cache[$appname]; + + // Add in any fields that are keys to another app + foreach((array)$fields['links'] as $link_field => $app) + { + if(is_numeric($link_field)) continue; + $links[$link_field] = $app; + // Set it as a normal link field + $fields['links'][] = $link_field; + unset($fields['links'][$link_field]); + } + // Not quite a recursive merge, since only one level foreach($fields as $type => &$list) {