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) »
  • Billing address and "emloyee of" relationship
Pages: [1]

Author Topic: Billing address and "emloyee of" relationship  (Read 333 times)

alainb

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4.4.x
  • CMS version: Drupal
  • MySQL version: 5.x
  • PHP version: 5.x
Billing address and "emloyee of" relationship
March 31, 2014, 05:09:59 am
When you add an address of type "Billing" to a person and use an address of an existing organization, a relationship of type "employee of" is automatically created.

Can this functionality be turned off?

In our case, people whose invoices are paid by another organization are not necessarily working for that organization.

Thanks

Regards,
Alain
Civi version: 4.4.4
« Last Edit: March 31, 2014, 06:52:33 am by alainb »

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Billing address and "emloyee of" relationship
March 31, 2014, 08:05:06 am
There's (currently) no option to turn it off, but I encountered this problem last week and had to patch my code to fix it (it was screwing up my imports).

In CRM/Core/BAO/Address.php, line 1025, change it to "if (1 == 1) {".

So it should look like:
static function processSharedAddressRelationship($masterAddressId, $params) {
    if (1 == 1) {
      return;
    }


Note I'm using 4.4.3 on this site, so make sure the line # hasn't changed!  If you need this on an ongoing basis, ideally you a) make a PHP override instead of hacking core, b) better yet, make that override an extension, or c) best yet, code in an option for it!  If you want to take c), CRM-14193 (https://github.com/civicrm/civicrm-core/pull/2520/files) has a good example of how to add options.
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

alainb

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4.4.x
  • CMS version: Drupal
  • MySQL version: 5.x
  • PHP version: 5.x
Re: Billing address and "emloyee of" relationship
March 31, 2014, 09:02:30 am
Thanks for your reply, Jon. Changing processSharedAddressRelationship does the trick.

Additionally to the hack you suggested, I also changed CRM/Contact/BAO/Contact/Utils.php. I commented out the line where CRM_Contact_BAO_Relationship::setIsActive is called.

These changes have to do with the way CiviCRM handles "employee of" relationships behind the scenes.
If you have more complex relationships between persons and organizations (e.g. multiple active employer/employee relationships, multiple addresses linked to organizations that have nothing to do with employer/employee...), then automatic creation/activation/deactivation of relationships is not desirable.

Would an option "handle 'employee of'-relationships manually" be useful for a future version of CiviCRM?


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Billing address and "emloyee of" relationship

This forum was archived on 2017-11-26.