Schedule Reminder re: event generates fatal mysql error
I have a schedule reminder set up for an event. The reminder is set up to send on a specific date, and then repeat every 14 days until 2 weeks prior to the event start date.
Here's the log entry when the scheduled job gets triggered:
Jan 04 14:54:26 [info] $Fatal Error Details = Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => exceptionHandler
)
[code] => -2
[message] => DB Error: syntax error
[mode] => 16
[debug_info] =>
SELECT e.contact_id as contact_id, e.id as entity_id, "civicrm_participant" as entity_table, 30 as action_schedule_id, MAX(reminder.action_date_time) as latest_log_time FROM civicrm_participant e INNER JOIN civicrm_event r ON e.event_id = r.id INNER JOIN civicrm_contact c ON c.id = e.contact_id AND c.is_deleted = 0 AND c.is_deceased = 0 INNER JOIN civicrm_action_log reminder ON reminder.contact_id = e.contact_id AND reminder.entity_id = e.id AND reminder.entity_table = 'civicrm_participant' AND reminder.action_schedule_id = 30 WHERE (r.id IN ("38")) AND (r.is_active = 1) AND (r.is_template = 0) AND (e.status_id IN (5)) AND ("20190104145426" <= DATE_SUB(, INTERVAL 2 week)) GROUP BY reminder.contact_id, reminder.entity_id, reminder.entity_table HAVING (TIMESTAMPDIFF(HOUR, latest_log_time, CAST(20190104145426 AS datetime)) >= TIMESTAMPDIFF(HOUR, latest_log_time, DATE_ADD(latest_log_time, INTERVAL 1 MONTH)))
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' INTERVAL 2 week))
GROUP BY reminder.contact_id, reminder.entity_id, reminder.en' at line 9]
[type] => DB_Error
[user_info] => SELECT e.contact_id as contact_id, e.id as entity_id, "civicrm_participant" as entity_table, 30 as action_schedule_id, MAX(reminder.action_date_time) as latest_log_time FROM civicrm_participant e INNER JOIN civicrm_event r ON e.event_id = r.id INNER JOIN civicrm_contact c ON c.id = e.contact_id AND c.is_deleted = 0 AND c.is_deceased = 0 INNER JOIN civicrm_action_log reminder ON reminder.contact_id = e.contact_id AND reminder.entity_id = e.id AND reminder.entity_table = 'civicrm_participant' AND reminder.action_schedule_id = 30 WHERE (r.id IN ("38")) AND (r.is_active = 1) AND (r.is_template = 0) AND (e.status_id IN (5)) AND ("20190104145426" <= DATE_SUB(, INTERVAL 2 week)) GROUP BY reminder.contact_id, reminder.entity_id, reminder.entity_table HAVING (TIMESTAMPDIFF(HOUR, latest_log_time, CAST(20190104145426 AS datetime)) >= TIMESTAMPDIFF(HOUR, latest_log_time, DATE_ADD(latest_log_time, INTERVAL 1 MONTH)))
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' INTERVAL 2 week))
GROUP BY reminder.contact_id, reminder.entity_id, reminder.en' at line 9]
[to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT e.contact_id as contact_id, e.id as entity_id, "civicrm_participant" as entity_table, 30 as action_schedule_id, MAX(reminder.action_date_time) as latest_log_time FROM civicrm_participant e INNER JOIN civicrm_event r ON e.event_id = r.id INNER JOIN civicrm_contact c ON c.id = e.contact_id AND c.is_deleted = 0 AND c.is_deceased = 0 INNER JOIN civicrm_action_log reminder ON reminder.contact_id = e.contact_id AND reminder.entity_id = e.id AND reminder.entity_table = 'civicrm_participant' AND reminder.action_schedule_id = 30 WHERE (r.id IN ("38")) AND (r.is_active = 1) AND (r.is_template = 0) AND (e.status_id IN (5)) AND ("20190104145426" <= DATE_SUB(, INTERVAL 2 week)) GROUP BY reminder.contact_id, reminder.entity_id, reminder.entity_table HAVING (TIMESTAMPDIFF(HOUR, latest_log_time, CAST(20190104145426 AS datetime)) >= TIMESTAMPDIFF(HOUR, latest_log_time, DATE_ADD(latest_log_time, INTERVAL 1 MONTH)))
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' INTERVAL 2 week))
GROUP BY reminder.contact_id, reminder.entity_id, reminder.en' at line 9]"]
)