From 643d8f99be43ae85dc32f851c90de3db6fbd59f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Jul 2023 10:52:33 +0200 Subject: [PATCH] collate address: force the country to be the same when comparing postal codes --- .../CollateAddressWithReferenceOrPostalCode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php index 2a5dda3f7..17e3f5ce2 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php @@ -34,11 +34,11 @@ final readonly class CollateAddressWithReferenceOrPostalCode implements CollateA WHERE -- use only postal code which are reference cmpc_reference.id != cmpc.id AND cmpc_reference.origin = 0 - -- only where the reference is null or the cmpc is created manually - --AND cma.addressreference_id IS NULL + -- only where cmpc is created manually AND cmpc.origin != 0 -- only when postal code match AND TRIM(REPLACE(LOWER(cmpc.code), ' ', '')) = LOWER(cmpc_reference.code) + AND cmpc.country_id = cmpc_reference.country_id AND cma.id > :since_id -- to set the first id ) sq WHERE ranked = 1)