From 28ca0c3be9e7d969c5c53c69b6e08b5d102a0d58 Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Tue, 18 Jun 2013 13:52:39 +0530 Subject: [PATCH] CRM-12822 --- .../4.3.5.msg_template/civicrm_msg_template.tpl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 CRM/Upgrade/4.3.5.msg_template/civicrm_msg_template.tpl diff --git a/CRM/Upgrade/4.3.5.msg_template/civicrm_msg_template.tpl b/CRM/Upgrade/4.3.5.msg_template/civicrm_msg_template.tpl new file mode 100644 index 0000000000..c63f9126de --- /dev/null +++ b/CRM/Upgrade/4.3.5.msg_template/civicrm_msg_template.tpl @@ -0,0 +1,16 @@ +{php} + $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.3.5.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} -- 2.25.1