CiviCRM

Contact Primary location gets wiped out when using locations through a profile

Details

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

Description

Spent the last couple hours doing my best to narrow this bug down and report exactly what I think is going on.

Duplicated by..
1. Create two profiles that both load on the drupal user edit screen. One that pulls an individuals "home" address information and another that pulls an individuals "work" address information. (note: this does not work if you add all home and work address fields into 1 profile.. I actually set my system up that way to get around this bug)

2. Through the contact record edit page make sure the user has both home and work location information filled out and take note of which one is set to the users primary location

3. Go to the users drupal edit screen and edit the profile that holds the users "primary" location information.. I think it defaults to home. I checked which one was to to primary by checking the civicrm_address table and seeing what location has "is_primary" field set to 1. (note: It would be a good idea to take note of the changes going on in the db to get an idea of exactly what this bug is doing)

4. Now hit save on the profile that holds the primary location information. You'll notice all appears well and both home and work information is still there.

5. Now go to the profile edit screen for the drupal user that holds the information for the location that is not the primary location. Make some changes and hit save. You'll notice that the primary location information is now completely gone but the work information is still there. If you look at the contacts entries in the civicrm_address table you see there is now 2 entries of the same location type for the same contact.

It appears what is happening is when the profile for the non primary location is submitted the information for that location .. including its location type id is overwriting either all the other locations.. or maybe just the primary locations information. Leaving you with multiple locations entries of the same type for the same contact.

Activity

Hide
Kurund Jalmi added a comment -
fixed in rev 16481
Show
Kurund Jalmi added a comment - fixed in rev 16481
Hide
Mark Burdett added a comment -
I am hoping this can be backported to the 2.0 branch, as it also affects the location API and any drupal modules using it, such as ecivicrm.
Show
Mark Burdett added a comment - I am hoping this can be backported to the 2.0 branch, as it also affects the location API and any drupal modules using it, such as ecivicrm.
Hide
Anthony Neumann added a comment -
I agree. I posted this because of the flaw in a system I am maintaining and I'm would rather not upgrade to the fixed release until out of alpha. This seems like a serious enough issue to fix in the older branches that are affected considering in makes the information in the system unstable. Users were very confused when they were attempting to update their info and things kept getting cleared out or swapped.
Show
Anthony Neumann added a comment - I agree. I posted this because of the flaw in a system I am maintaining and I'm would rather not upgrade to the fixed release until out of alpha. This seems like a serious enough issue to fix in the older branches that are affected considering in makes the information in the system unstable. Users were very confused when they were attempting to update their info and things kept getting cleared out or swapped.
Hide
Kurund Jalmi added a comment -
- backporting to 2.0
Show
Kurund Jalmi added a comment - - backporting to 2.0
Hide
Kurund Jalmi added a comment -
- backported to 2.0 branch rev 16628.
Show
Kurund Jalmi added a comment - - backported to 2.0 branch rev 16628.
Hide
Anthony Neumann added a comment -
After applying the updates to 2.0 I still have the original issue.

The screenshots included in the zip highlight what problem I'm running into.

screen-capture-0.jpg
This displays the profile I am using that works correctly for saving both home and work information for a contact. This was the work around I created to get around this bug. This will save the information correctly to the database.

screen-capture-1.jpg
Displays the records in the database for the contact I am testing. You will notice that there are two different location types which are home and work.

note - Submitting the form from screen-capture.jpg does save the information correctly and results in the information in screen-capture-1.jpg

screen-capture-2.jpg
Displays the civicrm profile that contains home related location information. Notice this is the location set as primary in screen-capture-1.jpg. Submitting this form results in the following.

screen-capture-3.jpg
The work information is now wiped out and we have duplicated home locations both set to primary. I have another civicrm profile containing only the work related located information and when this form is submitted there are no problems at all.. the database stays the same as in screen-capture-1.jpg and all fields are saved correctly. This leads me to believe there is some conflict with the "primary" location settings.



