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)