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) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • [SOLVED] Using the CiviCRM managed hook to create Scheduled Jobs
Pages: [1]

Author Topic: [SOLVED] Using the CiviCRM managed hook to create Scheduled Jobs  (Read 826 times)

Edsel Roque Lopez

  • I’m new here
  • *
  • Posts: 7
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: 7.10
  • MySQL version: 5
  • PHP version: 5.3.6
[SOLVED] Using the CiviCRM managed hook to create Scheduled Jobs
January 19, 2015, 11:47:06 pm
Hi,

I have used the managed hook to create Scheduled reminders (entity => action_schedule). The code can be found here: https://github.com/JMAConsulting/biz.jmaconsulting.emailsystem/blob/master/emailsystem.php#L235

The reminders are being created successfully on install and disabling/uninstalling the extension works fine as well. One thing I noticed though, while the extension is still active, if any of the reminders is disabled, cleaning the caches or rebuilding the menu tends to re-enable the reminder. I figured this was probably due to the code in the managed hook being executed again, so I commented it out after the extension was installed. This had no effect, the reminder was still being enabled automatically. I then checked the civicrm_managed table and set the cleanup column to 'never' (I'm assuming this value plays a role in cleaning up the entity values when the caches are flushed). This did not have any effect on the behaviour either. Could someone with experience on using the managed hook please guide me on what needs to be done here to prevent this from happening?

Thanks!
« Last Edit: January 21, 2015, 06:36:00 am by Edsel Roque Lopez »

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Using the CiviCRM managed hook to create Scheduled Jobs
January 20, 2015, 01:11:27 am
Off the top of my head, I *think* the value from the SQL column "cleanup" is only consulted when the record is orphaned (i.e. the corresponding module has been uninstalled). Have you tried declaring the option "update" => "never"?

http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_managed


Edsel Roque Lopez

  • I’m new here
  • *
  • Posts: 7
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: 7.10
  • MySQL version: 5
  • PHP version: 5.3.6
Re: Using the CiviCRM managed hook to create Scheduled Jobs
January 21, 2015, 06:34:24 am
Hey Tim,

Thanks! That worked! Dunno how I skipped that part of the documentation.  :)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • [SOLVED] Using the CiviCRM managed hook to create Scheduled Jobs

This forum was archived on 2017-11-26.