Show
Anthony Neumann added a comment - After applying the updates to 2.0 I still have the original issue. The screenshots included in the zip highlight what problem I'm running into. screen-capture-0.jpg This displays the profile I am using that works correctly for saving both home and work information for a contact. This was the work around I created to get around this bug. This will save the information correctly to the database. screen-capture-1.jpg Displays the records in the database for the contact I am testing. You will notice that there are two different location types which are home and work. note - Submitting the form from screen-capture.jpg does save the information correctly and results in the information in screen-capture-1.jpg screen-capture-2.jpg Displays the civicrm profile that contains home related location information. Notice this is the location set as primary in screen-capture-1.jpg. Submitting this form results in the following. screen-capture-3.jpg The work information is now wiped out and we have duplicated home locations both set to primary. I have another civicrm profile containing only the work related located information and when this form is submitted there are no problems at all.. the database stays the same as in screen-capture-1.jpg and all fields are saved correctly. This leads me to believe there is some conflict with the "primary" location settings.
Hide
Kurund Jalmi added a comment -
Not able to replicate on my machine. Can you replicate this on http://drupal.demo.civicrm.org
Show
Kurund Jalmi added a comment - Not able to replicate on my machine. Can you replicate this on http://drupal.demo.civicrm.org
Hide
Anthony Neumann added a comment -
I could not recreate the issue on the demo server. Seemed to be working just fine. I tried to download the latest files from the svn for 2.0 but I was missing files from "CRM/Core/DOA"

The only file in that directory was factory.php so im not really sure how to get the latest 2.0 files. Any help on that would be great.. I'll update the files and test again.
Show
Anthony Neumann added a comment - I could not recreate the issue on the demo server. Seemed to be working just fine. I tried to download the latest files from the svn for 2.0 but I was missing files from "CRM/Core/DOA" The only file in that directory was factory.php so im not really sure how to get the latest 2.0 files. Any help on that would be great.. I'll update the files and test again.
Hide
Kurund Jalmi added a comment -
Anthony,

There was an minor bug, which is fixed in http://fisheye.civicrm.org/changelog/CiviCRM/?cs=16663. Let us know if this patch solves your problem.
Show
Kurund Jalmi added a comment - Anthony, There was an minor bug, which is fixed in http://fisheye.civicrm.org/changelog/CiviCRM/?cs=16663. Let us know if this patch solves your problem.
Hide
Anthony Neumann added a comment -
The fix you linked me to seemed to do the trick. Thanks for working through this with me!
Show
Anthony Neumann added a comment - The fix you linked me to seemed to do the trick. Thanks for working through this with me!
Hide
Anthony Neumann added a comment -
Not sure if this is related but I figured it was along the same lines. I can post a new bug report if needed but there still seems to be something strange going on with locations.

I attached 3 screenshots. You can see that Primary location has "another location" nested under it. Then if you expand "another location".. demographics is nested under that. From what I understand demographics should not be nested under location at all. Is this a known issue?
Show
Anthony Neumann added a comment - Not sure if this is related but I figured it was along the same lines. I can post a new bug report if needed but there still seems to be something strange going on with locations. I attached 3 screenshots. You can see that Primary location has "another location" nested under it. Then if you expand "another location".. demographics is nested under that. From what I understand demographics should not be nested under location at all. Is this a known issue?
Hide
Kurund Jalmi added a comment -
This is not related to this issue, seems to be some display problem, file a separate issue if you are able to replicate this on http://drupal.demo.civicrm.org/civicrm
Show
Kurund Jalmi added a comment - This is not related to this issue, seems to be some display problem, file a separate issue if you are able to replicate this on http://drupal.demo.civicrm.org/civicrm
Hide
Anthony Neumann added a comment -
Thanks. I did verify it on the demo install and it seems to be a bug. I created a new issue for this.
Show
Anthony Neumann added a comment - Thanks. I did verify it on the demo install and it seems to be a bug. I created a new issue for this.
Hide
Kiran Jagtap added a comment -
Tested and Confirmed at r18986
Show
Kiran Jagtap added a comment - Tested and Confirmed at r18986

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: