4

I have been working to finalize import of approximately 2,000 contact records from our old systems. Our old db had 2 people in one record, so have been working to separate. Imported the primary contact and was using import on the second contact and utilize the "master address belongs to" field. My 2 smaller groups of the second contact worked just fine and properly "mapped" and saved the master addressee belongs to. Yesterday I was importing my last batch of about 600 names. The import took longer than normal but eventually I just went to a screen saying there was a web server error. About 94 of the last records didn't get imported. As I was working on some cleanup I realized that when I would manually go edit someone's address and tie it to a master address nothing would save. I was able to take one contact, put in an address, save, and then edit again and tie the master address. However, I haven't been able to replicate that again. I ran the system job to clean cache and that didn't help. I was on 4.6.5 and decided to go ahead and do my upgrade yesterday to see if that might clear up whatever, and it didn't. The crash of the import seems to be the point where something changed. Has anyone experienced this or recommend anything (even at the table level in phpMyAdmin -- which I am comfortable navigating in) that I can check/try?

  • I just tried something that may be indicating why an update isn't saving. If I just go to a contact and click the Edit Address button in the address area, Civi lets me select another user but nothing saves (i.e.,the address comes back to the one already entered and isn't linked). I found another similar post and he stated that he if went to the full edit instead he got some resolution. I tried that with 2 contacts and in both cases when entering different contacts (that have an address on their record), Civi threw "Please select valid shared contact or a contact with valid address" when saving – Drew Aug 9 '15 at 12:38
  • not sure if this will help but - can you visit civicrm/admin/setting/debug?reset=1 and turn on debugging and backtrace. And yes try using the full 'Edit' process. Also note if you get pop ups and do not see any useful errors, rather than just clicking on the button that triggers the pop up, try right clicking and opening in a new page, since that is more likely to show you any errors. – petednz - fuzion Aug 10 '15 at 20:50
  • Thank you for replying. I hadn't thought to turn on the debugging/backtrace but did and nothing posted. I was able to edit a couple both with the direct Edit button and the Edit Address and a couple "took" and a couple didn't but saved the address and didn't link. I also got a couple where I selected a master contact from the dropdown list but when I tried to save Civi told me I had to select a valid contact (and I know it is a valid contact as she was also a master address owner for another contact that saved fine). Since we have just imported data I'm about tempted since it worked before my – user966 Aug 11 '15 at 12:31
  • I tried to import a "Master Address belongs to" using d46.demo.civicrm.org and it will not import. Unless somebody can share the steps to get this to work on the demo site, we should consider this feature broken and report a bug. – Link Swanson Aug 28 '15 at 15:56
  • hmm - i tried importing a Master Address too and got nowhere. Would you be willing to open a JIRA ticket, spell out steps to replicate. and then perhaps post the jira as an answer here – petednz - fuzion Sep 3 '15 at 22:19
1

I'm not sure this is the answer Drew is looking for or it even addresses his issue. It sounds like it was working for him and then he had a timeout and it messed a number of them up. The comments, which I added too many to, show that it doesn't work in some cases.

To import contact with a master address belonging to someone else, you need to include the actual address along with the address belongs to. It is looking for the ID of master address. How one might know that without sql is beyond me. Whenever I've imported people with shared addresses, I've imported all the people each with an address and then wrote some sql to pull out the address id of those that would be the master and id of the contact that would use that address and id and did an import update.

I just imported a Joe Blow into Demo46 having him share an address id 3. My cvs had first, last, street, city, state, postal, country and master address belongs to.

I'm guessing way back when for ease of implimenting shared addresses it appears it was decided not to quite do them as relational database should. You'd expect the id to be there and for the forms, queries, etc. to follow that id for the address, but it appears it depends on the address actually being in the record. I suspect the contact form sees that and does a copy when you share an address or the master gets changed.

So Drew you might look at your database and see if you have records in civicrm_address that have a master address id but the street, city, etc. are blank. If so this sql should fix it. (A caution, I wrote this sql a while ago but it think it's still fine. In case your wondering why it is ca and pa, I was dealing parents and children.)

update civicrm_address ca,
       civicrm_address pa
set    ca.street_address = pa.street_address,
       ca.city = pa.city,
       ca.state_province_id = pa.state_province_id,
       ca.postal_code = pa.postal_code,
       ca.postal_code_suffix = pa.postal_code_suffix,
       ca.country_id = pa.country_id
where  ca.master_id = pa.id
and    ca.master_id is not null
and    ca.street_address is null

If you don't have the master_id populated but you do have the two people both having the address, you could write some sql to add the address id of the first to be the master_id of the second.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.