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 »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Scheduled Reminders from Activities
Pages: [1]

Author Topic: Scheduled Reminders from Activities  (Read 1035 times)

jaymcgraw

  • I post occasionally
  • **
  • Posts: 106
  • Karma: 6
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7.12
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.11
Scheduled Reminders from Activities
May 02, 2012, 02:20:39 pm
Trying out scheduled reminders.

Two things I noticed:

  • It didn't work without hacking this line in CRM/CORE/BAO/ActionSchedule.php : $startDateClause[] = $operator. "({$now}, INTERVAL 1 DAY ) {$op} r.start_date"; I'll file an issue and patch on this.
  • I can set these up to trigger off "Scheduled" activities. However, what I'd like to see happen is that once the action is created, the activity status goes from "Scheduled" to "Completed". Has this workflow been considered?

jaymcgraw

  • I post occasionally
  • **
  • Posts: 106
  • Karma: 6
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7.12
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.11
Re: Scheduled Reminders from Activities
May 02, 2012, 02:28:01 pm
Filed issue with patch: http://issues.civicrm.org/jira/browse/CRM-10160

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: Scheduled Reminders from Activities
May 02, 2012, 06:19:11 pm

thanx for the patch on 1

The scheduled reminder framework has a few hooks that can be used to switch activity state

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

jaymcgraw

  • I post occasionally
  • **
  • Posts: 106
  • Karma: 6
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7.12
  • MySQL version: 5.0.92-community
  • PHP version: 5.2.11
Re: Scheduled Reminders from Activities
May 03, 2012, 07:45:17 am
I tried using the pre/post hooks on "ActionLog", but I'm not getting the info I expect.

What's odd (to me) is this: The hooks are called in CRM/BAO/ActionLog.php right before and after $actionLog->save() is called. If I dump $actionLog at that time, not much info (below). But yet the db table civicrm_action_log does have all of the info (specifically, the entity_id and entity_table, which is what I would need here). So how is the save() method writing information to the db when it's not handed that information?

Code: [Select]
(Object) CRM_Core_DAO_ActionLog
id (String, 2 characters ) 14
contact_id (NULL)
entity_id (NULL)
entity_table (NULL)
action_schedule_id (NULL)
action_date_time (String, 14 characters ) 20120503093809
is_error (Integer) 0
message (String, 4 characters ) null
repetition_number (NULL)
_DB_DataObject_version (String, 6 characters ) 1.8.12
__table (String, 18 characters ) civicrm_action_log
N (Integer) 0
_database_dsn (String, 0 characters )
_database_dsn_md5 (String, 32 characters ) d2b5c81ea8c5d3785e52dcb4ff1c7c57
_database (String, 8 characters ) mima_civ
_query (Array, 7 elements)
condition (String, 0 characters )
group_by (String, 0 characters )
order_by (String, 0 characters )
having (String, 0 characters )
limit_start (String, 0 characters )
limit_count (String, 0 characters )
data_select (String, 1 characters ) *
_DB_resultid (NULL)
_resultFields (Boolean) FALSE
_link_loaded (Boolean) FALSE
_join (String, 0 characters )
_lastError (Boolean) FALSE
Krumo version 0.2a | http://krumo.sourceforge.net Called from /home/mima/public_html/sites/all/modules/civicrm/CRM/Core/BAO/ActionLog.php, line 75 

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: Scheduled Reminders from Activities
May 03, 2012, 09:54:15 am

is it just updating the action log record with the data it wants to modify?

if so, your hook, might want to fetch the actionLog record and then do whats needed

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

grgrygary

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Joomla 1.7.2
  • MySQL version: 1
  • PHP version: 1
Re: Scheduled Reminders from Activities
May 27, 2012, 04:25:56 pm
Hi, I really hope you guys can help.

I read the posts above as I was having the same problem, I looked at your Patch and applied it. But the reminders are still not working and I am pulling my hair out. The error in the job log is:

Finished execution of Send Scheduled Reminders with result: Failure, Error message: DB Error: syntax error

The code I finished with after I applied the patch is below, I would be very very grateful if you could tell me where I have gone wrong, thanks you!

 $startDate = $operator .
                    "({$dateField}, INTERVAL {$actionSchedule->start_action_offset} {$actionSchedule->start_action_unit})";
                 $startDateClause[] = "'{$now}' >= {$date}";
 
                 $startDateClause[] = $operator. "({$now}, INTERVAL 1 DAY ) {$op} " . $actionSchedule->start_action_date;
                 $startDate= implode( ' AND ', $startDateClause );
             } else if ( $actionSchedule->absolute_date ) {
                 $startDate = "DATEDIFF(DATE('{$now}'),'{$actionSchedule->absolute_date}') = 0";
            }

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Scheduled Reminders from Activities

This forum was archived on 2017-11-26.