Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
justinfreeman (Agileware)
Core
Commits
4ee279f4
Commit
4ee279f4
authored
11 years ago
by
Kurund Jalmi
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Merge pull request #1368 from drumm/CRM-12930-smarty-compile"
This reverts commit
30ffbdf0
, reversing changes made to
94ee5a7f
.
parent
50cbabde
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Core/BAO/ActionSchedule.php
+8
-7
8 additions, 7 deletions
CRM/Core/BAO/ActionSchedule.php
CRM/Core/BAO/MessageTemplates.php
+23
-20
23 additions, 20 deletions
CRM/Core/BAO/MessageTemplates.php
with
31 additions
and
27 deletions
CRM/Core/BAO/ActionSchedule.php
+
8
−
7
View file @
4ee279f4
...
...
@@ -385,13 +385,6 @@ WHERE cas.entity_value = $id AND
$body_text
=
CRM_Utils_String
::
htmlToText
(
$body_html
);
}
// Execute Smarty templates before token replacement, so templates do not
// interfere and we hit the compiled template cache.
$smarty
=
CRM_Core_Smarty
::
singleton
();
$body_text
=
$smarty
->
fetch
(
'string:'
.
$body_text
);
$body_html
=
$smarty
->
fetch
(
'string:'
.
$body_html
);
$body_subject
=
$smarty
->
fetch
(
'string:'
.
$messageSubject
);
$params
=
array
(
array
(
'contact_id'
,
'='
,
$contactId
,
0
,
0
));
list
(
$contact
,
$_
)
=
CRM_Contact_BAO_Query
::
apiQuery
(
$params
);
...
...
@@ -430,6 +423,12 @@ WHERE cas.entity_value = $id AND
$html
=
$body_html
;
$text
=
$body_text
;
$smarty
=
CRM_Core_Smarty
::
singleton
();
foreach
(
array
(
'text'
,
'html'
)
as
$elem
)
{
$$elem
=
$smarty
->
fetch
(
"string:
{
$$elem
}
"
);
}
$matches
=
array
();
preg_match_all
(
'/(?<!\{|\\\\)\{(\w+\.\w+)\}(?!\})/'
,
$body_subject
,
...
...
@@ -455,6 +454,8 @@ WHERE cas.entity_value = $id AND
$messageSubject
=
CRM_Utils_Token
::
replaceComponentTokens
(
$messageSubject
,
$contact
,
$tokens
[
$value
],
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
=
array
(
'groupName'
=>
'Scheduled Reminder Sender'
,
...
...
This diff is collapsed.
Click to expand it.
CRM/Core/BAO/MessageTemplates.php
+
23
−
20
View file @
4ee279f4
...
...
@@ -166,13 +166,6 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates {
$body_text
=
CRM_Utils_String
::
htmlToText
(
$body_html
);
}
// Execute Smarty templates before token replacement, so templates do not
// interfere and we hit the compiled template cache.
$smarty
=
CRM_Core_Smarty
::
singleton
();
$body_text
=
$smarty
->
fetch
(
'string:'
.
$body_text
);
$body_html
=
$smarty
->
fetch
(
'string:'
.
$body_html
);
$body_subject
=
$smarty
->
fetch
(
'string:'
.
$body_subject
);
$params
=
array
(
array
(
'contact_id'
,
'='
,
$contactId
,
0
,
0
));
list
(
$contact
,
$_
)
=
CRM_Contact_BAO_Query
::
apiQuery
(
$params
);
...
...
@@ -224,12 +217,20 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates {
$html
=
$body_html
;
$text
=
$body_text
;
$smarty
=
CRM_Core_Smarty
::
singleton
();
foreach
(
array
(
'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
=
array
(
'groupName'
=>
'Scheduled Reminder Sender'
,
...
...
@@ -388,19 +389,6 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates {
$testDao
->
free
();
}
// Strip whitespace from ends and turn into a single line.
$subject
=
"
{
strip}$subject{/strip
}
"
;
// Parse the three elements with Smarty.
$smarty
=
CRM_Core_Smarty
::
singleton
();
foreach
(
$params
[
'tplParams'
]
as
$name
=>
$value
)
{
$smarty
->
assign
(
$name
,
$value
);
}
foreach
(
array
(
'subject'
,
'text'
,
'html'
)
as
$elem
)
{
$$elem
=
$smarty
->
fetch
(
"string:
{
$$elem
}
"
);
}
// replace tokens in the three elements (in subject as if it was the text body)
$domain
=
CRM_Core_BAO_Domain
::
getDomain
();
$hookTokens
=
array
();
...
...
@@ -463,6 +451,21 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates {
$html
=
CRM_Utils_Token
::
replaceHookTokens
(
$html
,
$contact
,
$categories
,
TRUE
);
}
// strip whitespace from ends and turn into a single line
$subject
=
"
{
strip}$subject{/strip
}
"
;
// parse the three elements with Smarty
$smarty
=
CRM_Core_Smarty
::
singleton
();
foreach
(
$params
[
'tplParams'
]
as
$name
=>
$value
)
{
$smarty
->
assign
(
$name
,
$value
);
}
foreach
(
array
(
'subject'
,
'text'
,
'html'
)
as
$elem
)
{
$$elem
=
$smarty
->
fetch
(
"string:
{
$$elem
}
"
);
}
// send the template, honouring the target user’s preferences (if any)
$sent
=
FALSE
;
...
...
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