Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Cannot Reproduce
-
Affects Version/s: 4.5
-
Fix Version/s: 4.5.3
-
Component/s: None
-
Labels:None
-
Documentation Required?:None
Description
While working for schedule reminder I encountered some issues for mails scheduled either after joindate/startdate
- steps to replicate
In context to membership, I scheduled a reminder 4 day(s) after membership join date, mails are not being sent.
Below are the details for membership:
Membership Start Date as for eg 2/10/2014
Membership End Date as for eg 9/10/2014
On debugging I found that the query builtup is wrong
Query built up :
INSERT INTO civicrm_action_log (contact_id, entity_id, entity_table, action_schedule_id) SELECT e.contact_id as contact_id, e.id as entity_id, 'civicrm_membership' as entity_table, 5 as action_schedule_id FROM civicrm_membership e INNER JOIN civicrm_contact c ON c.id = e.contact_id AND c.is_deleted = 0 AND c.is_deceased = 0 LEFT JOIN civicrm_action_log reminder ON reminder.contact_id = e.contact_id AND reminder.entity_id = e.id AND reminder.entity_table = 'civicrm_membership' AND reminder.action_schedule_id = %1 WHERE e.contribution_recur_id IS NULL AND e.membership_type_id IN (4,5) AND ( e.is_override IS NULL OR e.is_override = 0 ) AND e.status_id IN (1,2,3,4) AND reminder.id IS NULL AND '20141007143947' >= DATE_ADD(e.join_date, INTERVAL 4 day) AND DATE_SUB(20141007143947, INTERVAL 1 DAY ) <= DATE_ADD(e.join_date, INTERVAL 4 day) AND e.contact_id NOT IN ( 205 )
This is what causing the issue
DATE_SUB(20141007143947, INTERVAL 1 DAY ) <= DATE_ADD(e.join_date, INTERVAL 4 day)
I have checked this issue in context to membership only, needs to verify whether it effects other components.
Note: Please truncate/flush civicrm_action_log before scheduling.