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

@ -51,7 +51,13 @@ class CSV extends Importer {
$this->set_option('item_comment_status_index', $index);
}
} else {
$columns[] = $rawColumn;
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 {
$columns[] = $rawColumn;
}
}
}
return $columns;