Details
-
Type: Patch
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.2.8
-
Fix Version/s: 4.3.0
-
Component/s: Core CiviCRM
-
Labels:None
Description
Background:
My client noticed that activities were not being created for membership reminders, even though the emails were being sent. We traced this back to the fact that the value for civicrm_action_schedule.record_activity column was NULL for these scheduled reminders, even though these were membership reminders and the code should be forcing the civicrm_action_schedule.record_activity value to '1' for membership reminders (in
Admin/Form/ScheduleReminders.php, line 386).
We found that this forcing of the record_activity value was not behaving properly, because the code expects a mapping_id value of 4 for Membership-related reminders, but in this client's installation, the value was 8.
Core issue:
Why 8 instead of 4? Because of two conditions:
1. This MySQL server has an auto_increment_increment setting of "2" instead of the usual "1";
2. The SQL "insert" statements in sql/civicrm_data.mysql don't specify a value for the `id` column, and instead rely on the autoincrementer to "get it right."
Solution:
Since the code in Admin/Form/ScheduleReminders.php is expecting a hard-coded value of 4, the SQL "insert" statements should ensure the `id` column has a value of 4; otherwise, unpredictable results can occur.
I'm attaching a patch here but can initiate a pull-request if that's better (not sure what the common practice is at the moment).