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
e56a41aa
Unverified
Commit
e56a41aa
authored
3 years ago
by
colemanw
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #21361 from eileenmcnaughton/deprecated_gone
Remove deprecated function
parents
88020c6c
cac0fcc6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Core/BAO/MessageTemplate.php
+0
-121
0 additions, 121 deletions
CRM/Core/BAO/MessageTemplate.php
with
0 additions
and
121 deletions
CRM/Core/BAO/MessageTemplate.php
+
0
−
121
View file @
e56a41aa
...
...
@@ -212,127 +212,6 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
return
$msgTpls
;
}
/**
* @param int $contactId
* @param $email
* @param int $messageTemplateID
* @param $from
*
* @return bool|NULL
* @throws \CRM_Core_Exception
*/
public
static
function
sendReminder
(
$contactId
,
$email
,
$messageTemplateID
,
$from
)
{
CRM_Core_Error
::
deprecatedWarning
(
'CRM_Core_BAO_MessageTemplate::sendReminder is deprecated and will be removed in a future version of CiviCRM'
);
$messageTemplates
=
new
CRM_Core_DAO_MessageTemplate
();
$messageTemplates
->
id
=
$messageTemplateID
;
$domain
=
CRM_Core_BAO_Domain
::
getDomain
();
$result
=
NULL
;
$hookTokens
=
[];
if
(
$messageTemplates
->
find
(
TRUE
))
{
$body_text
=
$messageTemplates
->
msg_text
;
$body_html
=
$messageTemplates
->
msg_html
;
$body_subject
=
$messageTemplates
->
msg_subject
;
if
(
!
$body_text
)
{
$body_text
=
CRM_Utils_String
::
htmlToText
(
$body_html
);
}
$params
=
[[
'contact_id'
,
'='
,
$contactId
,
0
,
0
]];
[
$contact
]
=
CRM_Contact_BAO_Query
::
apiQuery
(
$params
);
//CRM-4524
$contact
=
reset
(
$contact
);
if
(
!
$contact
||
is_a
(
$contact
,
'CRM_Core_Error'
))
{
return
NULL
;
}
//CRM-5734
// get tokens to be replaced
$tokens
=
array_merge
(
CRM_Utils_Token
::
getTokens
(
$body_text
),
CRM_Utils_Token
::
getTokens
(
$body_html
),
CRM_Utils_Token
::
getTokens
(
$body_subject
));
// get replacement text for these tokens
$returnProperties
=
[
"preferred_mail_format"
=>
1
];
if
(
isset
(
$tokens
[
'contact'
]))
{
foreach
(
$tokens
[
'contact'
]
as
$key
=>
$value
)
{
$returnProperties
[
$value
]
=
1
;
}
}
[
$details
]
=
CRM_Utils_Token
::
getTokenDetails
([
$contactId
],
$returnProperties
,
NULL
,
NULL
,
FALSE
,
$tokens
,
'CRM_Core_BAO_MessageTemplate'
);
$contact
=
reset
(
$details
);
// call token hook
$hookTokens
=
[];
CRM_Utils_Hook
::
tokens
(
$hookTokens
);
$categories
=
array_keys
(
$hookTokens
);
// do replacements in text and html body
$type
=
[
'html'
,
'text'
];
foreach
(
$type
as
$key
=>
$value
)
{
$bodyType
=
"body_
{
$value
}
"
;
if
(
$$bodyType
)
{
CRM_Utils_Token
::
replaceGreetingTokens
(
$$bodyType
,
NULL
,
$contact
[
'contact_id'
]);
$$bodyType
=
CRM_Utils_Token
::
replaceDomainTokens
(
$$bodyType
,
$domain
,
TRUE
,
$tokens
,
TRUE
);
$$bodyType
=
CRM_Utils_Token
::
replaceContactTokens
(
$$bodyType
,
$contact
,
FALSE
,
$tokens
,
FALSE
,
TRUE
);
$$bodyType
=
CRM_Utils_Token
::
replaceComponentTokens
(
$$bodyType
,
$contact
,
$tokens
,
TRUE
);
$$bodyType
=
CRM_Utils_Token
::
replaceHookTokens
(
$$bodyType
,
$contact
,
$categories
,
TRUE
);
}
}
$html
=
$body_html
;
$text
=
$body_text
;
$smarty
=
CRM_Core_Smarty
::
singleton
();
foreach
([
'text'
,
'html'
,
]
as
$elem
)
{
$$elem
=
$smarty
->
fetch
(
"string:
{
$$elem
}
"
);
}
// do replacements in message subject
$messageSubject
=
CRM_Utils_Token
::
replaceContactTokens
(
$body_subject
,
$contact
,
FALSE
,
$tokens
);
$messageSubject
=
CRM_Utils_Token
::
replaceDomainTokens
(
$messageSubject
,
$domain
,
TRUE
,
$tokens
);
$messageSubject
=
CRM_Utils_Token
::
replaceComponentTokens
(
$messageSubject
,
$contact
,
$tokens
,
TRUE
);
$messageSubject
=
CRM_Utils_Token
::
replaceHookTokens
(
$messageSubject
,
$contact
,
$categories
,
TRUE
);
$messageSubject
=
$smarty
->
fetch
(
"string:
{
$messageSubject
}
"
);
// set up the parameters for CRM_Utils_Mail::send
$mailParams
=
[
'groupName'
=>
'Scheduled Reminder Sender'
,
'from'
=>
$from
,
'toName'
=>
$contact
[
'display_name'
],
'toEmail'
=>
$email
,
'subject'
=>
$messageSubject
,
];
if
(
!
$html
||
$contact
[
'preferred_mail_format'
]
==
'Text'
||
$contact
[
'preferred_mail_format'
]
==
'Both'
)
{
// render the & entities in text mode, so that the links work
$mailParams
[
'text'
]
=
str_replace
(
'&'
,
'&'
,
$text
);
}
if
(
$html
&&
(
$contact
[
'preferred_mail_format'
]
==
'HTML'
||
$contact
[
'preferred_mail_format'
]
==
'Both'
)
)
{
$mailParams
[
'html'
]
=
$html
;
}
$result
=
CRM_Utils_Mail
::
send
(
$mailParams
);
}
return
$result
;
}
/**
* Revert a message template to its default subject+text+HTML state.
*
...
...
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