diff --git a/src/Services/ImportExportSystem/ProjectBomExporter.php b/src/Services/ImportExportSystem/ProjectBomExporter.php index a5de0ec1..1c44ee87 100644 --- a/src/Services/ImportExportSystem/ProjectBomExporter.php +++ b/src/Services/ImportExportSystem/ProjectBomExporter.php @@ -134,9 +134,9 @@ final readonly class ProjectBomExporter ? $part->getDescription() : $entry->getComment(), - 'category' => $part?->getCategory()?->getFullPath() ?? '', + 'category' => $part?->getCategory()?->getName() ?? '', - 'footprint' => $part?->getFootprint()?->getFullPath() ?? '', + 'footprint' => $part?->getFootprint()?->getName() ?? '', 'manufacturer' => $part?->getManufacturer()?->getName() ?? '', @@ -185,15 +185,21 @@ final readonly class ProjectBomExporter return trim((string) $entry->getName()); } - $values = [$part->getName()]; + $partName = trim($part->getName()); + $entryName = trim((string) $entry->getName()); + + $values = [$partName]; /* - * The DataTable displays the optional BOM entry name beneath the - * linked part's name. Preserve that information with a separating - * space in CSV. + * The DataTable displays the optional BOM entry name beneath the linked + * part's name. Preserve that information in the CSV, but avoid exporting + * duplicate names. */ - if ($entry->getName() !== null && $entry->getName() !== '') { - $values[] = $entry->getName(); + if ( + $entryName !== '' + && $entryName !== $partName + ) { + $values[] = $entryName; } return implode(' ', $values); @@ -275,7 +281,7 @@ final readonly class ProjectBomExporter } $locations[$storageLocation->getID()] = - $storageLocation->getFullPath(); + $storageLocation->getName(); } return implode(', ', array_values($locations)); diff --git a/tests/Services/ImportExportSystem/ProjectBomExporterTest.php b/tests/Services/ImportExportSystem/ProjectBomExporterTest.php index 03acbd7d..2a64ffaa 100644 --- a/tests/Services/ImportExportSystem/ProjectBomExporterTest.php +++ b/tests/Services/ImportExportSystem/ProjectBomExporterTest.php @@ -281,7 +281,7 @@ final class ProjectBomExporterTest extends WebTestCase ); $this->assertSame('TEST-IPN-001', $row['IPN']); $this->assertSame('10k ohm resistor', $row['Description']); - $this->assertSame($category->getFullPath(), $row['Category']); + $this->assertSame($category->getName(), $row['Category']); $this->assertSame('', $row['Footprint']); $this->assertSame('', $row['Manufacturer']); $this->assertSame('', $row['Manufacturing status']);