Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
71f55384
Unverified
Commit
71f55384
authored
4 years ago
by
Seamus Lee
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #17481 from eileenmcnaughton/email
[REF] Extract createFollowUpActivities
parents
cd191933
dee865af
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Contact/Form/Task/EmailTrait.php
+43
-28
43 additions, 28 deletions
CRM/Contact/Form/Task/EmailTrait.php
with
43 additions
and
28 deletions
CRM/Contact/Form/Task/EmailTrait.php
+
43
−
28
View file @
71f55384
...
...
@@ -431,35 +431,8 @@ trait CRM_Contact_Form_Task_EmailTrait {
$this
->
getVar
(
'_caseId'
)
);
$followupStatus
=
''
;
if
(
$sent
)
{
$followupActivity
=
NULL
;
if
(
!
empty
(
$formValues
[
'followup_activity_type_id'
]))
{
$params
[
'followup_activity_type_id'
]
=
$formValues
[
'followup_activity_type_id'
];
$params
[
'followup_activity_subject'
]
=
$formValues
[
'followup_activity_subject'
];
$params
[
'followup_date'
]
=
$formValues
[
'followup_date'
];
$params
[
'target_contact_id'
]
=
$this
->
_contactIds
;
$params
[
'followup_assignee_contact_id'
]
=
explode
(
','
,
$formValues
[
'followup_assignee_contact_id'
]);
$followupActivity
=
CRM_Activity_BAO_Activity
::
createFollowupActivity
(
$activityId
,
$params
);
$followupStatus
=
ts
(
'A followup activity has been scheduled.'
);
if
(
Civi
::
settings
()
->
get
(
'activity_assignee_notification'
))
{
if
(
$followupActivity
)
{
$mailToFollowupContacts
=
[];
$assignee
=
[
$followupActivity
->
id
];
$assigneeContacts
=
CRM_Activity_BAO_ActivityAssignment
::
getAssigneeNames
(
$assignee
,
TRUE
,
FALSE
);
foreach
(
$assigneeContacts
as
$values
)
{
$mailToFollowupContacts
[
$values
[
'email'
]]
=
$values
;
}
$sentFollowup
=
CRM_Activity_BAO_Activity
::
sendToAssignee
(
$followupActivity
,
$mailToFollowupContacts
);
if
(
$sentFollowup
)
{
$followupStatus
.
=
'<br />'
.
ts
(
'A copy of the follow-up activity has also been sent to follow-up assignee contacts(s).'
);
}
}
}
}
$followupStatus
=
$this
->
createFollowUpActivities
(
$formValues
,
$activityId
);
$count_success
=
count
(
$this
->
_toContactDetails
);
CRM_Core_Session
::
setStatus
(
ts
(
'One message was sent successfully. '
,
[
'plural'
=>
'%count messages were sent successfully. '
,
...
...
@@ -638,4 +611,46 @@ trait CRM_Contact_Form_Task_EmailTrait {
return
$subject
;
}
/**
* Create any follow up activities.
*
* @param array $formValues
* @param int $activityId
*
* @return string
*
* @throws \CRM_Core_Exception
*/
protected
function
createFollowUpActivities
(
$formValues
,
$activityId
):
string
{
$params
=
[];
$followupStatus
=
''
;
$followupActivity
=
NULL
;
if
(
!
empty
(
$formValues
[
'followup_activity_type_id'
]))
{
$params
[
'followup_activity_type_id'
]
=
$formValues
[
'followup_activity_type_id'
];
$params
[
'followup_activity_subject'
]
=
$formValues
[
'followup_activity_subject'
];
$params
[
'followup_date'
]
=
$formValues
[
'followup_date'
];
$params
[
'target_contact_id'
]
=
$this
->
_contactIds
;
$params
[
'followup_assignee_contact_id'
]
=
explode
(
','
,
$formValues
[
'followup_assignee_contact_id'
]);
$followupActivity
=
CRM_Activity_BAO_Activity
::
createFollowupActivity
(
$activityId
,
$params
);
$followupStatus
=
ts
(
'A followup activity has been scheduled.'
);
if
(
Civi
::
settings
()
->
get
(
'activity_assignee_notification'
))
{
if
(
$followupActivity
)
{
$mailToFollowupContacts
=
[];
$assignee
=
[
$followupActivity
->
id
];
$assigneeContacts
=
CRM_Activity_BAO_ActivityAssignment
::
getAssigneeNames
(
$assignee
,
TRUE
,
FALSE
);
foreach
(
$assigneeContacts
as
$values
)
{
$mailToFollowupContacts
[
$values
[
'email'
]]
=
$values
;
}
$sentFollowup
=
CRM_Activity_BAO_Activity
::
sendToAssignee
(
$followupActivity
,
$mailToFollowupContacts
);
if
(
$sentFollowup
)
{
$followupStatus
.
=
'<br />'
.
ts
(
'A copy of the follow-up activity has also been sent to follow-up assignee contacts(s).'
);
}
}
}
}
return
$followupStatus
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment