-- CRM-15475, changed Cancelled mmebership status to reserved
[civicrm-core.git] / xml / templates / civicrm_msg_template.tpl
1 -- +--------------------------------------------------------------------+
2 -- | CiviCRM version 4.5 |
3 -- +--------------------------------------------------------------------+
4 -- | Copyright CiviCRM LLC (c) 2004-2014 |
5 -- +--------------------------------------------------------------------+
6 -- | This file is a part of CiviCRM. |
7 -- | |
8 -- | CiviCRM is free software; you can copy, modify, and distribute it |
9 -- | under the terms of the GNU Affero General Public License |
10 -- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
11 -- | |
12 -- | CiviCRM is distributed in the hope that it will be useful, but |
13 -- | WITHOUT ANY WARRANTY; without even the implied warranty of |
14 -- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
15 -- | See the GNU Affero General Public License for more details. |
16 -- | |
17 -- | You should have received a copy of the GNU Affero General Public |
18 -- | License and the CiviCRM Licensing Exception along |
19 -- | with this program; if not, contact CiviCRM LLC |
20 -- | at info[AT]civicrm[DOT]org. If you have questions about the |
21 -- | GNU Affero General Public License or the licensing of CiviCRM, |
22 -- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
23 -- +--------------------------------------------------------------------+
24 --
25 -- Generated from {$smarty.template}
26 -- {$generated}
27 --
28 {* not sure how to define the below in Smarty, so doing it in PHP instead *}
29 {php}
30 $ogNames = array(
31 'case' => ts('Message Template Workflow for Cases', array('escape' => 'sql')),
32 'contribution' => ts('Message Template Workflow for Contributions', array('escape' => 'sql')),
33 'event' => ts('Message Template Workflow for Events', array('escape' => 'sql')),
34 'friend' => ts('Message Template Workflow for Tell-a-Friend', array('escape' => 'sql')),
35 'membership' => ts('Message Template Workflow for Memberships', array('escape' => 'sql')),
36 'meta' => ts('Message Template Workflow for Meta Templates', array('escape' => 'sql')),
37 'pledge' => ts('Message Template Workflow for Pledges', array('escape' => 'sql')),
38 'uf' => ts('Message Template Workflow for Profiles', array('escape' => 'sql')),
39 'petition' => ts('Message Template Workflow for Petition', array('escape' => 'sql')),
40 );
41 $ovNames = array(
42 'case' => array(
43 'case_activity' => ts('Cases - Send Copy of an Activity', array('escape' => 'sql')),
44 ),
45 'contribution' => array(
46 'contribution_dupalert' => ts('Contributions - Duplicate Organization Alert', array('escape' => 'sql')),
47 'contribution_offline_receipt' => ts('Contributions - Receipt (off-line)', array('escape' => 'sql')),
48 'contribution_online_receipt' => ts('Contributions - Receipt (on-line)', array('escape' => 'sql')),
49 'contribution_recurring_notify' => ts('Contributions - Recurring Start and End Notification', array('escape' => 'sql')),
50 'contribution_recurring_cancelled' => ts('Contributions - Recurring Cancellation Notification', array('escape' => 'sql')),
51 'contribution_recurring_billing' => ts('Contributions - Recurring Billing Updates', array('escape' => 'sql')),
52 'contribution_recurring_edit' => ts('Contributions - Recurring Updates', array('escape' => 'sql')),
53 'pcp_notify' => ts('Personal Campaign Pages - Admin Notification', array('escape' => 'sql')),
54 'pcp_status_change' => ts('Personal Campaign Pages - Supporter Status Change Notification', array('escape' => 'sql')),
55 'pcp_supporter_notify' => ts('Personal Campaign Pages - Supporter Welcome', array('escape' => 'sql')),
56 'payment_or_refund_notification' => ts('Additional Payment Receipt or Refund Notification', array('escape' => 'sql')),
57 ),
58 'event' => array(
59 'event_offline_receipt' => ts('Events - Registration Confirmation and Receipt (off-line)', array('escape' => 'sql')),
60 'event_online_receipt' => ts('Events - Registration Confirmation and Receipt (on-line)', array('escape' => 'sql')),
61 'event_registration_receipt' => ts('Events - Receipt only', array('escape' => 'sql')),
62 'participant_cancelled' => ts('Events - Registration Cancellation Notice', array('escape' => 'sql')),
63 'participant_confirm' => ts('Events - Registration Confirmation Invite', array('escape' => 'sql')),
64 'participant_expired' => ts('Events - Pending Registration Expiration Notice', array('escape' => 'sql')),
65 ),
66 'friend' => array(
67 'friend' => ts('Tell-a-Friend Email', array('escape' => 'sql')),
68 ),
69 'membership' => array(
70 'membership_offline_receipt' => ts('Memberships - Signup and Renewal Receipts (off-line)', array('escape' => 'sql')),
71 'membership_online_receipt' => ts('Memberships - Receipt (on-line)', array('escape' => 'sql')),
72 'membership_autorenew_cancelled' => ts('Memberships - Auto-renew Cancellation Notification', array('escape' => 'sql')),
73 'membership_autorenew_billing' => ts('Memberships - Auto-renew Billing Updates', array('escape' => 'sql')),
74 ),
75 'meta' => array(
76 'test_preview' => ts('Test-drive - Receipt Header', array('escape' => 'sql')),
77 ),
78 'pledge' => array(
79 'pledge_acknowledge' => ts('Pledges - Acknowledgement', array('escape' => 'sql')),
80 'pledge_reminder' => ts('Pledges - Payment Reminder', array('escape' => 'sql')),
81 ),
82 'uf' => array(
83 'uf_notify' => ts('Profiles - Admin Notification', array('escape' => 'sql')),
84 ),
85 'petition' => array(
86 'petition_sign' => ts('Petition - signature added', array('escape' => 'sql')),
87 'petition_confirmation_needed' => ts('Petition - need verification', array('escape' => 'sql')),
88 ),
89 );
90 $this->assign('ogNames', $ogNames);
91 $this->assign('ovNames', $ovNames);
92 {/php}
93
94 INSERT INTO civicrm_option_group
95 (name, {localize field='title'}title{/localize}, {localize field='description'}description{/localize}, is_reserved, is_active) VALUES
96 {foreach from=$ogNames key=name item=description name=for_groups}
97 ('msg_tpl_workflow_{$name}', {localize}'{$description}'{/localize}, {localize}'{$description}'{/localize}, 1, 1) {if $smarty.foreach.for_groups.last};{else},{/if}
98 {/foreach}
99
100 {foreach from=$ogNames key=name item=description}
101 SELECT @tpl_ogid_{$name} := MAX(id) FROM civicrm_option_group WHERE name = 'msg_tpl_workflow_{$name}';
102 {/foreach}
103
104 INSERT INTO civicrm_option_value
105 (option_group_id, name, {localize field='label'}label{/localize}, value, weight) VALUES
106 {foreach from=$ovNames key=gName item=ovs name=for_groups}
107 {foreach from=$ovs key=vName item=label name=for_values}
108 (@tpl_ogid_{$gName}, '{$vName}', {localize}'{$label}'{/localize}, {$smarty.foreach.for_values.iteration}, {$smarty.foreach.for_values.iteration}) {if $smarty.foreach.for_groups.last and $smarty.foreach.for_values.last};{else},{/if}
109 {/foreach}
110 {/foreach}
111
112 {foreach from=$ovNames key=gName item=ovs}
113 {foreach from=$ovs key=vName item=label}
114 SELECT @tpl_ovid_{$vName} := MAX(id) FROM civicrm_option_value WHERE option_group_id = @tpl_ogid_{$gName} AND name = '{$vName}';
115 {/foreach}
116 {/foreach}
117
118 INSERT INTO civicrm_msg_template
119 (msg_title, msg_subject, msg_text, msg_html, workflow_id, is_default, is_reserved) VALUES
120 {foreach from=$ovNames key=gName item=ovs name=for_groups}
121 {foreach from=$ovs key=vName item=title name=for_values}
122 {fetch assign=subject file="`$smarty.const.SMARTY_DIR`/../../xml/templates/message_templates/`$vName`_subject.tpl"}
123 {fetch assign=text file="`$smarty.const.SMARTY_DIR`/../../xml/templates/message_templates/`$vName`_text.tpl"}
124 {fetch assign=html file="`$smarty.const.SMARTY_DIR`/../../xml/templates/message_templates/`$vName`_html.tpl"}
125 ('{$title}', '{$subject|escape:"quotes"}', '{$text|escape:"quotes"}', '{$html|escape:"quotes"}', @tpl_ovid_{$vName}, 1, 0),
126 ('{$title}', '{$subject|escape:"quotes"}', '{$text|escape:"quotes"}', '{$html|escape:"quotes"}', @tpl_ovid_{$vName}, 0, 1) {if $smarty.foreach.for_groups.last and $smarty.foreach.for_values.last};{else},{/if}
127 {/foreach}
128 {/foreach}
129
130 {php}
131 $dir = SMARTY_DIR . '/../../xml/templates/message_templates/sample';
132 $templates = array();
133 foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) {
134 $templates[] = array('name' => basename($filename, '.tpl'), 'filename' => "$dir/$filename");
135 }
136 $this->assign('templates', $templates);
137 {/php}
138
139 {foreach from=$templates item=tpl}
140 {fetch assign=content file=$tpl.filename}
141 INSERT INTO civicrm_msg_template
142 (msg_title, msg_subject, msg_text, msg_html, workflow_id, is_default, is_reserved) VALUES
143 ('{$tpl.name} Template', '{$tpl.name}', '', '{$content|escape:"quotes"}' ,NULL, 1, 0);
144 {/foreach}