Fix link conversion only works the first time

This commit is contained in:
Nathan Gray 2012-12-18 16:36:05 +00:00
parent 1c4f15078d
commit e99ab7aff5
2 changed files with 22 additions and 20 deletions

View File

@ -282,6 +282,9 @@ 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);
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)
@ -292,9 +295,7 @@ class importexport_export_csv implements importexport_iface_export_record
$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];
// 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]) {

View File

@ -272,6 +272,10 @@ 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);
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)
{
@ -281,9 +285,7 @@ class importexport_import_csv implements importexport_iface_import_record { //,
$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];
// Not quite a recursive merge, since only one level
foreach($fields as $type => &$list)
{