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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Post hook not fired when new org created via current_employer field
Pages: [1]

Author Topic: Post hook not fired when new org created via current_employer field  (Read 748 times)

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Post hook not fired when new org created via current_employer field
November 29, 2011, 08:16:34 am
Hi,

In 4.0.6, I found that the civicrm_post hook is not fired when a new organization is created via the current_employer field of the main contact create form. Should it be?

The code path seems to be:

CRM_Contact_Form_Contact::postProcess()
- postProcess() calls CRM_Contact_BAO_Contact::create() with $invokeHooks = false
    - create() calls CRM_Contact_BAO_Contact::add()
        - add() calls CRM_Contact_BAO_Contact_Utils::createCurrentEmployerRelationship()
            - createCurrentEmployerRelationship() calls CRM_Contact_BAO_Contact::add for current_employer (add() doesn't fire hooks)
- postProcess() then fires post hook for main contact created.

Dave J
« Last Edit: November 29, 2011, 08:23:32 am by davej »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Post hook not fired when new org created via current_employer field
November 29, 2011, 12:36:00 pm
I have a feeling I may have patched this in trunk.
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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Post hook not fired when new org created via current_employer field

This forum was archived on 2017-11-26.