diff --git a/src/importer/class-tainacan-csv.php b/src/importer/class-tainacan-csv.php index 7a050c22d..3745ca4b3 100644 --- a/src/importer/class-tainacan-csv.php +++ b/src/importer/class-tainacan-csv.php @@ -140,6 +140,10 @@ class CSV extends Importer { return false; } + if( $this->get_option('item_id_index') ){ + $this->handle_item_id( $values ); + } + foreach ( $collection_definition['mapping'] as $metadatum_id => $header) { $metadatum = new \Tainacan\Entities\Metadatum($metadatum_id); @@ -562,6 +566,9 @@ class CSV extends Importer { } + /** + * @param $status string the item ID + */ private function handle_item_id( $values ){ $item_id_index = $this->set_option('item_id_index'); diff --git a/src/importer/class-tainacan-importer.php b/src/importer/class-tainacan-importer.php index db7b25e68..bd39a9e07 100644 --- a/src/importer/class-tainacan-importer.php +++ b/src/importer/class-tainacan-importer.php @@ -786,7 +786,7 @@ abstract class Importer { $Tainacan_Metadata->disable_logs(); $Tainacan_Item_Metadata->disable_logs(); - $item = new Entities\Item(); + $item = new Entities\Item( ( $this->get_transient('item_id') ) ? $this->get_transient('item_id') : 0 ); $itemMetadataArray = []; if( is_array( $processed_item ) ){