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) »
  • Households then Individuals with Individual set to use Household Address
Pages: [1]

Author Topic: Households then Individuals with Individual set to use Household Address  (Read 1553 times)

chris.marston@gmail.com

  • Guest
Households then Individuals with Individual set to use Household Address
March 01, 2009, 05:01:19 pm
I've successfully followed the advice about importing households and then individuals as members of the household and the relationship "is a member of household" works just fine.

However, I want the individual contacts set to use the household address. There's a checkbox for this, but even when I check it after importing, I have to search households to select the one I want to use, it doesn't even default to the household to which the member is related.

Is there a way to check this box and set it to relate to the household of which it's a member on import? Or perhaps some other way to at least conveniently set it after import.

Thanks for any suggestions.

Shailesh Lende

  • Guest
Re: Households then Individuals with Individual set to use Household Address
March 13, 2009, 12:43:13 am
Hi,

Currently CiviCRM does not support this but by custom coding you can achieve this.
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: [Select]
                           //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 );
                                }
                            }

Shailesh

questions

  • Guest
Re: Households then Individuals with Individual set to use Household Address
November 14, 2010, 12:25:01 pm
I went to try use this code but alas I'm not sure my line 745 matches Shailesh's.  So I wonder if I have the same version, 3.2, or if there are just extra lines at the beginning of mine.  I'm guessing the code should be added either before line 742 or after 747 in the following.   Or maybe it's part of the if block and should go after 746.

742                    //Relation on the basis of External Identifier.
743                    if ( !CRM_Utils_Array::value( 'id' , $params[$key] ) && !empty( $params[$key]['external_identifier'] ) ) {
744                        $params[$key]['id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
745                                                                          $params[$key]['external_identifier'],'id',
746                                                                          'external_identifier' );
747                    }                   
748                    // check for valid related contact id in update/fill mode, CRM-4424

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Households then Individuals with Individual set to use Household Address

This forum was archived on 2017-11-26.