Open adixon opened 6 years ago
This is a a good point, and it's a little confusing that the tasks don't go away.
What one might change... each of the cleanup tasks has a function isActive()
that decides whether it should be presented. For the "Fill in missing values" steps, it currently just checks whether the field exists:
https://github.com/civicrm/org.civicrm.doctorwhen/blob/master/CRM/DoctorWhen/Cleanups/ActivityCreated.php https://github.com/civicrm/org.civicrm.doctorwhen/blob/master/CRM/DoctorWhen/Cleanups/ActivityModified.php https://github.com/civicrm/org.civicrm.doctorwhen/blob/master/CRM/DoctorWhen/Cleanups/CaseCreated.php https://github.com/civicrm/org.civicrm.doctorwhen/blob/master/CRM/DoctorWhen/Cleanups/CaseModified.php
It would also make sense to check whether there are any empty cells -- i.e. "if the new field exists, and if it has any NULL values, then display this option..."
If the entry is missing in the logtable the subqueries will return NULL so that the value is still NULL after it has been running.
It can be fixed for civicrm_activity by changing the update sql in ActivityModified.php to ... SET modified_date = (SELECT IFNULL(MAX(l.modified_date),civicrm_activity.activity_date_time) FROM civicrm_log l WHERE l.entity_table ="civicrm_activity" AND civicrm_activity.id = l.entity_id) ...
and for ActivityCreated.php to ... SET created_date = (SELECT IFNULL(MIN(l.modified_date),civicrm_activity.activity_date_time) FROM civicrm_log l WHERE l.entity_table ="civicrm_activity" AND civicrm_activity.id = l.entity_id) ...
Awesome little extension, thanks.
Via the web url, I'm seeing the "Fill in missing values" tasks still showing up, after running the tasks via drush cvapi and the a couple of times via the web url.
The civi log file shows the tasks having run e.g.
[info] Running task: CRM-20958 - Fill in missing values of "civicrm_activity.modified_date" using civicrm_log (55001 => 60000)
Any hints on debugging that?