CRM-15821 Add PCP owner notifications message templates
authorNileemaJadhav <nileema.jadhav@webaccess.co.in>
Fri, 16 Jan 2015 13:38:35 +0000 (19:08 +0530)
committerNileemaJadhav <nileema.jadhav@webaccess.co.in>
Wed, 21 Jan 2015 11:28:10 +0000 (16:58 +0530)
----------------------------------------
* CRM-15821: Provide option to notify Personal Campaign Page "Owner" when someone donates via their page
  https://issues.civicrm.org/jira/browse/CRM-15821

CRM/Upgrade/4.6.alpha3.msg_template/civicrm_msg_template.tpl [new file with mode: 0644]
CRM/Upgrade/4.6.alpha3.msg_template/message_templates/pcp_owner_notify_html.tpl [new file with mode: 0644]
CRM/Upgrade/4.6.alpha3.msg_template/message_templates/pcp_owner_notify_subject.tpl [new file with mode: 0644]
CRM/Upgrade/4.6.alpha3.msg_template/message_templates/pcp_owner_notify_text.tpl [new file with mode: 0644]
xml/templates/message_templates/pcp_owner_notify_html.tpl [new file with mode: 0644]
xml/templates/message_templates/pcp_owner_notify_subject.tpl [new file with mode: 0644]
xml/templates/message_templates/pcp_owner_notify_text.tpl [new file with mode: 0644]

