add compound in source_info #391

This commit is contained in:
vnmedeiros 2020-07-03 11:01:16 -03:00
parent c3148daa91
commit c55b58b0ad
1 changed files with 7 additions and 1 deletions

View File

@ -50,10 +50,16 @@ class CSV extends Importer {
} else if( $rawColumn === 'special_comment_status' ) { } else if( $rawColumn === 'special_comment_status' ) {
$this->set_option('item_comment_status_index', $index); $this->set_option('item_comment_status_index', $index);
} }
} else {
if ( preg_match ('/.*\|compound\(.*\)/', $rawColumn ) ) {
$data = preg_split("/[()]+/", $rawColumn, -1, PREG_SPLIT_NO_EMPTY);
$parent = $data[0] . ( isset($data[2]) ? $data[2] : '' );
$columns[] = [$parent => explode($this->get_option('delimiter'), $data[1])];
} else { } else {
$columns[] = $rawColumn; $columns[] = $rawColumn;
} }
} }
}
return $columns; return $columns;
} }
} }