From dd55005c609cdbf647c0370ed9d2049efa0e5414 Mon Sep 17 00:00:00 2001
From: yashodha
Date: Fri, 17 Jul 2015 20:21:38 +0530
Subject: [PATCH] CRM-16853: Soft credit currency is ignored in PCP Owner
Notification message
----------------------------------------
* CRM-16853: Soft credit currency is ignored in PCP Owner Notification message.
https://issues.civicrm.org/jira/browse/CRM-16853
---
CRM/Contribute/Form/Contribution/Confirm.php | 1 +
.../civicrm_msg_template.tpl | 16 +++++++++++
.../pcp_owner_notify_html.tpl | 27 +++++++++++++++++++
.../pcp_owner_notify_subject.tpl | 1 +
.../pcp_owner_notify_text.tpl | 20 ++++++++++++++
CRM/Upgrade/Incremental/php/FourSeven.php | 2 ++
.../Incremental/sql/4.7.alpha1.mysql.tpl | 5 ++++
.../pcp_owner_notify_html.tpl | 2 +-
.../pcp_owner_notify_text.tpl | 2 +-
9 files changed, 74 insertions(+), 2 deletions(-)
create mode 100644 CRM/Upgrade/4.7.alpha1.msg_template/civicrm_msg_template.tpl
create mode 100644 CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_html.tpl
create mode 100644 CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_subject.tpl
create mode 100644 CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_text.tpl
diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php
index b6e9271399..a9988ea6a8 100644
--- a/CRM/Contribute/Form/Contribution/Confirm.php
+++ b/CRM/Contribute/Form/Contribution/Confirm.php
@@ -1457,6 +1457,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
'donors_email' => $email,
'pcpInfoURL' => $pcpInfoURL,
'is_honor_roll_enabled' => $contributionSoft->pcp_display_in_roll,
+ 'currency' => $contributionSoft->currency,
);
$domainValues = CRM_Core_BAO_Domain::getNameAndEmail();
$sendTemplateParams = array(
diff --git a/CRM/Upgrade/4.7.alpha1.msg_template/civicrm_msg_template.tpl b/CRM/Upgrade/4.7.alpha1.msg_template/civicrm_msg_template.tpl
new file mode 100644
index 0000000000..c2c68d1509
--- /dev/null
+++ b/CRM/Upgrade/4.7.alpha1.msg_template/civicrm_msg_template.tpl
@@ -0,0 +1,16 @@
+{php}
+ $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.7.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}
+
+{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.alpha1.msg_template/message_templates/pcp_owner_notify_html.tpl b/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_html.tpl
new file mode 100644
index 0000000000..78de6adb7c
--- /dev/null
+++ b/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_html.tpl
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+{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}
+
+ {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:$currency} |
+ {ts}Name{/ts}: | {$donors_display_name} |
+ {ts}Email{/ts}: | {$donors_email} |
+
+
+
diff --git a/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_subject.tpl b/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_subject.tpl
new file mode 100644
index 0000000000..83d9e8f933
--- /dev/null
+++ b/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_subject.tpl
@@ -0,0 +1 @@
+{ts}Someone has just donated to your personal campaign page{/ts}
diff --git a/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_text.tpl b/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_text.tpl
new file mode 100644
index 0000000000..ea9ae9b2c2
--- /dev/null
+++ b/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_text.tpl
@@ -0,0 +1,20 @@
+===========================================================
+{ts}Personal Campaign Page Owner Notification{/ts}
+
+===========================================================
+{ts}You have received a donation at your personal page{/ts}: {$page_title}
+>> {$pcpInfoURL}
+
+{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:$currency}
+
+{ts}Name{/ts}: {$donors_display_name}
+
+{ts}Email{/ts}: {$donors_email}
diff --git a/CRM/Upgrade/Incremental/php/FourSeven.php b/CRM/Upgrade/Incremental/php/FourSeven.php
index 9d044aad43..792fb64c2c 100644
--- a/CRM/Upgrade/Incremental/php/FourSeven.php
+++ b/CRM/Upgrade/Incremental/php/FourSeven.php
@@ -91,6 +91,8 @@ class CRM_Upgrade_Incremental_php_FourSeven {
$postUpgradeMessage .= '' . $msg . '
';
}
$postUpgradeMessage .= '' . ts('CiviCRM now includes the easy-to-use CKEditor Configurator. To customize the features and display of your wysiwyg editor, visit the Display Preferences page. Learn more...', array(1 => $dsp_href, 2 => $blog_href)) . '
';
+
+ $postUpgradeMessage .= '
' . ts('Default version of the following System Workflow Message Templates have been modified: - Personal Campaign Pages - Owner Notification
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).');
}
}
diff --git a/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl
index 3856d6a831..2b3ed8f6c4 100644
--- a/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl
+++ b/CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl
@@ -19,3 +19,8 @@ UPDATE civicrm_option_value SET {localize field="label"}label = 'Activity Detail
UPDATE civicrm_option_value SET {localize field="label"}label = 'Activity Summary Report'{/localize}
WHERE value = 'activitySummary' AND option_group_id = @option_group_id_report;
+
+--CRM-16853 PCP Owner Notification
+
+{include file='../CRM/Upgrade/4.7.alpha1.msg_template/civicrm_msg_template.tpl'}
+
diff --git a/xml/templates/message_templates/pcp_owner_notify_html.tpl b/xml/templates/message_templates/pcp_owner_notify_html.tpl
index 007ee41956..78de6adb7c 100644
--- a/xml/templates/message_templates/pcp_owner_notify_html.tpl
+++ b/xml/templates/message_templates/pcp_owner_notify_html.tpl
@@ -19,7 +19,7 @@
{ts}Receive Date{/ts}: | {$receive_date|crmDate} |
- {ts}Amount{/ts}: | {$total_amount|crmMoney} |
+ {ts}Amount{/ts}: | {$total_amount|crmMoney:$currency} |
{ts}Name{/ts}: | {$donors_display_name} |
{ts}Email{/ts}: | {$donors_email} |
diff --git a/xml/templates/message_templates/pcp_owner_notify_text.tpl b/xml/templates/message_templates/pcp_owner_notify_text.tpl
index 3edd98a62f..ea9ae9b2c2 100644
--- a/xml/templates/message_templates/pcp_owner_notify_text.tpl
+++ b/xml/templates/message_templates/pcp_owner_notify_text.tpl
@@ -13,7 +13,7 @@
{ts}Receive Date{/ts}: {$receive_date|crmDate}
-{ts}Amount{/ts}: {$total_amount|crmMoney}
+{ts}Amount{/ts}: {$total_amount|crmMoney:$currency}
{ts}Name{/ts}: {$donors_display_name}
--
2.25.1