Details
-
Type: Sub-task
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.4.0, 4.5
-
Fix Version/s: 4.6
-
Component/s: CiviMember, Core CiviCRM
-
Labels:None
-
Documentation Required?:User and Admin Doc
Description
Currently the only support for multiple term reminders for memberships is to use the 'Repeat' feature. However, this is only suitable for certain terms (and is non-intuitive for users). This issue adds support for multi-term generation of scheduled reminders based on changes in the 'reference date'.
(See this wiki page for use cases and additional background:
http://wiki.civicrm.org/confluence/display/CRMDOC/Towards+improvements+in+Scheduled+Reminders)
============
Implementation
============
1. Schema change
- new column: civicrm_action_log.reference_date DATE default NULL
- column description: "Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)"
2. Upgrades
2.1 alter table for upgrades to add reference_date column
2.2 Run query to upgrade existing action_log entries as follows:
- WHERE action_log.entity_table = "civicrm_membership" AND action_log.action_date_time later than 9 months ago
- UPDATE action_log.reference_date
- reference_date = lookup start_action_date for the action_schedule_id in that action_log entry and get the value from the entity_id
NOTE: For membership related reminders, action_schedule. start_action_date will either be 'membership_join_date' or 'membership_end_date'.
EXAMPLE: If action_schedule.start_action_date = 'membership_end_date', set action_log.reference_date = membership.end_date.
3. Action Schedule BAO modification
Currently if is_repeat is false, we exclude reminders for matching entities if there is already an action_log entry. Modify this logic to compare the entities action_start_date to the action_log.reference_date. If the dates are NOT the same, then entity is eligible for a new reminder.
4. Add a unit test to cover multi-term reminders on membership_end_date.
- send reminder / verify reference_date
- trigger reminder again / verify that NO reminder is set (since reference_date hasn't changed)
- renew membership (end_date is updated)
- trigger reminder again / verify that reminder is sent and new reference_date is stored in new action_log row