Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20184 Missing email_greeting in Workflow Templates #11674

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CRM/Upgrade/5.1.beta1.msg_template/civicrm_msg_template.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{php}
$dir = SMARTY_DIR . '/../../CRM/Upgrade/5.1.beta1.msg_template/message_templates';
$templates = array();
foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) {
$parts = explode('_', basename($filename, '.tpl'));
$templates[] = array('type' => array_pop($parts), 'name' => implode('_', $parts), 'filename' => "$dir/$filename");
}
$this->assign('templates', $templates);
{/php}

{foreach from=$templates item=tpl}
{fetch assign=content file=$tpl.filename}
SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = '{$tpl.name}';
SELECT @content := msg_{$tpl.type} FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
UPDATE civicrm_msg_template SET msg_{$tpl.type} = '{$content|escape:"quotes"}' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_{$tpl.type} = @content));
{/foreach}
Loading