Commit 060625d6 authored by yashodha's avatar yashodha

CRM-18508: Display State/Province in event address in registration emails (handled upgrade as well)

----------------------------------------
* CRM-18508: State/Province not shown in Event Confirmation Emails
  https://issues.civicrm.org/jira/browse/CRM-18508
parent c8564cf3
{php}
$dir = SMARTY_DIR . '/../../CRM/Upgrade/4.7.11.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}
<!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}
<p>Dear {contact.display_name},</p>
{if $is_pay_later}
<p>
This is being sent to you as an acknowledgement that you have registered one or more members for the following workshop, event or purchase. Please note, however, that the status of your payment is pending, and the registration for this event will not be completed until your payment is received.
</p>
{else}
<p>
This is being sent to you as a {if $is_refund}confirmation of refund{else}receipt of payment made{/if} for the following workshop, event registration or purchase.
</p>
{/if}
{if $is_pay_later}
<p>{$pay_later_receipt}</p>
{/if}
<p>Your order number is #{$transaction_id}. Please print this confirmation for your records.{if $line_items && !$is_refund} Information about the workshops will be sent separately to each participant.{/if}
Here's a summary of your transaction placed on {$transaction_date|date_format:"%D %I:%M %p %Z"}:</p>
{if $billing_name}
<table class="billing-info">
<tr>
<th style="text-align: left;">
{ts}Billing Name and Address{/ts}
</th>
</tr>
<tr>
<td>
{$billing_name}<br />
{$billing_street_address}<br />
{$billing_city}, {$billing_state} {$billing_postal_code}<br/>
<br/>
{$email}
</td>
</tr>
</table>
{/if}
{if $credit_card_type}
<p>&nbsp;</p>
<table class="billing-info">
<tr>
<th style="text-align: left;">
{ts}Credit Card Information{/ts}
</th>
</tr>
<tr>
<td>
{$credit_card_type}<br />
{$credit_card_number}<br />
{ts}Expires{/ts}: {$credit_card_exp_date.M}/{$credit_card_exp_date.Y}
</td>
</tr>
</table>
{/if}
{if $source}
<p>&nbsp;</p>
{$source}
{/if}
<p>&nbsp;</p>
<table width="600">
<thead>
<tr>
{if $line_items}
<th style="text-align: left;">
Event
</th>
<th style="text-align: left;">
Participants
</th>
{/if}
<th style="text-align: left;">
Price
</th>
<th style="text-align: left;">
Total
</th>
</tr>
</thead>
<tbody>
{foreach from=$line_items item=line_item}
<tr>
<td style="width: 220px">
{$line_item.event->title} ({$line_item.event->start_date|date_format:"%D"})<br />
{if $line_item.event->is_show_location}
{$line_item.location.address.1.display|nl2br}
{/if}{*End of isShowLocation condition*}<br /><br />
{$line_item.event->start_date|date_format:"%D %I:%M %p"} - {$line_item.event->end_date|date_format:"%I:%M %p"}
</td>
<td style="width: 180px">
{$line_item.num_participants}
{if $line_item.num_participants > 0}
<div class="participants" style="padding-left: 10px;">
{foreach from=$line_item.participants item=participant}
{$participant.display_name}<br />
{/foreach}
</div>
{/if}
{if $line_item.num_waiting_participants > 0}
Waitlisted:<br/>
<div class="participants" style="padding-left: 10px;">
{foreach from=$line_item.waiting_participants item=participant}
{$participant.display_name}<br />
{/foreach}
</div>
{/if}
</td>
<td style="width: 100px">
{$line_item.cost|crmMoney:$currency|string_format:"%10s"}
</td>
<td style="width: 100px">
&nbsp;{$line_item.amount|crmMoney:$currency|string_format:"%10s"}
</td>
</tr>
{/foreach}
</tbody>
<tfoot>
{if $discounts}
<tr>
<td>
</td>
<td>
</td>
<td>
Subtotal:
</td>
<td>
&nbsp;{$sub_total|crmMoney:$currency|string_format:"%10s"}
</td>
</tr>
{foreach from=$discounts key=myId item=i}
<tr>
<td>
{$i.title}
</td>
<td>
</td>
<td>
</td>
<td>
-{$i.amount}
</td>
</tr>
{/foreach}
{/if}
<tr>
{if $line_items}
<td>
</td>
<td>
</td>
{/if}
<td>
<strong>Total:</strong>
</td>
<td>
<strong>&nbsp;{$total|crmMoney:$currency|string_format:"%10s"}</strong>
</td>
</tr>
</tfoot>
</table>
If you have questions about the status of your registration or purchase please feel free to contact us.
</body>
</html>
Dear {contact.display_name},
{if $is_pay_later}
This is being sent to you as an acknowledgement that you have registered one or more members for the following workshop, event or purchase. Please note, however, that the status of your payment is pending, and the registration for this event will not be completed until your payment is received.
{else}
This is being sent to you as a {if $is_refund}confirmation of refund{else}receipt of payment made{/if} for the following workshop, event registration or purchase.
{/if}
{if $is_pay_later}
{$pay_later_receipt}
{/if}
Your order number is #{$transaction_id}. Please print this confirmation for your records.{if $line_items && !$is_refund} Information about the workshops will be sent separately to each participant.{/if}
Here's a summary of your transaction placed on {$transaction_date|date_format:"%D %I:%M %p %Z"}:
{if $billing_name}
===========================================================
{ts}Billing Name and Address{/ts}
===========================================================
{$billing_name}
{$billing_street_address}
{$billing_city}, {$billing_state} {$billing_postal_code}
{$email}
{/if}
{if $source}
{$source}
{/if}
{foreach from=$line_items item=line_item}
{$line_item.event->title} ({$line_item.event->start_date|date_format:"%D"})
{if $line_item.event->is_show_location}
{$line_item.location.address.1.display|strip_tags:false}
{/if}{*End of isShowLocation condition*}
{$line_item.event->start_date|date_format:"%D %I:%M %p"} - {$line_item.event->end_date|date_format:"%I:%M %p"}
Quantity: {$line_item.num_participants}
{if $line_item.num_participants > 0}
{foreach from=$line_item.participants item=participant}
{$participant.display_name}
{/foreach}
{/if}
{if $line_item.num_waiting_participants > 0}
Waitlisted:
{foreach from=$line_item.waiting_participants item=participant}
{$participant.display_name}
{/foreach}
{/if}
Cost: {$line_item.cost|crmMoney:$currency|string_format:"%10s"}
Total For This Event: {$line_item.amount|crmMoney:$currency|string_format:"%10s"}
{/foreach}
{if $discounts}
Subtotal: {$sub_total|crmMoney:$currency|string_format:"%10s"}
--------------------------------------
Discounts
{foreach from=$discounts key=myId item=i}
{$i.title}: -{$i.amount|crmMoney:$currency|string_format:"%10s"}
{/foreach}
{/if}
======================================
Total: {$total|crmMoney:$currency|string_format:"%10s"}
{if $credit_card_type}
===========================================================
{ts}Payment Information{/ts}
===========================================================
{$credit_card_type}
{$credit_card_number}
{ts}Expires{/ts}: {$credit_card_exp_date.M}/{$credit_card_exp_date.Y}
{/if}
If you have questions about the status of your registration or purchase please feel free to contact us.
<!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}
<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>
<p>{ts 1=$contact.display_name}Dear %1{/ts},</p>
<p>{ts}Your Event Registration has been cancelled.{/ts}</p>
</td>
</tr>
<tr>
<td>
<table style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse; width:100%;">
<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>
<tr>
<td {$labelStyle}>
{ts}Participant Role{/ts}:
</td>
<td {$valueStyle}>
{$participant.role}
</td>
</tr>
{if $isShowLocation}
<tr>
<td colspan="2" {$valueStyle}>
{$event.location.address.1.display|nl2br}
</td>
</tr>
{/if}
{if $event.location.phone.1.phone || $event.location.email.1.email}
<tr>
<td colspan="2" {$labelStyle}>
{ts}Event Contacts:{/ts}
</td>
</tr>
{foreach from=$event.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}
</td>
</tr>
{/if}
{/foreach}
{foreach from=$event.location.email item=eventEmail}
{if $eventEmail.email}
<tr>
<td {$labelStyle}>
{ts}Email{/ts}
</td>
<td {$valueStyle}>
{$eventEmail.email}
</td>
</tr>
{/if}
{/foreach}
{/if}
{if $contact.email}
<tr>
<th {$headerStyle}>
{ts}Registered Email{/ts}
</th>
</tr>
<tr>
<td colspan="2" {$valueStyle}>
{$contact.email}
</td>
</tr>
{/if}
{if $register_date}
<tr>
<td {$labelStyle}>
{ts}Registration Date{/ts}
</td>
<td {$valueStyle}>
{$participant.register_date|crmDate}
</td>
</tr>
{/if}
</table>
</td>
</tr>
<tr>
<td>
<p>{ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}</p>
</td>
</tr>
</table>
</center>
</body>
</html>
{ts 1=$contact.display_name}Dear %1{/ts},
{ts}Your Event Registration has been cancelled.{/ts}
===========================================================
{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}
{ts}Participant Role{/ts}: {$participant.role}
{if $isShowLocation}
{$event.location.address.1.display|strip_tags:false}
{/if}{*End of isShowLocation condition*}
{if $event.location.phone.1.phone || $event.location.email.1.email}
{ts}Event Contacts:{/ts}
{foreach from=$event.location.phone item=phone}
{if $phone.phone}
{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if}
{/foreach}
{foreach from=$event.location.email item=eventEmail}
{if $eventEmail.email}
{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach}
{/if}
{if $contact.email}
===========================================================
{ts}Registered Email{/ts}
===========================================================
{$contact.email}
{/if}
{if $register_date}
{ts}Registration Date{/ts}: {$participant.register_date|crmDate}
{/if}
{ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}
<!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}
<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>
<p>{ts 1=$contact.display_name}Dear %1{/ts},</p>
</td>
</tr>
{if !$isAdditional and $participant.id}
<tr>
<th {$headerStyle}>
{ts}Confirm Your Registration{/ts}
</th>
</tr>
<tr>
<td colspan="2" {$valueStyle}>
{capture assign=confirmUrl}{crmURL p='civicrm/event/confirm' q="reset=1&participantId=`$participant.id`&cs=`$checksumValue`" a=true h=0 fe=1}{/capture}
<a href="{$confirmUrl}">Go to a web page where you can confirm your registration online</a>
</td>
</tr>
{/if}
{if $event.allow_selfcancelxfer }
This event allows for self-cancel or transfer
{capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participantID`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
<a href="{$selfService}">{ts}Self service cancel transfer{/ts}</a>
{/if}
<tr>
<td>
<table style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse; width:100%;">
<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 $conference_sessions}
<tr>
<td colspan="2" {$labelStyle}>
{ts}Your schedule:{/ts}
</td>
</tr>
<tr>
<td colspan="2" {$valueStyle}>
{assign var='group_by_day' value='NA'}
{foreach from=$conference_sessions item=session}
{if $session.start_date|date_format:"%Y/%m/%d" != $group_by_day|date_format:"%Y/%m/%d"}
{assign var='group_by_day' value=$session.start_date}
<em>{$group_by_day|date_format:"%m/%d/%Y"}</em><br />
{/if}
{$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}<br />
{if $session.location}&nbsp;&nbsp;&nbsp;&nbsp;{$session.location}<br />{/if}
{/foreach}
</td>
</tr>
{/if}
<tr>
<td {$labelStyle}>
{ts}Participant Role{/ts}:
</td>
<td {$valueStyle}>
{$participant.role}
</td>
</tr>
{if $isShowLocation}
<tr>
<td colspan="2" {$valueStyle}>
{$event.location.address.1.display|nl2br}
</td>
</tr>
{/if}
{if $event.location.phone.1.phone || $event.location.email.1.email}
<tr>
<td colspan="2" {$labelStyle}>
{ts}Event Contacts:{/ts}
</td>
</tr>
{foreach from=$event.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}
</td>
</tr>
{/if}
{/foreach}
{foreach from=$event.location.email item=eventEmail}
{if $eventEmail.email}
<tr>
<td {$labelStyle}>
{ts}Email{/ts}
</td>
<td {$valueStyle}>
{$eventEmail.email}
</td>
</tr>
{/if}
{/foreach}
{/if}
{if $event.is_public}
<tr>
<td colspan="2" {$valueStyle}>
{capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture}
<a href="{$icalFeed}">{ts}Download iCalendar File{/ts}</a>
</td>
</tr>
{/if}
{if $contact.email}
<tr>
<th {$headerStyle}>
{ts}Registered Email{/ts}
</th>
</tr>
<tr>
<td colspan="2" {$valueStyle}>
{$contact.email}
</td>
</tr>
{/if}
{if $register_date}
<tr>
<td {$labelStyle}>
{ts}Registration Date{/ts}
</td>
<td {$valueStyle}>
{$participant.register_date|crmDate}
</td>
</tr>
{/if}
</table>
</td>
</tr>
{if $event.allow_selfcancelxfer }
<tr>
<td colspan="2" {$valueStyle}>
{ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}<br />
{capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
<a href="{$selfService}">{ts}Click here to transfer or cancel your registration.{/ts}</a>
</td>
</tr>
{/if}
<tr>
<td colspan="2" {$valueStyle}>
<p>{ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}</p>
</td>
</tr>
</table>
</center>
</body>
</html>
{ts 1=$contact.display_name}Dear %1{/ts},
{if !$isAdditional and $participant.id}
===========================================================
{ts}Confirm Your Registration{/ts}
===========================================================
{capture assign=confirmUrl}{crmURL p='civicrm/event/confirm' q="reset=1&participantId=`$participant.id`&cs=`$checksumValue`" a=true h=0 fe=1}{/capture}
Click this link to go to a web page where you can confirm your registration online:
{$confirmUrl}
{/if}
{if $event.allow_selfcancelxfer }
{ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}
{capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
{ts}Transfer or cancel your registration:{/ts} {$selfService}
{/if}
===========================================================
{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 $conference_sessions}