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) »
  • hook_civicrm_post Drupal 6.6, Civicrm 2.1.2 - objectName incorrect ?
Pages: [1]

Author Topic: hook_civicrm_post Drupal 6.6, Civicrm 2.1.2 - objectName incorrect ?  (Read 3609 times)

yasheshb

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
hook_civicrm_post Drupal 6.6, Civicrm 2.1.2 - objectName incorrect ?
November 25, 2008, 04:47:18 am
Hello,

  I'm using the hook_civicrm_post and am using it to implement db effects after a relationship is added/updated/deleted.
One thing i saw while debugging was the objectName is incorrect when a relationship is created.

function emp_relation_civicrm_post( $op, $objectName, $objectId, &$objectRef ) {
  Logger::debug_var("op        ", $op);
  Logger::debug_var("objectName", $objectName);
  Logger::debug_var("objectId  ", $objectId);
  Logger::debug_var("objectRef ", $objectRef);
}

The output shows me
Nov 25 17:29:46  [info] $op         = create
Nov 25 17:29:46  [info] $objectName = Contribution
Nov 25 17:29:46  [info] $objectId   = 4
Nov 25 17:29:46  [info] $objectRef  = CRM_Contact_BAO_Relationship Object

Is this a bug or something i'm missing in it's usage.

Thanks.

Yashesh

yasheshb

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
Re: hook_civicrm_post Drupal 6.6, Civicrm 2.1.2 - objectName incorrect ?
November 25, 2008, 04:51:56 am
seems to be coming from /civicrm/CRM/Contact/BAO/Relationship.php - line no - 192

        if ( CRM_Utils_Array::value( 'relationship', $ids ) ) {
            CRM_Utils_Hook::post( 'edit', 'Relationship', $relationship->id, $relationship );
        } else {
            CRM_Utils_Hook::post( 'create', 'Contribution', $relationship->id, $relationship );
        }
       

yashesh


yasheshb

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 5
Re: hook_civicrm_post Drupal 6.6, Civicrm 2.1.2 - objectName incorrect ?
November 25, 2008, 04:58:46 am
verified it. it's indeed thru the above code and seems to be a bug (typo). need to just change 'Contribution' to 'Relationship' imho.

yashesh

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: hook_civicrm_post Drupal 6.6, Civicrm 2.1.2 - objectName incorrect ?
November 25, 2008, 07:42:32 am

fixed and will be part of 2.1.3

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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • hook_civicrm_post Drupal 6.6, Civicrm 2.1.2 - objectName incorrect ?

This forum was archived on 2017-11-26.