function upgrade_4_6_alpha3($rev) {
// task to process sql
- $this->addTask(ts('Adding column reference date and updating with '), 'updateReferenceDate');
+ $this->addTask(ts('Adding and updating column reference_date for Schedule Reminders'), 'updateReferenceDate');
}
// CRM-15728, Add new column reference_date to civicrm_action_log in order to track
// actual action_start_date for membership entity for only those schedule reminders which are not repeatable
static function updateReferenceDate(CRM_Queue_TaskContext $ctx) {
+ //Add column civicrm_action_log.reference_date
$query = "ALTER TABLE `civicrm_action_log`
ADD COLUMN `reference_date` date COMMENT 'Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)'";
CRM_Core_DAO::executeQuery($query);
+ //Retrieve schedule reminders for membership entity and is not repeatable
$query = "SELECT schedule.* FROM civicrm_action_schedule schedule
LEFT JOIN civicrm_action_mapping mapper ON mapper.id = schedule.mapping_id AND
- mapper.entity = 'civicrm_membership' AND is_repeat = 0";
+ mapper.entity = 'civicrm_membership' AND schedule.is_repeat = 0";
$dao = CRM_Core_DAO::executeQuery($query);
while($dao->fetch()) {
if (empty($dao->start_action_date)) {
$sql = "UPDATE civicrm_action_log reminder
LEFT JOIN civicrm_membership m ON reminder.entity_id = m.id
SET reminder.reference_date = {$referenceColumn}
-
WHERE " . implode(" AND ", $where);
CRM_Core_DAO::executeQuery($sql);
}