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) »
  • is_current_revision updated before civicrm_pre hook on activity update
Pages: [1]

Author Topic: is_current_revision updated before civicrm_pre hook on activity update  (Read 403 times)

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
is_current_revision updated before civicrm_pre hook on activity update
March 23, 2014, 11:09:22 am
I'm trying to use the civicrm_pre hook to automatically launch another activity when a certain action is performed on one activity. The problem I am having is that it seems as though the following query:

Code: [Select]
UPDATE  civicrm_activity  SET is_current_revision = 0   WHERE (  civicrm_activity.id = 94 )
is executed immediately before the civicrm_pre hook is called. This means that when I start looking in the database, there is no current revision of the activity.

Is this a bug?

The activity is related to a case. I'm trying to update it from Scheduled to Completed. I see something in:

/civicrm/api/v3/Activity.php:112

that talks about setting is_current_revision = 0, but why before the pre hook?
« Last Edit: March 23, 2014, 11:19:08 am by bpmccain »

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: is_current_revision updated before civicrm_pre hook on activity update
March 24, 2014, 01:00:21 am
It does not make sense to me either, it would make more sense to call the pre hook before the update
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Re: is_current_revision updated before civicrm_pre hook on activity update
March 25, 2014, 08:54:38 am
Alright. I'll have to do some digging and learn how the hook is actually called so I can determine why this is happening.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • is_current_revision updated before civicrm_pre hook on activity update

This forum was archived on 2017-11-26.