diff --git a/src/Services/ImportExportSystem/EntityExporter.php b/src/Services/ImportExportSystem/EntityExporter.php index 6c0cdd04..6786e8a1 100644 --- a/src/Services/ImportExportSystem/EntityExporter.php +++ b/src/Services/ImportExportSystem/EntityExporter.php @@ -92,7 +92,7 @@ class EntityExporter $options = $resolver->resolve($options); //Handle Excel formats by converting from CSV - if (in_array($options['format'], ['xlsx', 'xls'])) { + if (in_array($options['format'], ['xlsx', 'xls'], true)) { return $this->exportToExcel($entities, $options); } diff --git a/src/Services/ImportExportSystem/EntityImporter.php b/src/Services/ImportExportSystem/EntityImporter.php index a36dc2be..459866ba 100644 --- a/src/Services/ImportExportSystem/EntityImporter.php +++ b/src/Services/ImportExportSystem/EntityImporter.php @@ -346,7 +346,7 @@ class EntityImporter $this->configureOptions($resolver); $options = $resolver->resolve($options); - if (in_array($options['format'], ['xlsx', 'xls'])) { + if (in_array($options['format'], ['xlsx', 'xls'], true)) { $this->logger->info('Converting Excel file to CSV', [ 'filename' => $file->getFilename(), 'format' => $options['format'], diff --git a/src/Services/Parts/PartsTableActionHandler.php b/src/Services/Parts/PartsTableActionHandler.php index 616df229..bb8ab45f 100644 --- a/src/Services/Parts/PartsTableActionHandler.php +++ b/src/Services/Parts/PartsTableActionHandler.php @@ -30,13 +30,11 @@ use App\Entity\Parts\Manufacturer; use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\Part; use App\Entity\Parts\PartLot; -use App\Repository\PartRepository; use Doctrine\ORM\EntityManagerInterface; use InvalidArgumentException; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; -use Symfony\Contracts\Translation\TranslatableInterface; use function Symfony\Component\Translation\t; @@ -100,7 +98,7 @@ implode(',', array_map(static fn (PartLot $lot) => $lot->getID(), $part->getPart //When action starts with "export_" we have to redirect to the export controller $matches = []; - if (preg_match('/^export_(json|yaml|xml|csv)$/', $action, $matches)) { + if (preg_match('/^export_(json|yaml|xml|csv|xlsx)$/', $action, $matches)) { $ids = implode(',', array_map(static fn (Part $part) => $part->getID(), $selected_parts)); $level = match ($target_id) { 2 => 'extended', diff --git a/templates/components/datatables.macro.html.twig b/templates/components/datatables.macro.html.twig index 5ce0f23f..5e1747e3 100644 --- a/templates/components/datatables.macro.html.twig +++ b/templates/components/datatables.macro.html.twig @@ -72,6 +72,7 @@ + diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index e65445ce..1d3d4595 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -10906,6 +10906,12 @@ Element 1 -> Element 1.2]]> Export to XML + + + part_list.action.export_xlsx + Export to Excel + + parts.import.title