diff --git a/src/Biopen/GeoDirectoryBundle/Resources/views/admin/core_custom/custom-fields/mapping-taxonomy.html.twig b/src/Biopen/GeoDirectoryBundle/Resources/views/admin/core_custom/custom-fields/mapping-taxonomy.html.twig index c16cc0fb4a2240aba2d03896a1ded4de7a8b5db8..e285bd76734476ced8a0764736f7a2b5290d0890 100644 --- a/src/Biopen/GeoDirectoryBundle/Resources/views/admin/core_custom/custom-fields/mapping-taxonomy.html.twig +++ b/src/Biopen/GeoDirectoryBundle/Resources/views/admin/core_custom/custom-fields/mapping-taxonomy.html.twig @@ -64,11 +64,6 @@ multiple: true }); - // on init, if the category selector is empty that mean that the old mapped category does not exist anymore - $(".category-selector").each(function() { - if (!$(this).val()) $(this).siblings('input').val('/'); - }); - $('.clear-icon').click(function() { $(this).parent().parent().find('.category-selector:not(.select2-container)').val("").trigger('change'); }); diff --git a/src/Biopen/GeoDirectoryBundle/Services/ElementImportMappingService.php b/src/Biopen/GeoDirectoryBundle/Services/ElementImportMappingService.php index a81c4840399e78b28317b3c441723c2d00f7dcb5..6ede14f2f6e05133ef37b21716f59ff109b6a4ad 100644 --- a/src/Biopen/GeoDirectoryBundle/Services/ElementImportMappingService.php +++ b/src/Biopen/GeoDirectoryBundle/Services/ElementImportMappingService.php @@ -197,10 +197,8 @@ class ElementImportMappingService $taxonomyMapping[$key] = array_filter($value, function($el) use ($allOptionsIds) { return in_array($el, $allOptionsIds); }); - if (count($taxonomyMapping[$key]) == 0) unset($taxonomyMapping[$key]); } $import->setTaxonomyMapping($taxonomyMapping); - $allNewCategories = []; $this->createOptionsMappingTable(); foreach($data as $row) @@ -222,7 +220,7 @@ class ElementImportMappingService if ($value == '' && $this->createMissingOptions) $value = $this->createOption($category); $taxonomyMapping[$category] = [$value]; - $import->setNewTaxonomyToMap(true); + if (!$value) $import->setNewTaxonomyToMap(true); } // create options for previously imported non mapped options if (array_key_exists($category, $taxonomyMapping)