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

Empty location data fails validation if "number of locations" > 2

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      CiviCRM tries to check that all locations for a contact are unique before saving details, but if two locations are empty and still have the same type (which is the default if you have number_locations > 2) then it will fail validation on save. This happens because the location type selector is present in the form (although not shown), and the additional location type selectors default to the same location type.

      Tested on both Sandbox and our copy of 2.0b1.

      To reproduce in sandbox.civicrm.org:

      1. Set "Number of locations" in Administer CiviCRM > Global Settings > Addresses > Address Editing to "3"

      2. Edit a contact's who has address details for only their Primary Address, leaving the two "Additional Locations" untouched.

      On save, CiviCRM will reject the save with the message "Two locations cannot have same location type". This is because both (empty) additional locations have their "type" selector set to the first location type in the select list (in sandbox, both will be empty "Billing" locations).

      A fix would be to check if any contact details are set for that location and ignoring any empty locations before checking that they are all different types.

        Attachments

          Activity

            People

            • Assignee:
              deepak Deepak Srivastava
              Reporter:
              xurizaemon Chris Burgess
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: