diff --git a/.changes/unreleased/Fixed-20230714-130035.yaml b/.changes/unreleased/Fixed-20230714-130035.yaml new file mode 100644 index 000000000..c883fa59e --- /dev/null +++ b/.changes/unreleased/Fixed-20230714-130035.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: '[collate addresses] block collating addresses to another address reference + where the address reference is already the best match' +time: 2023-07-14T13:00:35.117940845+02:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php index 17e3f5ce2..4dc1947c1 100644 --- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php +++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/CollateAddressWithReferenceOrPostalCode.php @@ -62,9 +62,8 @@ final readonly class CollateAddressWithReferenceOrPostalCode implements CollateA JOIN chill_main_postal_code cmpc on cma.postcode_id = cmpc.id, chill_main_address_reference cmar JOIN chill_main_postal_code cmpc_reference ON cmar.postcode_id = cmpc_reference.id WHERE - cma.addressreference_id != cmar.id -- only if cmpc is a reference (must be matched before executing this query) - AND cma.postcode_id = cmar.postcode_id + cma.postcode_id = cmar.postcode_id -- join cmpc to cma AND SIMILARITY(LOWER(cma.street), LOWER(cmar.street)) > 0.6 AND LOWER(cma.streetnumber) = LOWER(cmar.streetnumber) -- only addresses which match the address reference - let the user decide if the reference has changed