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) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Using Employees address as mailing address for Individual...
Pages: [1] 2 3

Author Topic: Using Employees address as mailing address for Individual...  (Read 19451 times)

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Using Employees address as mailing address for Individual...
November 10, 2008, 05:29:26 pm
Wondering if this is possible.
For example Joe Smith (Individual Record) works for Acme (Organization) and instead of entering the address for Joe Smith which is the same as his work address we just want to enter it once under that organization then check a box saying use that address when we go to edit his contact record. This seems to be available for households (see attached image).

If it is possible then I could use the existing code that is used for household to make it happen but I just want to check how far off this is? For example when they go to Individuals and create labels it will pull this address.

Thanks
« Last Edit: November 10, 2008, 05:33:35 pm by alfred_nutile »

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Using Employees address as mailing address for Individual...
November 10, 2008, 05:46:13 pm
I would find this behavior useful. There's already an issue for it, but the specs probably need filling out:
http://issues.civicrm.org/jira/browse/CRM-3338
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Re: Using Employees address as mailing address for Individual...
November 10, 2008, 05:49:58 pm
How would I find out if it is being worked on.
I would hate to try and make it happen (like I have time) only to find out it is almost done by someone else?
I tried the link you sent, but then there is just made it seem like it was roadmapped for 2.3

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Using Employees address as mailing address for Individual...
November 10, 2008, 07:07:21 pm
This feature is not currently being worked on by the core team - as it is currently not scheduled until the 2.3 release and we're working on 2.2 issues :-)
Protect your investment in CiviCRM by  becoming a Member!

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Using Employees address as mailing address for Individual...
November 23, 2008, 10:35:26 am
Hi there,

I need to implement similar functionality, and can't wait till 2.3.  This issue http://issues.civicrm.org/jira/browse/CRM-1917 has lots of useful details on the original "use household address" implementation for CiviCRM 1.8

CiviCRM 1.8 had three tables for contacts (one for organisations, one for households and one for individuals).  These tables are now merged, and that makes hacking this considerably easier than it would have been before because the mail_to_household_id is now a mail_to_contact_id field which can be used to assign an organisation address to an individual in the same way that you would assign a household address.  In fact in can be used to to refer/divert any mail addressed to any contact to any other contact so use with care!

I think I am write in assuming that all you need to do is alter the SQL that populates the Dojo autocomplete field.  This can be found in CRM_Core_Page_AJAX::Search().  You can pass GET parameters to do this from the following variable in CRM_Contact_Form_Individual::buildQuickForm()

Code: [Select]
        $dataURL =  CRM_Utils_System::url( 'civicrm/ajax/search',
                                                   "hh=1",
                                                   true, null, false );

Have a look at CRM_Core_Page_AJAX::Search() and change "hh=1" to something sensible.  I changed it to "org=1" (which in fact replicates the I'm not using households in this data model, so that works fine for me.  You could also replace it with null, which would then replicate the Contact search autocomplete.  Or you could make your own and post it here.

I've done limited testing and as far as I can tell, it pulls off the correct address when you make labels, etc.  You'll probably also want to change the templates etc., to reflect the new operation ("Use organisational address", etc.)

In an ideal world / when this is implemented in 2.3, it would be good to have a proper consideration of how this relates to the Current Employer box.  Maybe the following radio options would work: use custom address / use current employer address / use another contact's address.  And when you come to 3.0 it would be good to consider how Current employer relates to the relationship, "is employee of" ;))

PS. This is only my second hack to the core so I might not understand the ramifications - use at your own risk!

Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Using Employees address as mailing address for Individual...
December 09, 2008, 08:11:13 am
Hi,

Not sure I understand. On the use the household address, is it a shared (same data) or simply a copy at one point ?

Ie. if you modify at a later stage the address of the household, does it modify automatically the address on the individual too or are they going to drift apart .

and the question being: is this use_employer_address feature already working ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Using Employees address as mailing address for Individual...
December 09, 2008, 10:46:37 am
The way Use Household Address works is:
* The individual's civicrm_contact.mail_to_household_id is populated w/ contact ID of the household.
* A "read-only" copy of the household's civicrm_address record is created and linked to the individual's contact record
* Whenever the linked (primary) household address is edited, the "linked" individual address record is also updated automatically

The "use employer address" issue is currently scheduled for 2.3.
Protect your investment in CiviCRM by  becoming a Member!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Using Employees address as mailing address for Individual...
December 10, 2008, 03:44:26 am
What's the benefit of copying vs. using the same address id in the two civicrm_loc_block ?

Ok, I tried to hack the use_household_address, not a big issue to get the right ajax calls and so on, but then it creates extra household members informations and all that jazz, and I gave up until the 2.3 for now.

On the use_employer_address, suggestion: directly set the address and set it to true when choosing the employee. That's better to have the business address than none anyway ;)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Using Employees address as mailing address for Individual...
December 10, 2008, 04:26:50 am
Hi Xavier,

I had noticed that extra household relationship creation, and was about to post on that but you beat me to it.  Am going to hack around that as well and will post my solution here.  Did you say you had noticed another problems with my solution as well?  Can you elaborate on all that jazz?!

I think the benefit of copying is when you come to produce mailing labels you won't have to join the tables.

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Using Employees address as mailing address for Individual...
December 11, 2008, 01:40:43 pm
Quote from: xavier on December 10, 2008, 03:44:26 am
On the use_employer_address, suggestion: directly set the address and set it to true when choosing the employee. That's better to have the business address than none anyway ;)

Xavier - not sure I understand the above. Perhaps you can detail out the workflow a bit more as a comment on the 2.3 issue.
Protect your investment in CiviCRM by  becoming a Member!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Using Employees address as mailing address for Individual...
December 12, 2008, 02:09:57 am
use case:

I add Dave Greenberg as a contact

First Name:dave
last name: greenberg
current employee: civicrm (it's autocompleted, as the company is already in the db)

The "work" address is automatically checked "use company address" and checked as the default location

Still a bit confused about the civicrm_loc_block and address and the relations, but couldn't the same address being shared between two (or more) contacts instead of doing a read only copy ?

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Using Employees address as mailing address for Individual...
December 12, 2008, 02:13:39 am
To be honest, the ideal use case would be:

I add Dave Greenberg as a contact

First Name:dave
last name: greenberg
email: dave.greenberg@civicrm.org

The current employee civicrm ltd is automatically selected because the organisation is defined as using the domain civicrm.org for their employees (new field in the organisation contact)

The "work" address is automatically checked "use company address" and checked as the default location

All of that from the 3 fields in the quick add block to get an almost complete record (just have to add the phone...)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Using Employees address as mailing address for Individual...
December 13, 2008, 02:14:45 am
@michael,

No, not a lot more than the additional relationship, and I gave up short of trying to see if it still update the address properly even when you delete the relationship.


Have you been able to progress ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Using Employees address as mailing address for Individual...
May 06, 2009, 06:32:03 am
This just got moved to release 2.4 for a fix, so it will be awhile before we see this feature added.

Xavier and Michael - have any of your previous attempts worked?
--
Joe

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Using Employees address as mailing address for Individual...
May 06, 2009, 08:01:55 am
Nope.  But never say never :)  I'd really like to get this done before then and will try and have another look soon.

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1] 2 3
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Using Employees address as mailing address for Individual...

This forum was archived on 2017-11-26.