From 95f3fc66c290d43fe27a20968f46df538be84317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 15 Mar 2026 21:47:15 +0100 Subject: [PATCH] Do not throw an 500 error, if mapping is not possible This fixes issue #1298 --- .../projects/import_bom_map_fields.html.twig | 70 +++++++++++-------- translations/messages.en.xlf | 6 ++ 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/templates/projects/import_bom_map_fields.html.twig b/templates/projects/import_bom_map_fields.html.twig index 4e45eb08..ee1e23ef 100644 --- a/templates/projects/import_bom_map_fields.html.twig +++ b/templates/projects/import_bom_map_fields.html.twig @@ -48,51 +48,59 @@
- - - - - - + + + + + + - {% for field in detected_fields %} - - - + + - + - - - {% endfor %} + {% endif %} + + + + {% endfor %}
{% trans %}project.bom_import.field_mapping.csv_field{% endtrans %}{% trans %}project.bom_import.field_mapping.maps_to{% endtrans %}{% trans %}project.bom_import.field_mapping.suggestion{% endtrans %}{% trans %}project.bom_import.field_mapping.priority{% endtrans %}
{% trans %}project.bom_import.field_mapping.csv_field{% endtrans %}{% trans %}project.bom_import.field_mapping.maps_to{% endtrans %}{% trans %}project.bom_import.field_mapping.suggestion{% endtrans %}{% trans %}project.bom_import.field_mapping.priority{% endtrans %}
- {{ field }} - + {% for field in detected_fields %} +
+ {{ field }} + + {# TODO: This is more a workaround than a proper fix. Ideally the controller should be fixed in a way, that we get the correct fields here #} + {% if field_name_mapping[field] is defined %} + {% set field_name = field_name_mapping[field] %} {{ form_widget(form['mapping_' ~ field_name_mapping[field]], { 'attr': { 'class': 'form-select field-mapping-select', 'data-field': field } }) }} - - {% if suggested_mapping[field] is defined %} - + {% else %} + + {% trans %}project.bom_import.field_mapping.error.check_delimiter{% endtrans %} + + {% endif %} + + {% if suggested_mapping[field] is defined %} + {{ suggested_mapping[field] }} - {% else %} - + {% else %} + {% trans %}project.bom_import.field_mapping.no_suggestion{% endtrans %} - {% endif %} - - -
+ +
diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index 180d9e5e..d92af86d 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -12947,5 +12947,11 @@ Buerklin-API Authentication server: [Part_lot] created from barcode: Please check if the data is correct and desired. + + + project.bom_import.field_mapping.error.check_delimiter + Mapping error: Check if you have selected the right delimiter! + +