Permalink
Browse files

* [CHD-3015] [Broadcast/Snippets] Fixed the lazy loader for snippet p…

…laceholders in broadcast functionality. This always worked for snippets in messages themselves, but it wasn't working on opportunities recipients because their email addresses were lazy loaded.
  • Loading branch information...
1 parent 31b9b05 commit 5baf313410853c31de65283a5a297e1ce109302f @jstanden jstanden committed Jun 29, 2012
@@ -921,11 +921,14 @@ function doBulkUpdate($filter, $do, $ids=array()) {
foreach($ids as $addy_id) {
try {
CerberusContexts::getContext(CerberusContexts::CONTEXT_ADDRESS, $addy_id, $tpl_labels, $tpl_tokens);
- $subject = $tpl_builder->build($params['subject'], $tpl_tokens);
- $body = $tpl_builder->build($params['message'], $tpl_tokens);
+
+ $tpl_dict = new DevblocksDictionaryDelegate($tpl_tokens);
+
+ $subject = $tpl_builder->build($params['subject'], $tpl_dict);
+ $body = $tpl_builder->build($params['message'], $tpl_dict);
$json_params = array(
- 'to' => $tpl_tokens['address'],
+ 'to' => $tpl_dict->address,
'group_id' => $params['group_id'],
'next_is_closed' => $next_is_closed,
);
@@ -935,7 +938,7 @@ function doBulkUpdate($filter, $do, $ids=array()) {
DAO_MailQueue::TICKET_ID => 0,
DAO_MailQueue::WORKER_ID => $params['worker_id'],
DAO_MailQueue::UPDATED => time(),
- DAO_MailQueue::HINT_TO => $tpl_tokens['address'],
+ DAO_MailQueue::HINT_TO => $tpl_dict->address,
DAO_MailQueue::SUBJECT => $subject,
DAO_MailQueue::BODY => $body,
DAO_MailQueue::PARAMS_JSON => json_encode($json_params),
@@ -2591,7 +2591,8 @@ function doBulkUpdate($filter, $filter_param, $data, $do, $ids=array()) {
}
}
- $body = $tpl_builder->build($broadcast_params['message'], $tpl_tokens);
+ $tpl_dict = new DevblocksDictionaryDelegate($tpl_tokens);
+ $body = $tpl_builder->build($broadcast_params['message'], $tpl_dict);
$fields = array(
DAO_MailQueue::TYPE => Model_MailQueue::TYPE_TICKET_REPLY,
@@ -964,11 +964,14 @@ function doBulkUpdate($filter, $do, $ids=array()) {
foreach($ids as $opp_id) {
try {
CerberusContexts::getContext(CerberusContexts::CONTEXT_OPPORTUNITY, $opp_id, $tpl_labels, $tpl_tokens);
- $subject = $tpl_builder->build($params['subject'], $tpl_tokens);
- $body = $tpl_builder->build($params['message'], $tpl_tokens);
+
+ $tpl_dict = new DevblocksDictionaryDelegate($tpl_tokens);
+
+ $subject = $tpl_builder->build($params['subject'], $tpl_dict);
+ $body = $tpl_builder->build($params['message'], $tpl_dict);
$json_params = array(
- 'to' => $tpl_tokens['email_address'],
+ 'to' => $tpl_dict->email_address,
'group_id' => $params['group_id'],
'next_is_closed' => $next_is_closed,
);
@@ -978,7 +981,7 @@ function doBulkUpdate($filter, $do, $ids=array()) {
DAO_MailQueue::TICKET_ID => 0,
DAO_MailQueue::WORKER_ID => $params['worker_id'],
DAO_MailQueue::UPDATED => time(),
- DAO_MailQueue::HINT_TO => $tpl_tokens['email_address'],
+ DAO_MailQueue::HINT_TO => $tpl_dict->email_address,
DAO_MailQueue::SUBJECT => $subject,
DAO_MailQueue::BODY => $body,
DAO_MailQueue::PARAMS_JSON => json_encode($json_params),

0 comments on commit 5baf313

Please sign in to comment.