From 1e63d0076742fed283dc9475ad4bddf7b8588370 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Wed, 16 Mar 2022 16:26:18 +0100 Subject: [PATCH 1/3] Fix pbm importing CP from France on 4 digits --- .../ChillMainBundle/Command/LoadPostalCodesCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index a3b1c1a26..5d577a0b4 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -118,6 +118,13 @@ class LoadPostalCodesCommand extends Command private function addPostalCode($row, OutputInterface $output) { + if($row[2] == 'FR' && strlen($row[0]) == 4) { + // CP in FRANCE are on 5 digit + // For CP starting with a zero, the starting zero can be remove if stored as number in a csv + // add a zero if CP from FR and on 4 digit + $row[0] = '0'.$row[0]; + } + if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { $output->writeln('handling row: ' . $row[0] . ' | ' . $row[1] . ' | ' . $row[2]); } From 2c02150b1a7e0d7f4c74e264bd0d445cad48f779 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Thu, 17 Mar 2022 18:29:16 +0100 Subject: [PATCH 2/3] Use CS Fixer --- src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index 5d577a0b4..b02d9c44a 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -118,7 +118,7 @@ class LoadPostalCodesCommand extends Command private function addPostalCode($row, OutputInterface $output) { - if($row[2] == 'FR' && strlen($row[0]) == 4) { + if ($row[2] == 'FR' && strlen($row[0]) == 4) { // CP in FRANCE are on 5 digit // For CP starting with a zero, the starting zero can be remove if stored as number in a csv // add a zero if CP from FR and on 4 digit From 288f0dbf691e644e84e592dba8baecd08429428e Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Wed, 16 Mar 2022 16:26:18 +0100 Subject: [PATCH 3/3] Fix pbm importing CP from France on 4 digits --- .../ChillMainBundle/Command/LoadPostalCodesCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php index a3b1c1a26..5d577a0b4 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php @@ -118,6 +118,13 @@ class LoadPostalCodesCommand extends Command private function addPostalCode($row, OutputInterface $output) { + if($row[2] == 'FR' && strlen($row[0]) == 4) { + // CP in FRANCE are on 5 digit + // For CP starting with a zero, the starting zero can be remove if stored as number in a csv + // add a zero if CP from FR and on 4 digit + $row[0] = '0'.$row[0]; + } + if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { $output->writeln('handling row: ' . $row[0] . ' | ' . $row[1] . ' | ' . $row[2]); }