Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-21502

When adding a new address to a contact, and switching location types at the same time, only one address is kept

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No
    • Overview:
      Secondary address fails to save, or original address deleted when changing location types and primary status at the same time as adding a new address.
    • How it works currently:
      Hide
      To replicate scenario 1:
      * Create a contact with 1 address, set location type to "main", save contact
      * Edit contact, set the location type of the original address to "home", add a new address and set the location type to "main", save
      Result: new address does not save

      To replicate scenario 2:
      * Create a contact with 1 address, set location type to "main", save contact
      * Edit contact, set the location type of the original address to "home", add a new address, set the location type to "main", and set the address as the Primary location, save
      Result: new address is saved, original address is deleted
      Show
      To replicate scenario 1: * Create a contact with 1 address, set location type to "main", save contact * Edit contact, set the location type of the original address to "home", add a new address and set the location type to "main", save Result: new address does not save To replicate scenario 2: * Create a contact with 1 address, set location type to "main", save contact * Edit contact, set the location type of the original address to "home", add a new address, set the location type to "main", and set the address as the Primary location, save Result: new address is saved, original address is deleted
    • How it should work:
      Hide
      To replicate scenario 1:
      * Create a contact with 1 address, set location type to "main", save contact
      * Edit contact, set the location type of the original address to "home", add a new address and set the location type to "main", save
      Result: new address and previous address should exist with the desired location types set

      To replicate scenario 2:
      * Create a contact with 1 address, set location type to "main", save contact
      * Edit contact, set the location type of the original address to "home", add a new address, set the location type to "main", and set the address as the Primary location, save
      Result: new address and previous address should exist with the desired location types set, and the correct address should be set as the primary address
      Show
      To replicate scenario 1: * Create a contact with 1 address, set location type to "main", save contact * Edit contact, set the location type of the original address to "home", add a new address and set the location type to "main", save Result: new address and previous address should exist with the desired location types set To replicate scenario 2: * Create a contact with 1 address, set location type to "main", save contact * Edit contact, set the location type of the original address to "home", add a new address, set the location type to "main", and set the address as the Primary location, save Result: new address and previous address should exist with the desired location types set, and the correct address should be set as the primary address
    • Acceptance Criteria:
      Can change address location types at the same time as addresses without data loss.

      Description

      There appears to be a bug causing addresses to get deleted or fail to add during save when attempting to add a second address that has the same location type as the original address: bug has been confirmed on the CiviCRM Demo site.

      The issue appears to me limited to instances where you want to change the Location Type of the original address to something else, while giving the new address the Location Type of the original address.

      There are 2 different scenarios that cause two different results:

      1. If you try to change only the location type, the original address is kept, and the new one is not saved

      2. If you try to change the location type, and set the new address as primary, the new address is kept, and the original deleted

      To replicate scenario 1:

      • Create a contact with 1 address, set location type to "main", save contact
      • Edit contact, set the location type of the original address to "home", add a new address and set the location type to "main", save

      Result: new address does not save

      To replicate scenario 2:

      • Create a contact with 1 address, set location type to "main", save contact
      • Edit contact, set the location type of the original address to "home", add a new address, set the location type to "main", and set the address as the Primary location, save

      Result: new address is saved, original address is deleted

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              freeform.steph Stephanie Gray
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: