Add email reporting for unimported addresses in import commands

Enhanced address import commands to optionally send a recap of unimported addresses via email. Updated import logic to handle cases where postal codes are missing, log issues, and generate compressed CSV reports with failed entries.
This commit is contained in:
2025-01-09 12:21:10 +01:00
parent 96bb98f854
commit ab311eaecb
9 changed files with 113 additions and 29 deletions

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Command;
use Chill\MainBundle\Service\Import\AddressReferenceLU;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class LoadAddressesLUFromBDAddressCommand extends Command
@@ -28,12 +29,16 @@ class LoadAddressesLUFromBDAddressCommand extends Command
protected function configure()
{
$this->setName('chill:main:address-ref-lux');
$this
->setName('chill:main:address-ref-lux')
->addOption('send-report-email', 's', InputOption::VALUE_REQUIRED, 'Email address where a list of unimported addresses can be send');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->addressImporter->import();
$this->addressImporter->import(
$input->hasOption('send-report-email') ? $input->getOption('send-report-email') : null,
);
return Command::SUCCESS;
}