Details
Description
Summary
=======
Give users the ability to schedule a follow-up activity while they are adding or editing an activity record.
NOTE: This feature is desirable for both Case activities and "core" activities. However, depending on decisions about integrating the code for core and case activities - it may be available only for activities in a case in the 2.2 release.
Implementation
============
1. New fieldset added at the bottom of the Activity form. Fieldset should be collapsed by default. Legend / fieldset title = "Schedule Follow-up"
2. Fieldset has 2 fields contained in a sentence:
"Schedule Follow-up <$select_activity-type> in [ $interval ] <$interval_unit>."
- $select_activity_type is a jQuery autocomplete select which allows user to select any valid activity type for the given Case Type. This should be the same field / behavior as the "New Activity" field in View Case EXCEPT that we set a default activity type = activity type of currently viewed activity. (For "core" activities - the selection set for this field is ANY "core" activity type).
- $interval is a text field
- $interval_unit provides options: day(s), week(s), month(s), year(s) - default value is day(s).
3. Form Validation
- if an activity type is selected then interval is required, and interval_unit is required
- If interval is not empty, it must be an integer value and activity type and interval_unit are required
4. Post Process:
If "schedule follow-up" fields are present in params, after insert / update operation for the "main" activity:
- Retrieve civicrm_activity.id of newly inserted "main" activity record - this will be the parent_id for the follow-up
- Insert follow-up activity record with the following values:
- activity_type = the selected follow-up activity type
- parent_id = id of the "main" activity record
- status = "Scheduled"
- due_date = calculated from now() based on interval and interval_unit, set timestamp part to current time
- is_auto = 0
5. Provide link back to parent activity when viewing a follow-up activity
- Modify ActivityView to check if parent_id is NOT NULL
- If NOT NULL, assign $parentURL to template - this should be a link to view the "parent" activity. (ActivityView.tpl already has logic to display this link if it's got a value).
"Prompted by..."