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) »
  • Need another field like employer
Pages: [1]

Author Topic: Need another field like employer  (Read 831 times)

2ways

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 7.15
  • MySQL version: 5.1.58
  • PHP version: 5.2.17
Need another field like employer
August 17, 2011, 05:53:09 am
Hi Folks,

My core constituents are affiliated with universities, but are not universally employed by universities, some are students or contractors, etc.

What I would like to be able to do is create a field like 'employer' that has pride of place in the create contact form, with the label 'university'.  The relationship would be something like 'affiliated with'.

I still want 'employer' as not all my contacts are university employees or even affiliated with universities.

I thought of doing a word replacement on 'employer', but then, I still want employer as a piece of data, just not the most important one.  That is, I want 'university' to be the one that, like 'employer' currently operates, automatically creates an organisation and a relationship when the form is submitted.  That will be the significant relationship for most of my contacts, so I would like it to be the easiest to enter.

Ultimately, I will have thousands of different universities as options, so neither tags nor a drop down list seems like the way to go.

Any suggestions would be most appreciated.

Thanks.


xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Need another field like employer
August 17, 2011, 06:23:58 am
I would use a custom field contact reference.

You will need to customize your install
- template/jquery to move that field when displaying/editing a contact to a more visible place
- hook to limit to universities on the autocomplete list
- probably a hook to create a new university if none if found (with the right contact subtype)

Nothing rocket science, but definitely some custom module and php coding

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

2ways

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 7.15
  • MySQL version: 5.1.58
  • PHP version: 5.2.17
Re: Need another field like employer
August 17, 2011, 07:09:16 am
Thanks, Xavier.

That sounds like a good way to go.  Not sure I'm up for it at this stage.  I'm a bit of a hack programmer.

I really appreciate the advice.

Cheers.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Need another field like employer
August 17, 2011, 08:06:27 am
The 4.1 release (currently in development for release late Q3 or Q4) will include improvements to the contact reference field which will allow you to limit what the field returns to a specific group of contacts (universities in your case). This will eliminate one piece of custom code - but you'll still need to implement a post process hook which checks for / creates the relationship.
Protect your investment in CiviCRM by  becoming a Member!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Need another field like employer
August 18, 2011, 12:29:45 am
In general this seems like quite a common requirement (including the ability to create relationships)
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

2ways

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 7.15
  • MySQL version: 5.1.58
  • PHP version: 5.2.17
Re: Need another field like employer
August 13, 2012, 06:47:54 pm
Hi Folks,

In the end, I went with a word replacement for "employer" as the way to solve my problem (above).

I just discovered, a year later, that the reason I can't get rid of the notices about 'undefined index' and 'undefined offset' when creating searches and groups is because of word replacements!

That is, any search that involves a criteria that is the subject of a word replacement, e.g. "university" to replace "employer", throws up the notices.

Yet another reason to build in the flexibility to select your own, or even multiple, criteria to function the way "employer" currently functions.

Anyway, I know this is an ancient thread, but I thought I would update the world on this little infelicity.

Cheers,
Lewis

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Need another field like employer
August 14, 2012, 03:33:55 pm
Lewis - If you can replicate the notices on our public demo (now running version 4.2) - with specific steps - then file an issue on the issue tracker. Might not be too big a deal to fix :-) Of course if you include a patch - that's even better.
Protect your investment in CiviCRM by  becoming a Member!

2ways

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 7.15
  • MySQL version: 5.1.58
  • PHP version: 5.2.17
Re: Need another field like employer
August 15, 2012, 06:31:56 am
Hi Dave,

Thanks for the reply.  I've now tried on the demo and can't get it to happen.

The same suggestion was made at this thread (http://forum.civicrm.org/index.php/topic,22136.0.html) as well, so I'll stop posting here and transfer the rest of this discussion over there.

Thanks again,
Lewis

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Need another field like employer

This forum was archived on 2017-11-26.