From 1a9f6d0de8b53d59f8bffe4f54a9d91762e664da Mon Sep 17 00:00:00 2001 From: Pratik Joshi Date: Wed, 13 Mar 2013 17:38:54 +0530 Subject: [PATCH] CRM-12076 fix Conflicts: CRM/Upgrade/Incremental/sql/4.3.beta3.mysql.tpl --- CRM/Core/Payment.php | 4 + .../civicrm_msg_template.tpl | 16 + .../contribution_online_receipt_html.tpl | 396 ++++++++++++++++++ .../contribution_online_receipt_text.tpl | 181 ++++++++ .../Incremental/sql/4.3.beta3.mysql.tpl | 1 + .../contribution_online_receipt_html.tpl | 12 +- .../contribution_online_receipt_text.tpl | 2 + 7 files changed, 607 insertions(+), 5 deletions(-) create mode 100644 CRM/Upgrade/4.3.beta3.msg_template/civicrm_msg_template.tpl create mode 100644 CRM/Upgrade/4.3.beta3.msg_template/message_templates/contribution_online_receipt_html.tpl create mode 100644 CRM/Upgrade/4.3.beta3.msg_template/message_templates/contribution_online_receipt_text.tpl diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index c20f36914b..778adbaa42 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -309,6 +309,10 @@ abstract class CRM_Core_Payment { $url = 'civicrm/contribute/unsubscribe'; } elseif ($action == 'billing') { + //in notify mode don't return the update billing url + if ($this->_paymentProcessor['billing_mode'] == self::BILLING_MODE_NOTIFY) { + return NULL; + } $url = 'civicrm/contribute/updatebilling'; } elseif ($action == 'update') { diff --git a/CRM/Upgrade/4.3.beta3.msg_template/civicrm_msg_template.tpl b/CRM/Upgrade/4.3.beta3.msg_template/civicrm_msg_template.tpl new file mode 100644 index 0000000000..f9a58e0ebd --- /dev/null +++ b/CRM/Upgrade/4.3.beta3.msg_template/civicrm_msg_template.tpl @@ -0,0 +1,16 @@ +{php} + $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.3.beta3.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.3.beta3.msg_template/message_templates/contribution_online_receipt_html.tpl b/CRM/Upgrade/4.3.beta3.msg_template/message_templates/contribution_online_receipt_html.tpl new file mode 100644 index 0000000000..976c24ad46 --- /dev/null +++ b/CRM/Upgrade/4.3.beta3.msg_template/message_templates/contribution_online_receipt_html.tpl @@ -0,0 +1,396 @@ + + + + + + + + +{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} + +
+ + + + + + + + + + + +
+ + {if $receipt_text} +

{$receipt_text|htmlize}

+ {/if} + + {if $is_pay_later} +

{$pay_later_receipt}

{* FIXME: this might be text rather than HTML *} + {else} +

{ts}Please print this confirmation for your records.{/ts}

+ {/if} + +
+ + + {if $amount} + + + + + + + {if $lineItem and $priceSetID and !$is_quick_config} + + {foreach from=$lineItem item=value key=priceset} + + + + {/foreach} + + + + + + {else} + + + + + + + {/if} + + {/if} + + + {if $receive_date} + + + + + {/if} + + {if $is_monetary and $trxn_id} + + + + + {/if} + + {if $is_recur} + {if $contributeMode eq 'notify' or $contributeMode eq 'directIPN'} + + + {if $updateSubscriptionBillingUrl} + + + + {/if} + + + + + {/if} + {/if} + + {if $honor_block_is_active} + + + + + + + {if $honor_email} + + + + + {/if} + {/if} + + {if $pcpBlock} + + + + + + + + {if $pcp_roll_nickname} + + + + + {/if} + {if $pcp_personal_note} + + + + + {/if} + {/if} + + {if $onBehalfProfile} + + + + {foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName} + + + + + {/foreach} + {/if} + + {if $isShare} + + + + {/if} + + {if ! ($contributeMode eq 'notify' OR $contributeMode eq 'directIPN') and $is_monetary} + {if $is_pay_later} + + + + + + + {elseif $amount GT 0} + + + + + + + {/if} + {/if} + + {if $contributeMode eq 'direct' AND !$is_pay_later AND $amount GT 0} + + + + + + + {/if} + + {if $selectPremium} + + + + + + + {if $option} + + + + + {/if} + {if $sku} + + + + + {/if} + {if $start_date} + + + + + {/if} + {if $end_date} + + + + + {/if} + {if $contact_email OR $contact_phone} + + + + {/if} + {if $is_deductible AND $price} + + + + {/if} + {/if} + + {if $customPre} + + + + {foreach from=$customPre item=customValue key=customName} + {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields} + + + + + {/if} + {/foreach} + {/if} + + {if $customPost} + + + + {foreach from=$customPost item=customValue key=customName} + {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields} + + + + + {/if} + {/foreach} + {/if} + +
+ {ts}Contribution Information{/ts} +
+ {* FIXME: style this table so that it looks like the text version (justification, etc.) *} + + + + + + + {foreach from=$value item=line} + + + + + + + {/foreach} +
{ts}Item{/ts}{ts}Qty{/ts}{ts}Each{/ts}{ts}Total{/ts}
+ {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}
{$line.description|truncate:30:"..."}
{/if} +
+ {$line.qty} + + {$line.unit_price|crmMoney:$currency} + + {$line.line_total|crmMoney:$currency} +
+
+ {ts}Total Amount{/ts} + + {$amount|crmMoney:$currency} +
+ {ts}Amount{/ts} + + {$amount|crmMoney:$currency} {if $amount_level} - {$amount_level}{/if} +
+ {ts}Date{/ts} + + {$receive_date|crmDate} +
+ {ts}Transaction #{/ts} + + {$trxn_id} +
+ {ts 1=$cancelSubscriptionUrl}This is a recurring contribution. You can cancel future contributions by visiting this web page.{/ts} +
+ {ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by visiting this web page.{/ts} +
+ {ts 1=$updateSubscriptionUrl}You can update recurring contribution amount or change the number of installments for this recurring contribution by visiting this web page.{/ts} +
+ {$honor_type} +
+ {$honor_prefix} {$honor_first_name} {$honor_last_name} +
+ {ts}Honoree Email{/ts} + + {$honor_email} +
+ {ts}Personal Campaign Page{/ts} +
+ {ts}Display In Honor Roll{/ts} + + {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if} +
+ {ts}Nickname{/ts} + + {$pcp_roll_nickname} +
+ {ts}Personal Note{/ts} + + {$pcp_personal_note} +
+ {$onBehalfProfile_grouptitle} +
+ {$onBehalfName} + + {$onBehalfValue} +
+ {capture assign=contributionUrl}{crmURL p='civicrm/contribute/transact' q="reset=1&id=`$contributionPageId`" a=true fe=1 h=1}{/capture} + {include file="CRM/common/SocialNetwork.tpl" emailMode=true url=$contributionUrl title=$title pageURL=$contributionUrl} +
+ {ts}Registered Email{/ts} +
+ {$email} +
+ {ts}Billing Name and Address{/ts} +
+ {$billingName}
+ {$address|nl2br}
+ {$email} +
+ {ts}Credit Card Information{/ts} +
+ {$credit_card_type}
+ {$credit_card_number}
+ {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+
+ {ts}Premium Information{/ts} +
+ {$product_name} +
+ {ts}Option{/ts} + + {$option} +
+ {ts}SKU{/ts} + + {$sku} +
+ {ts}Start Date{/ts} + + {$start_date|crmDate} +
+ {ts}End Date{/ts} + + {$end_date|crmDate} +
+

{ts}For information about this premium, contact:{/ts}

+ {if $contact_email} +

{$contact_email}

+ {/if} + {if $contact_phone} +

{$contact_phone}

+ {/if} +
+

{ts 1=$price|crmMoney:$currency}The value of this premium is %1. This may affect the amount of the tax deduction you can claim. Consult your tax advisor for more information.{/ts}

+
+ {$customPre_grouptitle} +
+ {$customName} + + {$customValue} +
+ {$customPost_grouptitle} +
+ {$customName} + + {$customValue} +
+
+ + + diff --git a/CRM/Upgrade/4.3.beta3.msg_template/message_templates/contribution_online_receipt_text.tpl b/CRM/Upgrade/4.3.beta3.msg_template/message_templates/contribution_online_receipt_text.tpl new file mode 100644 index 0000000000..ae4f6a5d4c --- /dev/null +++ b/CRM/Upgrade/4.3.beta3.msg_template/message_templates/contribution_online_receipt_text.tpl @@ -0,0 +1,181 @@ +{if $receipt_text} +{$receipt_text} +{/if} +{if $is_pay_later} + +=========================================================== +{$pay_later_receipt} +=========================================================== +{else} + +{ts}Please print this receipt for your records.{/ts} +{/if} + +{if $amount} +=========================================================== +{ts}Contribution Information{/ts} + +=========================================================== +{if $lineItem and $priceSetID and !$is_quick_config} +{foreach from=$lineItem item=value key=priceset} +--------------------------------------------------------- +{capture assign=ts_item}{ts}Item{/ts}{/capture} +{capture assign=ts_qty}{ts}Qty{/ts}{/capture} +{capture assign=ts_each}{ts}Each{/ts}{/capture} +{capture assign=ts_total}{ts}Total{/ts}{/capture} +{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"} +---------------------------------------------------------- +{foreach from=$value item=line} +{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {$line.line_total|crmMoney:$currency|string_format:"%10s"} +{/foreach} +{/foreach} + +{ts}Total Amount{/ts}: {$amount|crmMoney:$currency} +{else} +{ts}Amount{/ts}: {$amount|crmMoney:$currency} {if $amount_level } - {$amount_level} {/if} +{/if} +{/if} +{if $receive_date} + +{ts}Date{/ts}: {$receive_date|crmDate} +{/if} +{if $is_monetary and $trxn_id} +{ts}Transaction #{/ts}: {$trxn_id} +{/if} + +{if $is_recur and ($contributeMode eq 'notify' or $contributeMode eq 'directIPN')} +{ts}This is a recurring contribution. You can cancel future contributions at:{/ts} + +{$cancelSubscriptionUrl} + +{if $updateSubscriptionBillingUrl} +{ts}You can update billing details for this recurring contribution at:{/ts} + +{$updateSubscriptionBillingUrl} + +{/if} +{ts}You can update recurring contribution amount or change the number of installments for this recurring contribution at:{/ts} + +{$updateSubscriptionUrl} + +{/if} + +{if $honor_block_is_active } +=========================================================== +{$honor_type} +=========================================================== +{$honor_prefix} {$honor_first_name} {$honor_last_name} +{if $honor_email} +{ts}Honoree Email{/ts}: {$honor_email} +{/if} + +{/if} +{if $pcpBlock} +=========================================================== +{ts}Personal Campaign Page{/ts} + +=========================================================== +{ts}Display In Honor Roll{/ts}: {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if} + +{if $pcp_roll_nickname}{ts}Nickname{/ts}: {$pcp_roll_nickname}{/if} + +{if $pcp_personal_note}{ts}Personal Note{/ts}: {$pcp_personal_note}{/if} + +{/if} +{if $onBehalfProfile} +=========================================================== +{ts}On Behalf Of{/ts} + +=========================================================== +{foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName} +{$onBehalfName}: {$onBehalfValue} +{/foreach} +{/if} + +{if !( $contributeMode eq 'notify' OR $contributeMode eq 'directIPN' ) and $is_monetary} +{if $is_pay_later} +=========================================================== +{ts}Registered Email{/ts} + +=========================================================== +{$email} +{elseif $amount GT 0} +=========================================================== +{ts}Billing Name and Address{/ts} + +=========================================================== +{$billingName} +{$address} + +{$email} +{/if} {* End ! is_pay_later condition. *} +{/if} +{if $contributeMode eq 'direct' AND !$is_pay_later AND $amount GT 0} + +=========================================================== +{ts}Credit Card Information{/ts} + +=========================================================== +{$credit_card_type} +{$credit_card_number} +{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate} +{/if} + +{if $selectPremium } +=========================================================== +{ts}Premium Information{/ts} + +=========================================================== +{$product_name} +{if $option} +{ts}Option{/ts}: {$option} +{/if} +{if $sku} +{ts}SKU{/ts}: {$sku} +{/if} +{if $start_date} +{ts}Start Date{/ts}: {$start_date|crmDate} +{/if} +{if $end_date} +{ts}End Date{/ts}: {$end_date|crmDate} +{/if} +{if $contact_email OR $contact_phone} + +{ts}For information about this premium, contact:{/ts} + +{if $contact_email} + {$contact_email} +{/if} +{if $contact_phone} + {$contact_phone} +{/if} +{/if} +{if $is_deductible AND $price} + +{ts 1=$price|crmMoney:$currency}The value of this premium is %1. This may affect the amount of the tax deduction you can claim. Consult your tax advisor for more information.{/ts}{/if} +{/if} + +{if $customPre} +=========================================================== +{$customPre_grouptitle} + +=========================================================== +{foreach from=$customPre item=customValue key=customName} +{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} + {$customName}: {$customValue} +{/if} +{/foreach} +{/if} + + +{if $customPost} +=========================================================== +{$customPost_grouptitle} + +=========================================================== +{foreach from=$customPost item=customValue key=customName} +{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields} + {$customName}: {$customValue} +{/if} +{/foreach} +{/if} diff --git a/CRM/Upgrade/Incremental/sql/4.3.beta3.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.3.beta3.mysql.tpl index 71d038b5bb..2911265522 100644 --- a/CRM/Upgrade/Incremental/sql/4.3.beta3.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.3.beta3.mysql.tpl @@ -1,3 +1,4 @@ +{include file='../CRM/Upgrade/4.3.beta3.msg_template/civicrm_msg_template.tpl'} -- CRM-12077 DELETE cog, cov FROM `civicrm_option_group` cog LEFT JOIN civicrm_option_value cov ON cov.option_group_id = cog.id diff --git a/xml/templates/message_templates/contribution_online_receipt_html.tpl b/xml/templates/message_templates/contribution_online_receipt_html.tpl index 464543bcb1..976c24ad46 100644 --- a/xml/templates/message_templates/contribution_online_receipt_html.tpl +++ b/xml/templates/message_templates/contribution_online_receipt_html.tpl @@ -131,11 +131,13 @@ {ts 1=$cancelSubscriptionUrl}This is a recurring contribution. You can cancel future contributions by visiting this web page.{/ts} - - - - {ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by visiting this web page.{/ts} - + {if $updateSubscriptionBillingUrl} + + + + {ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by visiting this web page.{/ts} + + {/if} diff --git a/xml/templates/message_templates/contribution_online_receipt_text.tpl b/xml/templates/message_templates/contribution_online_receipt_text.tpl index bcd6e97283..ae4f6a5d4c 100644 --- a/xml/templates/message_templates/contribution_online_receipt_text.tpl +++ b/xml/templates/message_templates/contribution_online_receipt_text.tpl @@ -48,10 +48,12 @@ {$cancelSubscriptionUrl} +{if $updateSubscriptionBillingUrl} {ts}You can update billing details for this recurring contribution at:{/ts} {$updateSubscriptionBillingUrl} +{/if} {ts}You can update recurring contribution amount or change the number of installments for this recurring contribution at:{/ts} {$updateSubscriptionUrl} -- 2.25.1