CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Import "uses household address"
Pages: 1 [2]

Author Topic: Import "uses household address"  (Read 2637 times)

questions

  • Guest
Re: Import "uses household address"
November 13, 2010, 03:32:47 pm
I'm new to CiviCRM and need to do this.  In searching the forums I can across a message (quoted below) that said to change the Contact.php script which seems pretty straight forward.  So my question is will this work for new imports?  When I went looking for line 745 it seems not to be the ideal place to stick the code which makes we wonder if they were talking about a different version or if there are a couple of lines at the top that change the line location.

The method talked about in this thread seems somewhat involved (plus being new to this I'm not really sure what files or what is getting changed here).   Can I just update the table directly with sql after the import?  It looks like I'd need to update mail_to_house_id with the household id in the individuals contact table record, but in reading this thread it sounds a bit like one needs to have the address also in the individual's record, which if true would mean that upon changing it for the HH it would also automatically change it for the individual.

Here is the code from the other thread.

If you are importing contacts of type Individual and also creating relationship "HouseHold Member of" by selecting HouseHold Member of -> Household Name at second step of import, by adding following code at
CRM/Import/Parser/Contact.php line No.745
Code:

                           //set shared household address if its having relationship member of household
                            if ( $this->_contactType == 'Individual' ) {
                                //get relationship type id of household member of
                                $householdRelTypeId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType',
                                                                                  'HouseHold Memmber of', 'id', 'name_a_b' );
                                $relTypeId = explode(  '_',  $key );

                                if (  $householdRelTypeId == $relTypeId[0] ) {
                                    CRM_Core_DAO::setFieldValue('CRM_Contact_DAO_Contact', $primaryContactId, 'mail_to_household_id', $relContactId );
                                }
                            }

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Import "uses household address"
November 13, 2010, 04:00:17 pm
Code: [Select]
which if true would mean that upon changing it for the HH it would also automatically change it for the individual.
YES - this is more or less the point of having an individual address linked to a household address - so if a family moves you don't have to update each of them. There are several ways this relationship can be broken when updating (e.g using a front end profile does).

From a DB point of view each entity have its own address line and that field links them
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Import "uses household address"

This forum was archived on 2017-11-26.