From: Sean Madsen Date: Thu, 9 Nov 2017 16:02:32 +0000 (-0500) Subject: CRM-21419 Radio options create separate activities X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a850c3fe24f72515c1aee71965a62a1dc3ac0e80;p=civicrm-core.git CRM-21419 Radio options create separate activities Instead of a checkbox for the user to choose to create separate activities for each contact, use a set of radio options in order to prompt the user to make a decision. This helps prevent users from accidentally choosing to create combined activities. --- diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 9cdfd4a74a..58d7eadff2 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -704,7 +704,14 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { // this option should be available only during add mode if ($this->_action != CRM_Core_Action::UPDATE) { - $this->add('advcheckbox', 'is_multi_activity', ts('Create a separate activity for each contact.')); + $this->addRadio( + 'separation', + ts('Activity Separation'), + array( + 'separate' => ts('Create separate activities for each contact'), + 'combined' => ts('Create one activity with all contacts together'), + ) + ); } $this->addRule('duration', @@ -832,6 +839,12 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { if ((!empty($fields['followup_activity_subject']) || !empty($fields['followup_date'])) && empty($fields['followup_activity_type_id'])) { $errors['followup_activity_subject'] = ts('Follow-up Activity type is a required field.'); } + $actionIsAdd = $self->_action == CRM_Core_Action::ADD; + $hasMultipleTargetContacts = !empty($fields['target_contact_id']) && strpos($fields['target_contact_id'], ',') !== FALSE; + $separationFieldIsEmpty = empty($fields['separation']); + if ($actionIsAdd && $hasMultipleTargetContacts && $separationFieldIsEmpty) { + $errors['separation'] = ts('Activity Separation is a required field.'); + } return $errors; } @@ -916,6 +929,8 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $this->_activityId ); + $params['is_multi_activity'] = CRM_Utils_Array::value('separation', $params) == 'separate'; + $activity = array(); if (!empty($params['is_multi_activity']) && !CRM_Utils_Array::crmIsEmptyArray($params['target_contact_id']) diff --git a/templates/CRM/Activity/Form/Activity.hlp b/templates/CRM/Activity/Form/Activity.hlp index e0d5567235..25c4b7193f 100644 --- a/templates/CRM/Activity/Form/Activity.hlp +++ b/templates/CRM/Activity/Form/Activity.hlp @@ -23,11 +23,12 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{htxt id="id-is_multi_activity-title"} - {ts}Create Separate Activity Records?{/ts} +{htxt id="separation-title"} + {ts}Activity Separation{/ts} {/htxt} -{htxt id="id-is_multi_activity"} -

{ts}By default a single activity record will be created and linked to all the contacts listed above. However, if you think you might be editing the activity later - and entering different information for different contacts - check this box to create separate activity records.{/ts}

+{htxt id="separation"} +

{ts}With separate activities, you can enter different activity information for different contacts after creating the activities.{/ts}

+

{ts}With a single activity, the activity information cannot be customized for each contact.{/ts}

{/htxt} {htxt id="assignee_contact_id"} diff --git a/templates/CRM/Activity/Form/Activity.tpl b/templates/CRM/Activity/Form/Activity.tpl index 278475ca83..4365241d03 100644 --- a/templates/CRM/Activity/Form/Activity.tpl +++ b/templates/CRM/Activity/Form/Activity.tpl @@ -78,14 +78,16 @@ {$form.target_contact_id.label} {$form.target_contact_id.html} - {if $action eq 1 or $single eq false} -
- {$form.is_multi_activity.html} {$form.is_multi_activity.label} {help id="id-is_multi_activity"} -
- {/if} + {if $action eq 1 or $single eq false} + + {$form.separation.label} + {$form.separation.html} {help id="separation"} + + {/if} + {$form.assignee_contact_id.label}