diff --git a/CRM/Upgrade/4.6.alpha3.msg_template/civicrm_msg_template.tpl b/CRM/Upgrade/4.6.alpha3.msg_template/civicrm_msg_template.tpl
new file mode 100644 (file)
index 0000000..2b1367f
--- /dev/null
@@ -0,0 +1,50 @@
+{php}
+  $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.6.alpha1.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}
+
+{php}
+  $ovNames = array(
+    'contribution' => array(
+      'pcp_owner_notify' => ts('Personal Campaign Pages - Owner Notification',             array('escape' => 'sql')),
+    ),
+  );
+
+  $this->assign('ovNames', $ovNames);
+  $this->assign('dir', $dir);
+{/php}
+
+{foreach from=$ovNames key=name item=ignore}
+  SELECT @tpl_ogid_{$name} := MAX(id) FROM civicrm_option_group WHERE name = 'msg_tpl_workflow_{$name}';
+{/foreach}
+
+INSERT INTO civicrm_option_value
+  (option_group_id,        name,       {localize field='label'}label{/localize},   value,                                  weight) VALUES
+{foreach from=$ovNames key=gName item=ovs name=for_groups}
+{foreach from=$ovs key=vName item=label name=for_values}
+      (@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}
+{/foreach}
+{/foreach}
+
+{foreach from=$ovNames key=gName item=ovs}
+{foreach from=$ovs key=vName item=label}
+    SELECT @tpl_ovid_{$vName} := MAX(id) FROM civicrm_option_value WHERE option_group_id = @tpl_ogid_{$gName} AND name = '{$vName}';
+{/foreach}
+{/foreach}
+
+INSERT INTO civicrm_msg_template
+  (msg_title,      msg_subject,                  msg_text,                  msg_html,                  workflow_id,        is_default, is_reserved) VALUES
+{foreach from=$ovNames key=gName item=ovs name=for_groups}
+{foreach from=$ovs key=vName item=title name=for_values}
+      {fetch assign=subject file="`$smarty.const.SMARTY_DIR`/../../CRM/Upgrade/4.6.alpha3.msg_template/message_templates/`$vName`_subject.tpl"}
+      {fetch assign=text    file="`$smarty.const.SMARTY_DIR`/../../CRM/Upgrade/4.6.alpha3.msg_template/message_templates/`$vName`_text.tpl"}
+      {fetch assign=html    file="`$smarty.const.SMARTY_DIR`/../../CRM/Upgrade/4.6.alpha3.msg_template/message_templates/`$vName`_html.tpl"}
+      ('{$title}', '{$subject|escape:"quotes"}', '{$text|escape:"quotes"}', '{$html|escape:"quotes"}', @tpl_ovid_{$vName}, 1,          0),
+      ('{$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}
+{/foreach}
+{/foreach}
diff --git a/CRM/Upgrade/4.6.alpha3.msg_template/message_templates/pcp_owner_notify_html.tpl b/CRM/Upgrade/4.6.alpha3.msg_template/message_templates/pcp_owner_notify_html.tpl
new file mode 100644 (file)
index 0000000..043c8df
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title></title>
+</head>
+<body>
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+{capture assign=pcpURL     }{crmURL p="civicrm/pcp/info" q="reset=1&id=`$pcpId`" h=0 a=1}{/capture}
+
+  <p>{ts}You have received a donation at your personal page{/ts}: {$page_title}</p>
+  <p>{ts}Your fundraising total has been updated.{/ts}<br/>
+    {ts}The donor's information is listed below.  You can choose to contact them and convey your thanks if you wish.{/ts} <br/>
+    {if $is_honor_roll_enabled}
+      {ts}The donor's name has been added to your honor roll unless they asked not to be included.{/ts}<br/>
+    {/if}
+  </p>
+  <table width="620" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">
+    <tr><td>{ts}Receive Date{/ts}:</td><td> {$receive_date|crmDate}</td></tr>
+    <tr><td>{ts}Amount{/ts}:</td><td> {$total_amount|crmMoney}</td></tr>
+    <tr><td>{ts}Name{/ts}:</td><td> {$donors_display_name}</td></tr>
+    <tr><td>{ts}Email{/ts}:</td><td> {$donors_email}</td></tr>
+  </table>
+</body>
+</html>
diff --git a/CRM/Upgrade/4.6.alpha3.msg_template/message_templates/pcp_owner_notify_subject.tpl b/CRM/Upgrade/4.6.alpha3.msg_template/message_templates/pcp_owner_notify_subject.tpl
new file mode 100644 (file)
index 0000000..83d9e8f
--- /dev/null
@@ -0,0 +1 @@
+{ts}Someone has just donated to your personal campaign page{/ts}
diff --git a/CRM/Upgrade/4.6.alpha3.msg_template/message_templates/pcp_owner_notify_text.tpl b/CRM/Upgrade/4.6.alpha3.msg_template/message_templates/pcp_owner_notify_text.tpl
new file mode 100644 (file)
index 0000000..365eeda
--- /dev/null
@@ -0,0 +1,19 @@
+===========================================================
+{ts}Personal Campaign Page Owner Notification{/ts}
+
+===========================================================
+{ts}You have received a donation at your personal page{/ts}: {$page_title}
+
+{ts}Your fundraising total has been updated.{/ts}
+{ts}The donor's information is listed below.  You can choose to contact them and convey your thanks if you wish.{/ts}
+{if $is_honor_roll_enabled}
+    {ts}The donor's name has been added to your honor roll unless they asked not to be included.{/ts}
+{/if}
+
+{ts}Receive Date{/ts}: {$receive_date|crmDate}
+
+{ts}Amount{/ts}: {$total_amount|crmMoney}
+
+{ts}Name{/ts}: {$donors_display_name}
+
+{ts}Email{/ts}: {$donors_email}
diff --git a/xml/templates/message_templates/pcp_owner_notify_html.tpl b/xml/templates/message_templates/pcp_owner_notify_html.tpl
new file mode 100644 (file)
index 0000000..043c8df
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title></title>
+</head>
+<body>
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+{capture assign=pcpURL     }{crmURL p="civicrm/pcp/info" q="reset=1&id=`$pcpId`" h=0 a=1}{/capture}
+
+  <p>{ts}You have received a donation at your personal page{/ts}: {$page_title}</p>
+  <p>{ts}Your fundraising total has been updated.{/ts}<br/>
+    {ts}The donor's information is listed below.  You can choose to contact them and convey your thanks if you wish.{/ts} <br/>
+    {if $is_honor_roll_enabled}
+      {ts}The donor's name has been added to your honor roll unless they asked not to be included.{/ts}<br/>
+    {/if}
+  </p>
+  <table width="620" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">
+    <tr><td>{ts}Receive Date{/ts}:</td><td> {$receive_date|crmDate}</td></tr>
+    <tr><td>{ts}Amount{/ts}:</td><td> {$total_amount|crmMoney}</td></tr>
+    <tr><td>{ts}Name{/ts}:</td><td> {$donors_display_name}</td></tr>
+    <tr><td>{ts}Email{/ts}:</td><td> {$donors_email}</td></tr>
+  </table>
+</body>
+</html>
diff --git a/xml/templates/message_templates/pcp_owner_notify_subject.tpl b/xml/templates/message_templates/pcp_owner_notify_subject.tpl
new file mode 100644 (file)
index 0000000..83d9e8f
--- /dev/null
@@ -0,0 +1 @@
+{ts}Someone has just donated to your personal campaign page{/ts}
diff --git a/xml/templates/message_templates/pcp_owner_notify_text.tpl b/xml/templates/message_templates/pcp_owner_notify_text.tpl
new file mode 100644 (file)
index 0000000..365eeda
--- /dev/null
@@ -0,0 +1,19 @@
+===========================================================
+{ts}Personal Campaign Page Owner Notification{/ts}
+
+===========================================================
+{ts}You have received a donation at your personal page{/ts}: {$page_title}
+
+{ts}Your fundraising total has been updated.{/ts}
+{ts}The donor's information is listed below.  You can choose to contact them and convey your thanks if you wish.{/ts}
+{if $is_honor_roll_enabled}
+    {ts}The donor's name has been added to your honor roll unless they asked not to be included.{/ts}
+{/if}
+
+{ts}Receive Date{/ts}: {$receive_date|crmDate}
+
+{ts}Amount{/ts}: {$total_amount|crmMoney}
+
+{ts}Name{/ts}: {$donors_display_name}
+
+{ts}Email{/ts}: {$donors_email}