mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-09 13:48:23 +00:00
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:
@@ -22,10 +22,10 @@ class AddressReferenceBEFromBestAddress
|
||||
|
||||
public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher) {}
|
||||
|
||||
public function import(string $lang, array $lists): void
|
||||
public function import(string $lang, array $lists, ?string $sendAddressReportToEmail = null): void
|
||||
{
|
||||
foreach ($lists as $list) {
|
||||
$this->importList($lang, $list);
|
||||
$this->importList($lang, $list, $sendAddressReportToEmail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class AddressReferenceBEFromBestAddress
|
||||
return array_values($asset)[0]['browser_download_url'];
|
||||
}
|
||||
|
||||
private function importList(string $lang, string $list): void
|
||||
private function importList(string $lang, string $list, ?string $sendAddressReportToEmail = null): void
|
||||
{
|
||||
$downloadUrl = $this->getDownloadUrl($lang, $list);
|
||||
|
||||
@@ -85,7 +85,7 @@ class AddressReferenceBEFromBestAddress
|
||||
);
|
||||
}
|
||||
|
||||
$this->baseImporter->finalize();
|
||||
$this->baseImporter->finalize(sendAddressReportToEmail: $sendAddressReportToEmail);
|
||||
|
||||
$this->addressToReferenceMatcher->checkAddressesMatchingReferences();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user