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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Modifying Employer Field in Create Individual Form to Staff + Notification
Pages: [1]

Author Topic: Modifying Employer Field in Create Individual Form to Staff + Notification  (Read 572 times)

darkchild

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 2
  • “…more than kisses, letters mingle souls…”- John D
  • CiviCRM version: 4.0.1
  • CMS version: joomla & drupal
  • MySQL version: 5.0.91
  • PHP version: 5.2.14
Modifying Employer Field in Create Individual Form to Staff + Notification
December 02, 2011, 04:43:24 am
Good morning.

I want to create a relationship between between  A New Client and Staff when creating a new contact. I am hoping to change the 'Current Employer' so that it pulls data from the list of contacts in the 'Staff' subtype of Individual. So essentially, create a staff/client relationship at the point when I am adding a new client.

Here is the code from the Individual.php file
Code: [Select]
       //Current Employer Element
        $employerDataURL =  CRM_Utils_System::url( 'civicrm/ajax/rest', 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=contact&org=1&employee_id='.$this->_contactId, false, null, false );
        $form->assign('employerDataURL',$employerDataURL );
       
        $form->addElement('text', 'current_employer', ts('Current Employer'), '' );
        $form->addElement('hidden', 'current_employer_id', '', array( 'id' => 'current_employer_id') );
        $form->addElement('text', 'contact_source', ts('Source'));

        $checkSimilar = defined( 'CIVICRM_CONTACT_AJAX_CHECK_SIMILAR' ) ? CIVICRM_CONTACT_AJAX_CHECK_SIMILAR : true;
        $form->assign('checkSimilar',$checkSimilar );

And here is the code from the individual.tpl file.
Code: [Select]
            {$form.current_caseworker.label}&nbsp;{help id="id-current-employer" file="CRM/Contact/Form/Contact.hlp"}<br />
            {$form.current_caseworker.html|crmReplace:class:twenty}
            <div id="employer_address" style="display:none;"></div>

Additionally, I'd want a notification to be sent to the staff member who now has relationship with the new Client.

Thanks in advance.
p.s. This may not be best way to achieve what I'm trying to do. If there are other better avenues, please kindly advise.

Specs: Joomla 1.7, Civicrm 4.7

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: Modifying Employer Field in Create Individual Form to Staff + Notification
December 02, 2011, 11:58:25 am

rather than hack core and modify the "current employer" stuff which makes certain assumption, i would encourage you to use hooks to implement this feature. You can then also add the "send email to staff" feature.

Another option might be to use custom data and store it as a contact reference field. You'll probably need to use a hook to limit the contact references to staff only and also for the "send email to staff" feature.

You'll need php and civicrm coding knowledge to do the above. If you do so, please share your changes so others can benefit.

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Modifying Employer Field in Create Individual Form to Staff + Notification

This forum was archived on 2017-11-26.