fix: create order of metadata on importing csv only if there is no previous order
This commit is contained in:
parent
e765c0fb14
commit
f4dbc2646c
|
@ -980,13 +980,16 @@ class CSV extends Importer {
|
|||
}
|
||||
|
||||
$this->save_mapping( $collection['id'], $collection['mapping'] );
|
||||
|
||||
|
||||
$coll = \Tainacan\Repositories\Collections::get_instance()->fetch($collection['id']);
|
||||
$metadata_order = array_map(
|
||||
function($meta) { return ["enabled"=>true, "id"=>$meta]; },
|
||||
array_keys( $collection['mapping'] )
|
||||
);
|
||||
$coll->set_metadata_order( $metadata_order );
|
||||
if(empty($coll->get_metadata_order())) {
|
||||
$metadata_order = array_map(
|
||||
function($meta) { return ["enabled"=>true, "id"=>$meta]; },
|
||||
array_keys( $collection['mapping'] )
|
||||
);
|
||||
$coll->set_metadata_order( $metadata_order );
|
||||
}
|
||||
|
||||
if ( $coll->validate() ) {
|
||||
\Tainacan\Repositories\Collections::get_instance()->update( $coll );
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue