add logs and new verification to get id for update (#210)

This commit is contained in:
Eduardo Humberto 2019-03-18 16:52:41 -03:00
parent 5ffd73f685
commit b176892b50
1 changed files with 6 additions and 1 deletions

View File

@ -124,6 +124,7 @@ class CSV extends Importer {
$this->add_log('item index ' . $this->get_option('item_id_index') );
if( is_numeric($this->get_option('item_id_index')) ) {
$this->handle_item_id( $values );
$this->add_log('Updating item' );
}
foreach ( $collection_definition['mapping'] as $metadatum_id => $header) {
@ -557,9 +558,13 @@ class CSV extends Importer {
$Tainacan_Metadata->disable_logs();
$Tainacan_Item_Metadata->disable_logs();
$item = new Entities\Item( ( $this->get_transient('item_id') ) ? $this->get_transient('item_id') : 0 );
$item = new Entities\Item( ( is_numeric($this->get_transient('item_id')) ) ? $this->get_transient('item_id') : 0 );
$itemMetadataArray = [];
if( is_numeric($this->get_transient('item_id')) ) {
$this->add_log('item will be updated ID:' . $item->get_id() );
}
if( $this->get_transient('item_id') && $item && is_numeric($item->get_id()) && $item->get_id() > 0 && $this->get_transient('item_action') == 'ignore' ){
$this->add_log('Repeated Item');
return $item;