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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Shared Addresses
Pages: [1]

Author Topic: Shared Addresses  (Read 822 times)

cdoctor

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Shared Addresses
December 01, 2011, 08:59:54 am
Is there a way to turn off the feature which makes an individual who has an address shared with a business automatically an employer of the business?

For example, if individuals are students at a college, they will share the same address as the main college mailing address.  However, they are not employed by the college.  Only the staff in the database would be employees of the college.  The same can be said of individuals living in assisted living communities.

Thanks

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Shared Addresses
December 01, 2011, 11:39:58 am

i dont think so :(

ideally it would be good to make that configurable. If u'd like to take a shot at doing so, ping us on IRC

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

david.a.king

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 3.4.5
  • CMS version: drupal 6.22
  • MySQL version: 5.2
  • PHP version: 5.3
Re: Shared Addresses
December 29, 2011, 07:52:57 am
I had the same issue, though my problem was that contacts with an "employee of" relationship would lose that relationship if an address was shared with another organization.

I did this by making a custom php template for Core/BAO/Address.php

in processSharedAddressRelationship (line 982 on my version) there's a bit that checks if the contact the relationship is being made with is an individual or organization and adjusts accordingly.

on 1016:

Code: [Select]
       if ( $sharedContactType == 'Organization' ) {

           require_once 'CRM/Contact/BAO/Contact/Utils.php';
           return CRM_Contact_BAO_Contact_Utils::createCurrentEmployerRelationship( $currentContactId, $sharedContactId );
 
} else {
             // get the relationship type id of "Household Member of"
           $relationshipType = 'Household Member of';

        }

so i changed this to

Code: [Select]
       if ( $sharedContactType == 'Organization' ) {

       return;
} else {

return;
        }

This shares the address but does not create any relationship - so if a relationship such as employer of is required, you have to do that separately.

Not up to making this hack more friendly i'm afraid!

cdoctor

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: Shared Addresses
January 02, 2012, 05:56:21 pm
David -

Thank you very much for sharing this!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Shared Addresses

This forum was archived on 2017-11-26.