From 01a2bd5b77c6b0d3abb7e7c0a6fe4b6e8699d65a Mon Sep 17 00:00:00 2001 From: Sebastian Castro <sebastian.castro@protonmail.com> Date: Thu, 3 Oct 2019 09:18:11 +0200 Subject: [PATCH] Fixs bug in element import taxonomy mapping --- .../core_custom/custom-fields/mapping-taxonomy.html.twig | 5 ----- .../Services/ElementImportMappingService.php | 4 +--- 2 files changed, 1 insertion(+), 8 deletions(-) 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 c16cc0fb4..e285bd767 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 a81c48403..6ede14f2f 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) -- GitLab