commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / CRM / Upgrade / 4.3.5.msg_template / civicrm_msg_template.tpl
1 {php}
2 $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.3.5.msg_template/message_templates';
3 $templates = array();
4 foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) {
5 $parts = explode('_', basename($filename, '.tpl'));
6 $templates[] = array('type' => array_pop($parts), 'name' => implode('_', $parts), 'filename' => "$dir/$filename");
7 }
8 $this->assign('templates', $templates);
9 {/php}
10
11 {foreach from=$templates item=tpl}
12 {fetch assign=content file=$tpl.filename}
13 SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = '{$tpl.name}';
14 SELECT @content := msg_{$tpl.type} FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
15 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));
16 {/foreach}