CRM-20400, Updated completed Text, Added upgrade code
authorPradeep Nayak <pradpnayak@gmail.com>
Fri, 7 Apr 2017 22:48:22 +0000 (04:18 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Fri, 7 Apr 2017 22:48:22 +0000 (04:18 +0530)
----------------------------------------
* CRM-20400: Update the Payment Receipt to use for Contribution pyament
  https://issues.civicrm.org/jira/browse/CRM-20400

CRM/Upgrade/4.7.19.msg_template/civicrm_msg_template.tpl [new file with mode: 0644]
CRM/Upgrade/4.7.19.msg_template/message_templates/payment_or_refund_notification_html.tpl [new file with mode: 0644]
CRM/Upgrade/4.7.19.msg_template/message_templates/payment_or_refund_notification_text.tpl [new file with mode: 0644]
CRM/Upgrade/Incremental/php/FourSeven.php
CRM/Upgrade/Incremental/sql/4.7.19.mysql.tpl
xml/templates/message_templates/payment_or_refund_notification_html.tpl
xml/templates/message_templates/payment_or_refund_notification_text.tpl

diff --git a/CRM/Upgrade/4.7.19.msg_template/civicrm_msg_template.tpl b/CRM/Upgrade/4.7.19.msg_template/civicrm_msg_template.tpl
new file mode 100644 (file)
index 0000000..30cf37f
--- /dev/null
@@ -0,0 +1,16 @@
+{php}
+  $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.7.19.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}
diff --git a/CRM/Upgrade/4.7.19.msg_template/message_templates/payment_or_refund_notification_html.tpl b/CRM/Upgrade/4.7.19.msg_template/message_templates/payment_or_refund_notification_html.tpl
new file mode 100644 (file)
index 0000000..709d791
--- /dev/null
@@ -0,0 +1,253 @@
+<!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=emptyBlockStyle }style="padding: 10px; border-bottom: 1px solid #999;background-color: #f7f7f7;"{/capture}
+{capture assign=emptyBlockValueStyle }style="padding: 10px; border-bottom: 1px solid #999;"{/capture}
+
+<p>Dear {$contactDisplayName}</p>
+<center>
+ <table width="620" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">
+
+  <!-- BEGIN HEADER -->
+  <!-- You can add table row(s) here with logo or other header elements -->
+  <!-- END HEADER -->
+
+  <!-- BEGIN CONTENT -->
+
+  <tr>
+    <td>
+      {if $isRefund}
+      <p>{ts}A refund has been issued based on changes in your registration selections.{/ts}</p>
+      {else}
+      <p>{ts}A payment has been received.{/ts}</p>
+      {/if}
+      <p>{ts}Please print this confirmation for your records.{/ts}</p>
+    </td>
+  </tr>
+  <tr>
+   <td>
+    <table style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse; width:100%;">
+  {if $isRefund}
+  <tr>
+    <th {$headerStyle}>{ts}Refund Details{/ts}</th>
+  </tr>
+  <tr>
+    <td {$labelStyle}>
+      {ts}Total Amount{/ts}
+    </td>
+    <td {$valueStyle}>
+      {$totalAmount|crmMoney}
+    </td>
+  </tr>
+  <tr>
+    <td {$labelStyle}>
+      {ts}You Paid{/ts}
+    </td>
+    <td {$valueStyle}>
+      {$totalPaid|crmMoney}
+    </td>
+  </tr>
+  <tr>
+    <td {$labelStyle}>
+      {ts}Refund Amount{/ts}
+    </td>
+    <td {$valueStyle}>
+      {$refundAmount|crmMoney}
+    <td>
+  </tr>
+  {else}
+    <tr>
+      <th {$headerStyle}>{ts}Payment Details{/ts}</th>
+    </tr>
+    <tr>
+      <td {$labelStyle}>
+        {ts}Total Amount{/ts}
+      </td>
+      <td {$valueStyle}>
+        {$totalAmount|crmMoney}
+      </td>
+      </tr>
+      <tr>
+      <td {$labelStyle}>
+        {ts}This Payment Amount{/ts}
+      </td>
+      <td {$valueStyle}>
+        {$paymentAmount|crmMoney}
+      </td>
+      </tr>
+     <tr>
+      <td {$labelStyle}>
+        {ts}Balance Owed{/ts}
+      </td>
+       <td {$valueStyle}>
+         {$amountOwed|crmMoney}
+      </td> {* This will be zero after final payment. *}
+     </tr>
+     <tr> <td {$emptyBlockStyle}></td>
+     <td {$emptyBlockValueStyle}></td></tr>
+      {if $paymentsComplete}
+      <tr>
+      <td colspan='2' {$valueStyle}>
+        {ts}Thank you for completing payment.{/ts}
+      </td>
+     </tr>
+      {/if}
+  {/if}
+  {if $receive_date}
+    <tr>
+      <td {$labelStyle}>
+        {ts}Transaction Date{/ts}
+      </td>
+      <td {$valueStyle}>
+        {$receive_date|crmDate}
+      </td>
+    </tr>
+  {/if}
+  {if $trxn_id}
+    <tr>
+      <td {$labelStyle}>
+  {ts}Transaction #{/ts}
+      </td>
+      <td {$valueStyle}>
+        {$trxn_id}
+      </td>
+    </tr>
+  {/if}
+  {if $paidBy}
+    <tr>
+      <td {$labelStyle}>
+        {ts}Paid By{/ts}
+      </td>
+      <td {$valueStyle}>
+        {$paidBy}
+      </td>
+    </tr>
+  {/if}
+  {if $checkNumber}
+    <tr>
+      <td {$labelStyle}>
+        {ts}Check Number{/ts}
+      </td>
+      <td {$valueStyle}>
+        {$checkNumber}
+      </td>
+    </tr>
+  {/if}
+  </table>
+  </td>
+  </tr>
+    <tr>
+      <td>
+  <table style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse; width:100%;">
+    {if $contributeMode eq 'direct' and !$isAmountzero}
+          <tr>
+            <th {$headerStyle}>
+        {ts}Billing Name and Address{/ts}
+            </th>
+          </tr>
+          <tr>
+            <td colspan="2" {$valueStyle}>
+        {$billingName}<br />
+        {$address|nl2br}
+            </td>
+          </tr>
+    {/if}
+    {if $contributeMode eq'direct' and !$isAmountzero}
+          <tr>
+            <th {$headerStyle}>
+        {ts}Credit Card Information{/ts}
+            </th>
+          </tr>
+          <tr>
+            <td colspan="2" {$valueStyle}>
+        {$credit_card_type}<br />
+        {$credit_card_number}<br />
+        {ts}Expires:{/ts} {$credit_card_exp_date|truncate:7:''|crmDate}
+            </td>
+          </tr>
+    {/if}
+    {if $component eq 'event'}
+    <tr>
+      <th {$headerStyle}>
+        {ts}Event Information and Location{/ts}
+      </th>
+    </tr>
+    <tr>
+      <td colspan="2" {$valueStyle}>
+         {$event.event_title}<br />
+        {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+      </td>
+    </tr>
+
+    {if $event.participant_role}
+    <tr>
+      <td {$labelStyle}>
+        {ts}Participant Role{/ts}
+      </td>
+      <td {$valueStyle}>
+        {$event.participant_role}
+      </td>
+    </tr>
+    {/if}
+
+    {if $isShowLocation}
+    <tr>
+      <td colspan="2" {$valueStyle}>
+        {$location.address.1.display|nl2br}
+      </td>
+    </tr>
+    {/if}
+
+    {if $location.phone.1.phone || $location.email.1.email}
+    <tr>
+      <td colspan="2" {$labelStyle}>
+        {ts}Event Contacts:{/ts}
+      </td>
+    </tr>
+    {foreach from=$location.phone item=phone}
+    {if $phone.phone}
+          <tr>
+            <td {$labelStyle}>
+        {if $phone.phone_type}
+        {$phone.phone_type_display}
+        {else}
+        {ts}Phone{/ts}
+        {/if}
+            </td>
+            <td {$valueStyle}>
+        {$phone.phone} {if $phone.phone_ext}&nbsp;{ts}ext.{/ts} {$phone.phone_ext}{/if}
+            </td>
+          </tr>
+    {/if}
+    {/foreach}
+    {foreach from=$location.email item=eventEmail}
+    {if $eventEmail.email}
+          <tr>
+            <td {$labelStyle}>
+        {ts}Email{/ts}
+            </td>
+            <td {$valueStyle}>
+        {$eventEmail.email}
+            </td>
+          </tr>
+    {/if}
+    {/foreach}
+    {/if} {*phone block close*}
+    {/if}
+  </table>
+      </td>
+    </tr>
+
+    </table>
+  </center>
+
+ </body>
+</html>
diff --git a/CRM/Upgrade/4.7.19.msg_template/message_templates/payment_or_refund_notification_text.tpl b/CRM/Upgrade/4.7.19.msg_template/message_templates/payment_or_refund_notification_text.tpl
new file mode 100644 (file)
index 0000000..2a53e3a
--- /dev/null
@@ -0,0 +1,102 @@
+Dear {$contactDisplayName}
+{if $isRefund}
+{ts}A refund has been issued based on changes in your registration selections.{/ts}
+{else}
+{ts}A payment has been received.{/ts}
+{/if}
+
+{ts}Please print this confirmation for your records.{/ts}
+
+{if $isRefund}
+===============================================================================
+
+{ts}Refund Details{/ts}
+
+===============================================================================
+{ts}Total Fees{/ts}: {$totalAmount|crmMoney}
+{ts}You Paid{/ts}: {$totalPaid|crmMoney}
+------------------------------------------------------------------------------------
+{ts}Refund Amount{/ts}: {$refundAmount|crmMoney}
+
+{else}
+===============================================================================
+
+{ts}Payment Details{/ts}
+
+===============================================================================
+{ts}Total Fees{/ts}: {$totalAmount|crmMoney}
+{ts}This Payment Amount{/ts}: {$paymentAmount|crmMoney}
+------------------------------------------------------------------------------------
+{ts}Balance Owed{/ts}: {$amountOwed|crmMoney} {* This will be zero after final payment. *}
+
+{if $paymentsComplete}
+
+{ts}Thank you for completing payment.
+{/if}
+{/if}
+{if $receive_date}
+{ts}Transaction Date{/ts}: {$receive_date|crmDate}
+{/if}
+{if $trxn_id}
+{ts}Transaction #{/ts}: {$trxn_id}
+{/if}
+{if $paidBy}
+{ts}Paid By{/ts}: {$paidBy}
+{/if}
+{if $checkNumber}
+{ts}Check Number{/ts}: {$checkNumber}
+{/if}
+{if $contributeMode eq 'direct' and !$isAmountzero}
+
+===============================================================================
+
+{ts}Billing Name and Address{/ts}
+
+===============================================================================
+
+{$billingName}
+{$address}
+{/if}
+
+{if $contributeMode eq 'direct' and !$isAmountzero}
+===========================================================
+{ts}Credit Card Information{/ts}
+
+===============================================================================
+
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+{/if}
+{if $component eq 'event'}
+===============================================================================
+
+{ts}Event Information and Location{/ts}
+
+===============================================================================
+
+{$event.event_title}
+{$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+
+{if $event.participant_role}
+{ts}Participant Role{/ts}: {$event.participant_role}
+{/if}
+
+{if $isShowLocation}
+{$location.address.1.display|strip_tags:false}
+{/if}{*End of isShowLocation condition*}
+
+{if $location.phone.1.phone || $location.email.1.email}
+
+{ts}Event Contacts:{/ts}
+{foreach from=$location.phone item=phone}
+{if $phone.phone}
+
+{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if}
+{/foreach}
+{foreach from=$location.email item=eventEmail}
+{if $eventEmail.email}
+
+{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach}
+{/if}
+{/if}
index f06f714eb99d96ee9dd3ca237551b813f74d2ca1..f53f6ecc6184ec3499bb3bc09e2a7528629c8160 100644 (file)
@@ -121,6 +121,9 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base
         . '<br />' . ts('You can re-enable it by visitng the <a %1>CKEditor Config</a> screen and setting "fullPage = true" under the Advanced Options of the CiviMail preset.', array(1 => $ck_href))
         . '</p>';
     }
+    if ($rev == '4.7.19') {
+      $postUpgradeMessage .= '<br /><br />' . ts('Default version of the following System Workflow Message Templates have been modified: <ul><li>Additional Payment Receipt or Refund Notification</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).');
+    }
   }
 
   /**
index 0b12d05bdcc8b0b55cbc6ad97210831162d449be..cadc65e3786b116dcb8cbfb81922c46969f914b0 100644 (file)
@@ -22,3 +22,5 @@ ON price_field.price_field_id = cpf.id
 SET cpf.is_active = 0
 WHERE price_field.price_field_id IS NULL;
 
+-- CRM-20400
+{include file='../CRM/Upgrade/4.7.19.msg_template/civicrm_msg_template.tpl'}
index cbaae6440104ccd51cc77b3670b1b3dbc246665e..709d7915d99e9e01db62d7954d7eb034904cd5bf 100644 (file)
@@ -96,7 +96,7 @@
       {if $paymentsComplete}
       <tr>
       <td colspan='2' {$valueStyle}>
-        {ts}Thank-you. This completes your payment for {if $component eq 'event'}{$event.event_title}{/if}.{/ts}
+        {ts}Thank you for completing payment.{/ts}
       </td>
      </tr>
       {/if}
index d8ae664013a4bcc5113cc61195977b3d3be3ea1f..2a53e3a4b683d9ee56a50dc45632e11eb61f761e 100644 (file)
@@ -31,7 +31,7 @@ Dear {$contactDisplayName}
 
 {if $paymentsComplete}
 
-{ts}Thank-you. This completes your payment for {/ts}{if $component eq 'event'}{$event.event_title}{/if}.
+{ts}Thank you for completing payment.
 {/if}
 {/if}
 {if $receive_date}