diff --git a/app/api/import_data.py b/app/api/import_data.py index 1c076b4..3bf7bf9 100644 --- a/app/api/import_data.py +++ b/app/api/import_data.py @@ -1743,6 +1743,8 @@ async def validate_csv_file( mapping_info = _build_dynamic_mapping(csv_headers, model_class, file_type) mapped_headers = mapping_info["mapped_headers"] unmapped_headers = mapping_info["unmapped_headers"] + # Accept legacy wide-format SETUP.csv as valid (Appl_Title, L_Head1..10, Default_Printer) + wide_ok = (file_type == "SETUP.csv" and _is_setup_wide_format(csv_headers)) # Sample data validation sample_rows = [] @@ -1770,7 +1772,7 @@ async def validate_csv_file( return { "file_type": file_type, # Consider valid if we can map at least one column; we don't require exact header match - "valid": len(mapped_headers) > 0 and len(errors) == 0, + "valid": (len(mapped_headers) > 0 or wide_ok) and len(errors) == 0, "headers": { "found": csv_headers, "mapped": mapped_headers, @@ -1781,6 +1783,7 @@ async def validate_csv_file( "total_errors": len(errors), "auto_mapping": { "suggestions": mapping_info["suggestions"], + "wide_format": wide_ok, }, }