Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-8977

Upgrade civiCRM 4.0.4 to 4.0.6 "Database Error Code: You have an error in your SQL syntax..."

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Blocker
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.0.6
    • Fix Version/s: None
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      The returned page:
      Sorry. A non-recoverable error has occurred.
      DB Error: syntax error
      Error Details
      Database Error Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workf' at line 2, 1064
      Additional Details:
      Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )

      [code] => -2
      [message] => DB Error: syntax error
      [mode] => 16
      [debug_info] => SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'contribution_online_receipt';
      SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_html = '<!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="500" 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 $receipt_text}
      <p>{$receipt_text|htmlize}</p>
      {/if}

      {if $is_pay_later}
      <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
      {else}
      <p>{ts}Please print this confirmation for your records.{/ts}</p>
      {/if}

      </td>
      </tr>
      </table>
      <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">

      {if $amount}


      <tr>
      <th {$headerStyle}>
      {ts}Contribution Information{/ts}
      </th>
      </tr>

      {if $lineItem and $priceSetID}

      {foreach from=$lineItem item=value key=priceset}
      <tr>
      <td colspan="2" {$valueStyle}>
      <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
      <tr>
      <th>{ts}Item{/ts}</th>
      <th>{ts}Qty{/ts}</th>
      <th>{ts}Each{/ts}</th>
      <th>{ts}Total{/ts}</th>
      </tr>
      {foreach from=$value item=line}
      <tr>
      <td>
      {if $line.html_type eq \'Text\'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
      </td>
      <td>
      {$line.qty}
      </td>
      <td>
      {$line.unit_price|crmMoney:$currency}
      </td>
      <td>
      {$line.line_total|crmMoney:$currency}
      </td>
      </tr>
      {/foreach}
      </table>
      </td>
      </tr>
      {/foreach}
      <tr>
      <td {$labelStyle}>
      {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney:$currency}
      </td>
      </tr>

      {else}

      <tr>
      <td {$labelStyle}>
      {ts}Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney:$currency} {if $amount_level} - {$amount_level}{/if}
      </td>
      </tr>

      {/if}


      {/if}


      {if $receive_date}
      <tr>
      <td {$labelStyle}>
      {ts}Date{/ts}
      </td>
      <td {$valueStyle}>
      {$receive_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $is_monetary and $trxn_id}
      <tr>
      <td {$labelStyle}>
      {ts}Transaction #{/ts}
      </td>
      <td {$valueStyle}>
      {$trxn_id}
      </td>
      </tr>
      {/if}

      {if $is_recur}
      {if $contributeMode eq \'notify\'}
      <tr>
      <td {$labelStyle}>
      {ts 1=$cancelSubscriptionUrl}This is a recurring contribution. You can modify or cancel future contributions by <a href="%1">logging in to your account</a>.{/ts}
      </td>
      </tr>
      {elseif $contributeMode eq \'directIPN\' and $receiptFromEmail}
      <tr>
      <td {$labelStyle}>
      {ts 1=$receiptFromEmail}This is a recurring contribution. To modify or cancel future contributions please contact us at %1.{/ts}
      </td>
      </tr>
      {/if}
      {/if}

      {if $honor_block_is_active}
      <tr>
      <th {$headerStyle}>
      {$honor_type}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$honor_prefix} {$honor_first_name} {$honor_last_name}
      </td>
      </tr>
      {if $honor_email}
      <tr>
      <td {$labelStyle}>
      {ts}Honoree Email{/ts}
      </td>
      <td {$valueStyle}>
      {$honor_email}
      </td>
      </tr>
      {/if}
      {/if}

      {if $pcpBlock}
      <tr>
      <th {$headerStyle}>
      {ts}Personal Campaign Page{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts}Display In Honor Roll{/ts}
      </td>
      <td {$valueStyle}>
      {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}
      </td>
      </tr>
      {if $pcp_roll_nickname}
      <tr>
      <td {$labelStyle}>
      {ts}Nick Name{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_roll_nickname}
      </td>
      </tr>
      {/if}
      {if $pcp_personal_note}
      <tr>
      <td {$labelStyle}>
      {ts}Personal Note{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_personal_note}
      </td>
      </tr>
      {/if}

      {if $onBehalfProfile}
      <tr>
      <th {$headerStyle}>
      {$onBehalfProfile_grouptitle}
      </th>
      </tr>
      {foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
      <tr>
      <td {$labelStyle}>
      {$onBehalfName}
      </td>
      <td {$valueStyle}>
      {$onBehalfValue}
      </td>
      </tr>
      {/foreach}
      {/if}

      {if ! ($contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\') and $is_monetary}
      {if $is_pay_later}
      <tr>
      <th {$headerStyle}>
      {ts}Registered Email{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$email}
      </td>
      </tr>
      {elseif $amount GT 0}
      <tr>
      <th {$headerStyle}>
      {ts}Billing Name and Address{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$billingName}<br />
      {$address|nl2br}<br />
      {$email}
      </td>
      </tr>
      {/if}
      {/if}

      {if $contributeMode eq \'direct\' AND !$is_pay_later AND $amount GT 0}
      <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}<br />
      </td>
      </tr>
      {/if}

      {if $selectPremium}
      <tr>
      <th {$headerStyle}>
      {ts}Premium Information{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$product_name}
      </td>
      </tr>
      {if $option}
      <tr>
      <td {$labelStyle}>
      {ts}Option{/ts}
      </td>
      <td {$valueStyle}>
      {$option}
      </td>
      </tr>
      {/if}
      {if $sku}
      <tr>
      <td {$labelStyle}>
      {ts}SKU{/ts}
      </td>
      <td {$valueStyle}>
      {$sku}
      </td>
      </tr>
      {/if}
      {if $start_date}
      <tr>
      <td {$labelStyle}>
      {ts}Start Date{/ts}
      </td>
      <td {$valueStyle}>
      {$start_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $end_date}
      <tr>
      <td {$labelStyle}>
      {ts}End Date{/ts}
      </td>
      <td {$valueStyle}>
      {$end_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $contact_email OR $contact_phone}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{ts}For information about this premium, contact:{/ts}</p>
      {if $contact_email}
      <p>{$contact_email}</p>
      {/if}
      {if $contact_phone}
      <p>{$contact_phone}</p>
      {/if}
      </td>
      </tr>
      {/if}
      {if $is_deductible AND $price}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{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}</p>
      </td>
      </tr>
      {/if}

      {if $customPre}
      <tr>
      <th {$headerStyle}>
      {$customPre_grouptitle}
      </th>
      </tr>
      {foreach from=$customPre item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      {if $customPost}
      <tr>
      <th {$headerStyle}>
      {$customPost_grouptitle}
      </th>
      </tr>
      {foreach from=$customPost item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      </table>
      </center>

      </body>
      </html>
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_html = @content));

      SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'event_online_receipt';
      SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_html = '<!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="500" 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 $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
      <p>{$event.confirm_email_text|htmlize}</p>
      {/if}

      {if $isOnWaitlist}
      <p>{ts}You have been added to the WAIT LIST for this event.{/ts}</p>
      {if $isPrimary}
      <p>{ts}If space becomes available you will receive an email with
      a link to a web page where you can complete your registration.{/ts}</p>
      {/if}
      {elseif $isRequireApproval}
      <p>{ts}Your registration has been submitted.{/ts}</p>
      {if $isPrimary}
      <p>{ts}Once your registration has been reviewed, you will receive
      an email with a link to a web page where you can complete the
      registration process.{/ts}</p>
      {/if}
      {elseif $is_pay_later && !$isAmountzero}
      <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
      {else}
      <p>{ts}Please print this confirmation for your records.{/ts}</p>
      {/if}

      </td>
      </tr>
      </table>
      <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">
      <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 neq \'Attendee\' and $defaultRole}
      <tr>
      <td {$labelStyle}>
      {ts}Participant Role{/ts}
      </td>
      <td {$valueStyle}>
      {$event.participant_role}
      </td>
      </tr>
      {/if}

      {if $isShowLocation}
      <tr>
      <td colspan="2" {$valueStyle}>
      {if $location.address.1.name}
      {$location.address.1.name}<br />
      {/if}
      {if $location.address.1.street_address}
      {$location.address.1.street_address}<br />
      {/if}
      {if $location.address.1.supplemental_address_1}
      {$location.address.1.supplemental_address_1}<br />
      {/if}
      {if $location.address.1.supplemental_address_2}
      {$location.address.1.supplemental_address_2}<br />
      {/if}
      {if $location.address.1.city}
      {$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}<br />
      {/if}
      </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}
      </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}
      <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 $email}
      <tr>
      <th {$headerStyle}>
      {ts}Registered Email{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$email}
      </td>
      </tr>
      {/if}


      {if $event.is_monetary}

      <tr>
      <th {$headerStyle}>
      {$event.fee_label}
      </th>
      </tr>

      {if $lineItem}
      {foreach from=$lineItem item=value key=priceset}
      {if $value neq \'skip\'}
      {if $isPrimary}
      {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
      <tr>
      <td colspan="2" {$labelStyle}>
      {ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info}
      </td>
      </tr>
      {/if}
      <tr>
      <td colspan="2" {$valueStyle}>
      <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
      <tr>
      <th>{ts}Item{/ts}</th>
      <th>{ts}Qty{/ts}</th>
      <th>{ts}Each{/ts}</th>
      <th>{ts}Total{/ts}</th>
      {if $pricesetFieldsCount }<th>{ts}Total Participants{/ts}</th>{/if}
      </tr>
      {foreach from=$value item=line}
      <tr>
      <td>
      {if $line.html_type eq \'Text\'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
      </td>
      <td>
      {$line.qty}
      </td>
      <td>
      {$line.unit_price|crmMoney}
      </td>
      <td>
      {$line.line_total|crmMoney}
      </td>
      {if $pricesetFieldsCount }<td>{$line.participant_count}</td> {/if}
      </tr>
      {/foreach}
      </table>
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      {if $amount && !$lineItem}
      {foreach from=$amount item=amnt key=level}
      <tr>
      <td colspan="2" {$valueStyle}>
      {$amnt.amount|crmMoney} {$amnt.label}
      </td>
      </tr>
      {/foreach}
      {/if}

      {if $isPrimary}
      <tr>
      <td {$labelStyle}>
      {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
      </td>
      </tr>
      {if $pricesetFieldsCount }
      <tr>
      <td {$labelStyle}>
      {ts}Total Participants{/ts}</td>
      <td {$valueStyle}>
      {assign var="count" value= 0}
      {foreach from=$lineItem item=pcount}
      {assign var="lineItemCount" value=0}
      {if $pcount neq \'skip\'}
      {foreach from=$pcount item=p_count}
      {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
      {/foreach}
      {if $lineItemCount < 1 }
      {assign var="lineItemCount" value=1}
      {/if}
      {assign var="count" value=$count+$lineItemCount}
      {/if}
      {/foreach}
      {$count}
      </td> </tr>
      {/if}
      {if $is_pay_later}
      <tr>
      <td colspan="2" {$labelStyle}>
      {$pay_later_receipt}
      </td>
      </tr>
      {/if}

      {if $register_date}
      <tr>
      <td {$labelStyle}>
      {ts}Registration Date{/ts}
      </td>
      <td {$valueStyle}>
      {$register_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $receive_date}
      <tr>
      <td {$labelStyle}>
      {ts}Transaction Date{/ts}
      </td>
      <td {$valueStyle}>
      {$receive_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $contributionTypeName}
      <tr>
      <td {$labelStyle}>
      {ts}Contribution Type{/ts}
      </td>
      <td {$valueStyle}>
      {$contributionTypeName}
      </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}

      {if $contributeMode ne \'notify\' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
      <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 and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
      <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} {* End of conditional section for Paid events *}
      {if $customPre} {foreach from=$customPre item=customPr key=i}
      <tr> <th {$headerStyle}>{$customPre_grouptitle.$i}</th></tr>
      {foreach from=$customPr item=customValue key=customName}
      {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>{$customName}</td>
      <td {$valueStyle}>{$customValue}</td>
      </tr>
      {/if}
      {/foreach} {/if}
      {if $customPost} {foreach from=$customPost item=customPos key=j}
      <tr> <th {$headerStyle}>{$customPost_grouptitle.$j}</th></tr>
      {foreach from=$customPos item=customValue key=customName}
      {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>{$customName}</td>
      <td {$valueStyle}>{$customValue}</td>
      </tr>{/if} {/foreach} {/if}
      {if $customProfile} {foreach from=$customProfile.profile item=eachParticipant key=participantID}
      <tr><th {$headerStyle}>{ts 1=$participantID+2}Participant Information - Participant %1{/ts} </th></tr>
      {foreach from=$eachParticipant item=eachProfile key=pid}
      <tr><th {$headerStyle}>{$customProfile.title.$pid}</th></tr>
      {foreach from=$eachProfile item=val key=field}
      <tr>{foreach from=$val item=v key=f}
      <td {$labelStyle}>{$field}</td>
      <td {$valueStyle}>{$v}</td>
      {/foreach}
      </tr>
      {/foreach} {/foreach} {/if}

      {if $customGroup}
      {foreach from=$customGroup item=value key=customName}
      <tr>
      <th {$headerStyle}>
      {$customName}
      </th>
      </tr>
      {foreach from=$value item=v key=n}
      <tr>
      <td {$labelStyle}>
      {$n}
      </td>
      <td {$valueStyle}>
      {$v}
      </td>
      </tr>
      {/foreach}
      {/if}

      </table>
      </center>

      </body>
      </html>
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_html = @content));

      SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'event_online_receipt';
      SELECT @content := msg_text FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_text = '{if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
      {$event.confirm_email_text} {/if}
      {if $isOnWaitlist}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}You have been added to the WAIT LIST for this event.{/ts}
      {if $isPrimary} {ts}If space becomes available you will receive an email with
      a link to a web page where you can complete your registration.{/ts} {/if}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {elseif $isRequireApproval}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Your registration has been submitted.{/ts}
      {if $isPrimary}{ts}Once your registration has been reviewed, you will receive
      an email with a link to a web page where you can complete the
      registration process.{/ts}
      {/if}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {elseif $is_pay_later && !$isAmountzero}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$pay_later_receipt}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {else}
      {ts}Please print this confirmation for your records.{/ts}{/if}


      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Event Information and Location{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$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 $event.participant_role neq \'Attendee\' and $defaultRole} {ts}Participant Role{/ts}: {$event.participant_role} {/if}
      {if $isShowLocation} {if $location.address.1.name}

      {$location.address.1.name}{/if} {if $location.address.1.street_address}{$location.address.1.street_address} {/if} {if $location.address.1.supplemental_address_1}{$location.address.1.supplemental_address_1}{/if} {if $location.address.1.supplemental_address_2}{$location.address.1.supplemental_address_2} {/if} {if $location.address.1.city}{$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if} {/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} {/foreach} {foreach from=$location.email item=eventEmail} {if $eventEmail.email}
      {ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach}{/if}
      {capture assign=icalFeed}{crmURL p=\'civicrm/event/ical\' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture} {ts}Download iCalendar File:{/ts} {$icalFeed} {if $email}

      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Registered Email{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$email}{/if} {if $event.is_monetary} {* This section for Paid events only.*}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$event.fee_label}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {if $lineItem}{foreach from=$lineItem item=value key=priceset}
      {if $value neq \'skip\'} {if $isPrimary} {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *} {ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info}
      {/if} {/if}
      ----------------------------------------------------------{if $pricesetFieldsCount }-------------------{/if}
      {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} {if $pricesetFieldsCount }{capture assign=ts_participant_total}{ts}Total Participants{/ts}{/capture}{/if}
      {$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
      -----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
      {foreach from=$value item=line} {if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture}{/if}{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|string_format:"%10s"} {$line.line_total|crmMoney|string_format:"%10s"}{$ts_participant_count|string_format:"%10s"} {/foreach} {/if}{/foreach} {/if} {if $amount && !$lineItem} {foreach from=$amount item=amnt key=level}{$amnt.amount|crmMoney} {$amnt.label} {/foreach}{/if} {if $isPrimary }
      {ts}Total Amount{/ts}: {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
      {if $pricesetFieldsCount }
      {assign var="count" value= 0}
      {foreach from=$lineItem item=pcount}
      {assign var="lineItemCount" value=0}
      {if $pcount neq \'skip\'}
      {foreach from=$pcount item=p_count}
      {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
      {/foreach}
      {if $lineItemCount < 1 }
      {assign var="lineItemCount" value=1}
      {/if}
      {assign var="count" value=$count+$lineItemCount}
      {/if}
      {/foreach}
      {ts}Total Participants{/ts}: {$count}{/if}
      {if $is_pay_later }

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$pay_later_receipt}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {if $register_date} {ts}Registration Date{/ts}: {$register_date|crmDate} {/if} {if $receive_date}{ts}Transaction Date{/ts}: {$receive_date|crmDate} {/if} {if $contributionTypeName} {ts}Contribution Type{/ts}: {$contributionTypeName} {/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 ne \'notify\' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}

      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Billing Name and Address{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$billingName}
      {$address}{/if}
      {if $contributeMode eq \'direct\' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Credit Card Information{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$credit_card_type}
      {$credit_card_number} {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:\'\'|crmDate} {/if} {/if} {* End of conditional section for Paid events *}

      {if $customPre} {foreach from=$customPre item=customPr key=i}
      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$customPre_grouptitle.$i}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$customPr item=customValue key=customName} {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      {$customName}: {$customValue}{/if} {/foreach} {/if}
      {if $customPost} {foreach from=$customPost item=customPos key=j}
      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$customPost_grouptitle.$j}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$customPos item=customValue key=customName} {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      {$customName}: {$customValue} {/if} {/foreach}{/if} {if $customProfile}
      {foreach from=$customProfile.profile item=eachParticipant key=participantID}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts 1=$participantID+2}Participant Information - Participant %1{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$eachParticipant item=eachProfile key=pid}
      ----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}

      {$customProfile.title.$pid}
      ---------------------------------------------------------{if $pricesetFieldsCount }-------------------{/if}
      {foreach from=$eachProfile item=val key=field} {foreach from=$val item=v key=f}
      {$field}: {$v} {/foreach} {/foreach} {/if} {if $customGroup} {foreach from=$customGroup item=value key=customName}
      =========================================================={if $pricesetFieldsCount }===================={/if}

      {$customName}
      =========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$value item=v key=n}
      {$n}: {$v} {/foreach}{/if}
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_text = @content));

      SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'membership_online_receipt';
      SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_html = '<!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="500" 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 $receipt_text}
      <p>{$receipt_text|htmlize}</p>
      {/if}

      {if $is_pay_later}
      <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
      {else}
      <p>{ts}Please print this confirmation for your records.{/ts}</p>
      {/if}

      </td>
      </tr>
      </table>
      <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">

      {if $membership_assign}
      <tr>
      <th {$headerStyle}>
      {ts}Membership Information{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts}Membership Type{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_name}
      </td>
      </tr>
      {if $mem_start_date}
      <tr>
      <td {$labelStyle}>
      {ts}Membership Start Date{/ts}
      </td>
      <td {$valueStyle}>
      {$mem_start_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $mem_end_date}
      <tr>
      <td {$labelStyle}>
      {ts}Membership End Date{/ts}
      </td>
      <td {$valueStyle}>
      {$mem_end_date|crmDate}
      </td>
      </tr>
      {/if}
      {/if}


      {if $amount}


      <tr>
      <th {$headerStyle}>
      {ts}Membership Fee{/ts}
      </th>
      </tr>

      {if $membership_amount}

      <tr>
      <td {$labelStyle}>
      {ts 1=$membership_name}%1 Membership{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_amount|crmMoney}
      </td>
      </tr>
      {if $amount}
      {if ! $is_separate_payment }
      <tr>
      <td {$labelStyle}>
      {ts}Contribution Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney}
      </td>
      </tr>
      {else}
      <tr>
      <td {$labelStyle}>
      {ts}Additional Contribution{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney}
      </td>
      </tr>
      {/if}
      {/if}
      <tr>
      <td {$labelStyle}>
      {ts}Total{/ts}
      </td>
      <td {$valueStyle}>
      {$amount+$membership_amount|crmMoney}
      </td>
      </tr>

      {elseif $lineItem and $priceSetID}

      {foreach from=$lineItem item=value key=priceset}
      <tr>
      <td colspan="2" {$valueStyle}>
      <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
      <tr>
      <th>{ts}Item{/ts}</th>
      <th>{ts}Qty{/ts}</th>
      <th>{ts}Each{/ts}</th>
      <th>{ts}Total{/ts}</th>
      </tr>
      {foreach from=$value item=line}
      <tr>
      <td>
      {$line.description|truncate:30:"..."}
      </td>
      <td>
      {$line.qty}
      </td>
      <td>
      {$line.unit_price|crmMoney}
      </td>
      <td>
      {$line.line_total|crmMoney}
      </td>
      </tr>
      {/foreach}
      </table>
      </td>
      </tr>
      {/foreach}
      <tr>
      <td {$labelStyle}>
      {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney}
      </td>
      </tr>

      {else}

      <tr>
      <td {$labelStyle}>
      {ts}Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney} {if $amount_level} - {$amount_level}{/if}
      </td>
      </tr>

      {/if}


      {elseif $membership_amount}


      <tr>
      <th {$headerStyle}>
      {ts}Membership Fee{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts 1=$membership_name}%1 Membership{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_amount|crmMoney}
      </td>
      </tr>


      {/if}


      {if $receive_date}
      <tr>
      <td {$labelStyle}>
      {ts}Date{/ts}
      </td>
      <td {$valueStyle}>
      {$receive_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $is_monetary and $trxn_id}
      <tr>
      <td {$labelStyle}>
      {ts}Transaction #{/ts}
      </td>
      <td {$valueStyle}>
      {$trxn_id}
      </td>
      </tr>
      {/if}

      {if $membership_trx_id}
      <tr>
      <td {$labelStyle}>
      {ts}Membership Transaction #{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_trx_id}
      </td>
      </tr>
      {/if}
      {if $is_recur}
      {if $contributeMode eq \'notify\' or $contributeMode eq \'directIPN\'}
      <tr>
      <td {$labelStyle}>
      {ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can modify or cancel the auto-renewal option by <a href="%1">visiting this web page</a>.{/ts}
      </td>
      </tr>
      {/if}
      {/if}

      {if $honor_block_is_active}
      <tr>
      <th {$headerStyle}>
      {$honor_type}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$honor_prefix} {$honor_first_name} {$honor_last_name}
      </td>
      </tr>
      {if $honor_email}
      <tr>
      <td {$labelStyle}>
      {ts}Honoree Email{/ts}
      </td>
      <td {$valueStyle}>
      {$honor_email}
      </td>
      </tr>
      {/if}
      {/if}

      {if $pcpBlock}
      <tr>
      <th {$headerStyle}>
      {ts}Personal Campaign Page{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts}Display In Honor Roll{/ts}
      </td>
      <td {$valueStyle}>
      {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}
      </td>
      </tr>
      {if $pcp_roll_nickname}
      <tr>
      <td {$labelStyle}>
      {ts}Nick Name{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_roll_nickname}
      </td>
      </tr>
      {/if}
      {if $pcp_personal_note}
      <tr>
      <td {$labelStyle}>
      {ts}Personal Note{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_personal_note}
      </td>
      </tr>
      {/if}

      {if $onBehalfProfile}
      <tr>
      <th {$headerStyle}>
      {$onBehalfProfile_grouptitle}
      </th>
      </tr>
      {foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
      <tr>
      <td {$labelStyle}>
      {$onBehalfName}
      </td>
      <td {$valueStyle}>
      {$onBehalfValue}
      </td>
      </tr>
      {/foreach}
      {/if}

      {if ! ($contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\') and $is_monetary}
      {if $is_pay_later}
      <tr>
      <th {$headerStyle}>
      {ts}Registered Email{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$email}
      </td>
      </tr>
      {elseif $amount GT 0 OR $membership_amount GT 0}
      <tr>
      <th {$headerStyle}>
      {ts}Billing Name and Address{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$billingName}<br />
      {$address|nl2br}<br />
      {$email}
      </td>
      </tr>
      {/if}

      {if $contributeMode eq \'direct\' AND !$is_pay_later AND ($amount GT 0 OR $membership_amount GT 0)}
      <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}<br />
      </td>
      </tr>
      {/if}

      {if $selectPremium}
      <tr>
      <th {$headerStyle}>
      {ts}Premium Information{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$product_name}
      </td>
      </tr>
      {if $option}
      <tr>
      <td {$labelStyle}>
      {ts}Option{/ts}
      </td>
      <td {$valueStyle}>
      {$option}
      </td>
      </tr>
      {/if}
      {if $sku}
      <tr>
      <td {$labelStyle}>
      {ts}SKU{/ts}
      </td>
      <td {$valueStyle}>
      {$sku}
      </td>
      </tr>
      {/if}
      {if $start_date}
      <tr>
      <td {$labelStyle}>
      {ts}Start Date{/ts}
      </td>
      <td {$valueStyle}>
      {$start_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $end_date}
      <tr>
      <td {$labelStyle}>
      {ts}End Date{/ts}
      </td>
      <td {$valueStyle}>
      {$end_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $contact_email OR $contact_phone}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{ts}For information about this premium, contact:{/ts}</p>
      {if $contact_email}
      <p>{$contact_email}</p>
      {/if}
      {if $contact_phone}
      <p>{$contact_phone}</p>
      {/if}
      </td>
      </tr>
      {/if}
      {if $is_deductible AND $price}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{ts 1=$price|crmMoney}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}</p>
      </td>
      </tr>
      {/if}

      {if $customPre}
      <tr>
      <th {$headerStyle}>
      {$customPre_grouptitle}
      </th>
      </tr>
      {foreach from=$customPre item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      {if $customPost}
      <tr>
      <th {$headerStyle}>
      {$customPost_grouptitle}
      </th>
      </tr>
      {foreach from=$customPost item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      </table>
      </center>

      </body>
      </html>
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_html = @content));




      CREATE TABLE IF NOT EXISTS civicrm_action_log (
      id int UNSIGNED NOT NULL AUTO_INCREMENT,
      contact_id int UNSIGNED NULL DEFAULT NULL COMMENT 'FK to Contact ID',
      entity_id int UNSIGNED NOT NULL COMMENT 'FK to id of the entity that the action was performed on. Pseudo - FK.',
      entity_table varchar(255) COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant',
      action_schedule_id int UNSIGNED NOT NULL COMMENT 'FK to the action schedule that this action originated from.',
      action_date_time DATETIME NULL DEFAULT NULL COMMENT 'date time that the action was performed on.',
      is_error TINYINT( 4 ) NULL DEFAULT '0' COMMENT 'Was there any error sending the reminder?',
      message TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Description / text in case there was an error encountered.',
      repetition_number INT( 10 ) UNSIGNED NULL COMMENT 'Keeps track of the sequence number of this repetition.',
      PRIMARY KEY ( id ),
      CONSTRAINT FK_civicrm_action_log_contact_id FOREIGN KEY (contact_id) REFERENCES civicrm_contact(id) ON DELETE CASCADE,
      CONSTRAINT FK_civicrm_action_log_action_schedule_id FOREIGN KEY (action_schedule_id) REFERENCES civicrm_action_schedule(id) ON DELETE CASCADE
      ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;



      ALTER TABLE `civicrm_action_log` CHANGE `repetition_number` `repetition_number` INT( 10 ) UNSIGNED NULL COMMENT 'Keeps track of the sequence number of this repetition.';



      UPDATE civicrm_mailing SET domain_id = 1 WHERE domain_id IS NULL;



      DELETE et2.* from civicrm_entity_tag et1
      INNER JOIN civicrm_entity_tag et2 ON et1.entity_table = et2.entity_table AND et1.entity_id = et2.entity_id AND et1.tag_id = et2.tag_id
      WHERE et1.id < et2.id;

      ALTER TABLE civicrm_entity_tag
      DROP INDEX index_entity;

      ALTER TABLE civicrm_entity_tag
      ADD UNIQUE INDEX UI_entity_id_entity_table_tag_id( entity_table, entity_id, tag_id );




      SELECT @report_template_gid := MAX(id) FROM civicrm_option_group WHERE name = 'report_template';

      UPDATE civicrm_option_value SET label = 'Pledge Report (Detail)', description = 'Pledge Report' WHERE option_group_id = @report_template_gid AND value = 'pledge/summary';

      UPDATE civicrm_option_value SET name = 'CRM_Report_Form_Pledge_Detail', value = 'pledge/detail' WHERE option_group_id = @report_template_gid AND value = 'pledge/summary';

      UPDATE civicrm_report_instance SET report_id = 'pledge/detail' WHERE report_id = 'pledge/summary';

      SELECT @weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @report_template_gid;
      SELECT @pledgeCompId := MAX(id) FROM civicrm_component where name = 'CiviPledge';
      INSERT INTO civicrm_option_value
      (option_group_id, label, value, name, weight, description, is_active, component_id) VALUES
      (@report_template_gid, 'Pledge Summary Report', 'pledge/summary', 'CRM_Report_Form_Pledge_Summary', @weight := @weight + 1, 'Pledge Summary Report.', 1, @pledgeCompId);



      UPDATE civicrm_payment_processor
      SET `url_site` = 'https://sec.paymentexpress.com/pxpay/pxpay.aspx'
      WHERE `url_site` = 'https://www.paymentexpress.com/pxpay/pxpay.aspx'
      OR url_site = 'https://sec2.paymentexpress.com/pxpay/pxpay.aspx';

      UPDATE civicrm_payment_processor
      SET `url_site` = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx'
      WHERE `url_site` = 'https://www.paymentexpress.com/pxpay/pxaccess.aspx'
      OR url_site = 'https://sec2.paymentexpress.com/pxpay/pxpay/pxaccess.aspx';

      UPDATE civicrm_payment_processor_type
      SET url_site_default = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx',
      url_site_test_default = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx'
      WHERE name = 'Payment_Express';




      SELECT @option_group_id_languages := MAX(id) FROM civicrm_option_group WHERE name = 'languages';
      SELECT @languages_max_weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_languages;

      UPDATE civicrm_option_value SET label = 'Persian (Iran)' WHERE value = 'fa' AND option_group_id = @option_group_id_languages;

      INSERT INTO civicrm_option_value
      (option_group_id, is_default, is_active, name, value, label, weight)
      VALUES
      (@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @weight := @languages_max_weight + 1),
      (@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @weight := @languages_max_weight + 2);



      ALTER TABLE `civicrm_dashboard` DROP `content`, DROP `created_date`;
      ALTER TABLE `civicrm_dashboard_contact` ADD `content` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL AFTER `weight`, ADD `created_date` DATETIME NULL DEFAULT NULL AFTER `content`; [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workf' at line 2]
      [type] => DB_Error
      [user_info] => SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'contribution_online_receipt';
      SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_html = '<!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="500" 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 $receipt_text}
      <p>{$receipt_text|htmlize}</p>
      {/if}

      {if $is_pay_later}
      <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
      {else}
      <p>{ts}Please print this confirmation for your records.{/ts}</p>
      {/if}

      </td>
      </tr>
      </table>
      <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">

      {if $amount}


      <tr>
      <th {$headerStyle}>
      {ts}Contribution Information{/ts}
      </th>
      </tr>

      {if $lineItem and $priceSetID}

      {foreach from=$lineItem item=value key=priceset}
      <tr>
      <td colspan="2" {$valueStyle}>
      <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
      <tr>
      <th>{ts}Item{/ts}</th>
      <th>{ts}Qty{/ts}</th>
      <th>{ts}Each{/ts}</th>
      <th>{ts}Total{/ts}</th>
      </tr>
      {foreach from=$value item=line}
      <tr>
      <td>
      {if $line.html_type eq \'Text\'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
      </td>
      <td>
      {$line.qty}
      </td>
      <td>
      {$line.unit_price|crmMoney:$currency}
      </td>
      <td>
      {$line.line_total|crmMoney:$currency}
      </td>
      </tr>
      {/foreach}
      </table>
      </td>
      </tr>
      {/foreach}
      <tr>
      <td {$labelStyle}>
      {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney:$currency}
      </td>
      </tr>

      {else}

      <tr>
      <td {$labelStyle}>
      {ts}Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney:$currency} {if $amount_level} - {$amount_level}{/if}
      </td>
      </tr>

      {/if}


      {/if}


      {if $receive_date}
      <tr>
      <td {$labelStyle}>
      {ts}Date{/ts}
      </td>
      <td {$valueStyle}>
      {$receive_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $is_monetary and $trxn_id}
      <tr>
      <td {$labelStyle}>
      {ts}Transaction #{/ts}
      </td>
      <td {$valueStyle}>
      {$trxn_id}
      </td>
      </tr>
      {/if}

      {if $is_recur}
      {if $contributeMode eq \'notify\'}
      <tr>
      <td {$labelStyle}>
      {ts 1=$cancelSubscriptionUrl}This is a recurring contribution. You can modify or cancel future contributions by <a href="%1">logging in to your account</a>.{/ts}
      </td>
      </tr>
      {elseif $contributeMode eq \'directIPN\' and $receiptFromEmail}
      <tr>
      <td {$labelStyle}>
      {ts 1=$receiptFromEmail}This is a recurring contribution. To modify or cancel future contributions please contact us at %1.{/ts}
      </td>
      </tr>
      {/if}
      {/if}

      {if $honor_block_is_active}
      <tr>
      <th {$headerStyle}>
      {$honor_type}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$honor_prefix} {$honor_first_name} {$honor_last_name}
      </td>
      </tr>
      {if $honor_email}
      <tr>
      <td {$labelStyle}>
      {ts}Honoree Email{/ts}
      </td>
      <td {$valueStyle}>
      {$honor_email}
      </td>
      </tr>
      {/if}
      {/if}

      {if $pcpBlock}
      <tr>
      <th {$headerStyle}>
      {ts}Personal Campaign Page{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts}Display In Honor Roll{/ts}
      </td>
      <td {$valueStyle}>
      {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}
      </td>
      </tr>
      {if $pcp_roll_nickname}
      <tr>
      <td {$labelStyle}>
      {ts}Nick Name{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_roll_nickname}
      </td>
      </tr>
      {/if}
      {if $pcp_personal_note}
      <tr>
      <td {$labelStyle}>
      {ts}Personal Note{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_personal_note}
      </td>
      </tr>
      {/if}

      {if $onBehalfProfile}
      <tr>
      <th {$headerStyle}>
      {$onBehalfProfile_grouptitle}
      </th>
      </tr>
      {foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
      <tr>
      <td {$labelStyle}>
      {$onBehalfName}
      </td>
      <td {$valueStyle}>
      {$onBehalfValue}
      </td>
      </tr>
      {/foreach}
      {/if}

      {if ! ($contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\') and $is_monetary}
      {if $is_pay_later}
      <tr>
      <th {$headerStyle}>
      {ts}Registered Email{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$email}
      </td>
      </tr>
      {elseif $amount GT 0}
      <tr>
      <th {$headerStyle}>
      {ts}Billing Name and Address{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$billingName}<br />
      {$address|nl2br}<br />
      {$email}
      </td>
      </tr>
      {/if}
      {/if}

      {if $contributeMode eq \'direct\' AND !$is_pay_later AND $amount GT 0}
      <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}<br />
      </td>
      </tr>
      {/if}

      {if $selectPremium}
      <tr>
      <th {$headerStyle}>
      {ts}Premium Information{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$product_name}
      </td>
      </tr>
      {if $option}
      <tr>
      <td {$labelStyle}>
      {ts}Option{/ts}
      </td>
      <td {$valueStyle}>
      {$option}
      </td>
      </tr>
      {/if}
      {if $sku}
      <tr>
      <td {$labelStyle}>
      {ts}SKU{/ts}
      </td>
      <td {$valueStyle}>
      {$sku}
      </td>
      </tr>
      {/if}
      {if $start_date}
      <tr>
      <td {$labelStyle}>
      {ts}Start Date{/ts}
      </td>
      <td {$valueStyle}>
      {$start_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $end_date}
      <tr>
      <td {$labelStyle}>
      {ts}End Date{/ts}
      </td>
      <td {$valueStyle}>
      {$end_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $contact_email OR $contact_phone}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{ts}For information about this premium, contact:{/ts}</p>
      {if $contact_email}
      <p>{$contact_email}</p>
      {/if}
      {if $contact_phone}
      <p>{$contact_phone}</p>
      {/if}
      </td>
      </tr>
      {/if}
      {if $is_deductible AND $price}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{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}</p>
      </td>
      </tr>
      {/if}

      {if $customPre}
      <tr>
      <th {$headerStyle}>
      {$customPre_grouptitle}
      </th>
      </tr>
      {foreach from=$customPre item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      {if $customPost}
      <tr>
      <th {$headerStyle}>
      {$customPost_grouptitle}
      </th>
      </tr>
      {foreach from=$customPost item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      </table>
      </center>

      </body>
      </html>
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_html = @content));

      SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'event_online_receipt';
      SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_html = '<!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="500" 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 $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
      <p>{$event.confirm_email_text|htmlize}</p>
      {/if}

      {if $isOnWaitlist}
      <p>{ts}You have been added to the WAIT LIST for this event.{/ts}</p>
      {if $isPrimary}
      <p>{ts}If space becomes available you will receive an email with
      a link to a web page where you can complete your registration.{/ts}</p>
      {/if}
      {elseif $isRequireApproval}
      <p>{ts}Your registration has been submitted.{/ts}</p>
      {if $isPrimary}
      <p>{ts}Once your registration has been reviewed, you will receive
      an email with a link to a web page where you can complete the
      registration process.{/ts}</p>
      {/if}
      {elseif $is_pay_later && !$isAmountzero}
      <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
      {else}
      <p>{ts}Please print this confirmation for your records.{/ts}</p>
      {/if}

      </td>
      </tr>
      </table>
      <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">
      <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 neq \'Attendee\' and $defaultRole}
      <tr>
      <td {$labelStyle}>
      {ts}Participant Role{/ts}
      </td>
      <td {$valueStyle}>
      {$event.participant_role}
      </td>
      </tr>
      {/if}

      {if $isShowLocation}
      <tr>
      <td colspan="2" {$valueStyle}>
      {if $location.address.1.name}
      {$location.address.1.name}<br />
      {/if}
      {if $location.address.1.street_address}
      {$location.address.1.street_address}<br />
      {/if}
      {if $location.address.1.supplemental_address_1}
      {$location.address.1.supplemental_address_1}<br />
      {/if}
      {if $location.address.1.supplemental_address_2}
      {$location.address.1.supplemental_address_2}<br />
      {/if}
      {if $location.address.1.city}
      {$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}<br />
      {/if}
      </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}
      </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}
      <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 $email}
      <tr>
      <th {$headerStyle}>
      {ts}Registered Email{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$email}
      </td>
      </tr>
      {/if}


      {if $event.is_monetary}

      <tr>
      <th {$headerStyle}>
      {$event.fee_label}
      </th>
      </tr>

      {if $lineItem}
      {foreach from=$lineItem item=value key=priceset}
      {if $value neq \'skip\'}
      {if $isPrimary}
      {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
      <tr>
      <td colspan="2" {$labelStyle}>
      {ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info}
      </td>
      </tr>
      {/if}
      <tr>
      <td colspan="2" {$valueStyle}>
      <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
      <tr>
      <th>{ts}Item{/ts}</th>
      <th>{ts}Qty{/ts}</th>
      <th>{ts}Each{/ts}</th>
      <th>{ts}Total{/ts}</th>
      {if $pricesetFieldsCount }<th>{ts}Total Participants{/ts}</th>{/if}
      </tr>
      {foreach from=$value item=line}
      <tr>
      <td>
      {if $line.html_type eq \'Text\'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
      </td>
      <td>
      {$line.qty}
      </td>
      <td>
      {$line.unit_price|crmMoney}
      </td>
      <td>
      {$line.line_total|crmMoney}
      </td>
      {if $pricesetFieldsCount }<td>{$line.participant_count}</td> {/if}
      </tr>
      {/foreach}
      </table>
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      {if $amount && !$lineItem}
      {foreach from=$amount item=amnt key=level}
      <tr>
      <td colspan="2" {$valueStyle}>
      {$amnt.amount|crmMoney} {$amnt.label}
      </td>
      </tr>
      {/foreach}
      {/if}

      {if $isPrimary}
      <tr>
      <td {$labelStyle}>
      {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
      </td>
      </tr>
      {if $pricesetFieldsCount }
      <tr>
      <td {$labelStyle}>
      {ts}Total Participants{/ts}</td>
      <td {$valueStyle}>
      {assign var="count" value= 0}
      {foreach from=$lineItem item=pcount}
      {assign var="lineItemCount" value=0}
      {if $pcount neq \'skip\'}
      {foreach from=$pcount item=p_count}
      {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
      {/foreach}
      {if $lineItemCount < 1 }
      {assign var="lineItemCount" value=1}
      {/if}
      {assign var="count" value=$count+$lineItemCount}
      {/if}
      {/foreach}
      {$count}
      </td> </tr>
      {/if}
      {if $is_pay_later}
      <tr>
      <td colspan="2" {$labelStyle}>
      {$pay_later_receipt}
      </td>
      </tr>
      {/if}

      {if $register_date}
      <tr>
      <td {$labelStyle}>
      {ts}Registration Date{/ts}
      </td>
      <td {$valueStyle}>
      {$register_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $receive_date}
      <tr>
      <td {$labelStyle}>
      {ts}Transaction Date{/ts}
      </td>
      <td {$valueStyle}>
      {$receive_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $contributionTypeName}
      <tr>
      <td {$labelStyle}>
      {ts}Contribution Type{/ts}
      </td>
      <td {$valueStyle}>
      {$contributionTypeName}
      </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}

      {if $contributeMode ne \'notify\' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
      <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 and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
      <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} {* End of conditional section for Paid events *}
      {if $customPre} {foreach from=$customPre item=customPr key=i}
      <tr> <th {$headerStyle}>{$customPre_grouptitle.$i}</th></tr>
      {foreach from=$customPr item=customValue key=customName}
      {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>{$customName}</td>
      <td {$valueStyle}>{$customValue}</td>
      </tr>
      {/if}
      {/foreach} {/foreach} {/if}
      {if $customPost} {foreach from=$customPost item=customPos key=j}
      <tr> <th {$headerStyle}>{$customPost_grouptitle.$j}</th></tr>
      {foreach from=$customPos item=customValue key=customName}
      {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>{$customName}</td>
      <td {$valueStyle}>{$customValue}</td>
      </tr>{/if}{/foreach} {/foreach} {/if}
      {if $customProfile} {foreach from=$customProfile.profile item=eachParticipant key=participantID}
      <tr><th {$headerStyle}>{ts 1=$participantID+2}Participant Information - Participant %1{/ts} </th></tr>
      {foreach from=$eachParticipant item=eachProfile key=pid}
      <tr><th {$headerStyle}>{$customProfile.title.$pid}</th></tr>
      {foreach from=$eachProfile item=val key=field}
      <tr>{foreach from=$val item=v key=f}
      <td {$labelStyle}>{$field}</td>
      <td {$valueStyle}>{$v}</td>
      {/foreach}
      </tr>
      {/foreach} {/foreach} {/if}

      {if $customGroup}
      {foreach from=$customGroup item=value key=customName}
      <tr>
      <th {$headerStyle}>
      {$customName}
      </th>
      </tr>
      {foreach from=$value item=v key=n}
      <tr>
      <td {$labelStyle}>
      {$n}
      </td>
      <td {$valueStyle}>
      {$v}
      </td>
      </tr>
      {/foreach}
      {/foreach}
      {/if}

      </table>
      </center>

      </body>
      </html>
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_html = @content));

      SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'event_online_receipt';
      SELECT @content := msg_text FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_text = '{if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}

      {$event.confirm_email_text}

      {/if}
      {if $isOnWaitlist}
      ==========================================================={if $pricesetFieldsCount }===================={/if} {ts}You have been added to the WAIT LIST for this event.{/ts}
      {if $isPrimary}{ts}

      If space becomes available you will receive an email with
      a link to a web page where you can complete your registration.

      {/ts} {/if}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {elseif $isRequireApproval}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Your registration has been submitted.{/ts} {if $isPrimary} {ts}Once your registration has been reviewed, you will receive
      an email with a link to a web page where you can complete the
      registration process.{/ts}
      {/if}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {elseif $is_pay_later && !$isAmountzero}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$pay_later_receipt}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {else}
      {ts}Please print this confirmation for your records.{/ts} {/if}


      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Event Information and Location{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$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 neq \'Attendee\' and $defaultRole} {ts}Participant Role{/ts}: {$event.participant_role}{/if}
      {if $isShowLocation} {if $location.address.1.name}

      {$location.address.1.name} {/if} {if $location.address.1.street_address}{$location.address.1.street_address}{/if} {if $location.address.1.supplemental_address_1}{$location.address.1.supplemental_address_1} {/if} {if $location.address.1.supplemental_address_2}{$location.address.1.supplemental_address_2}{/if} {if $location.address.1.city}{$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}
      {/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} {/foreach} {foreach from=$location.email item=eventEmail} {if $eventEmail.email}
      {ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach} {/if}
      {capture assign=icalFeed}{crmURL p=\'civicrm/event/ical\' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture} {ts}Download iCalendar File:{/ts} {$icalFeed} {if $email}

      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Registered Email{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$email} {/if} {if $event.is_monetary} {* This section for Paid events only.*}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$event.fee_label}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {if $lineItem}{foreach from=$lineItem item=value key=priceset}
      {if $value neq \'skip\'}{if $isPrimary} {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *} {ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info}
      {/if}
      ----------------------------------------------------------{if $pricesetFieldsCount }-------------------{/if}
      {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} {if $pricesetFieldsCount }{capture assign=ts_participant_total}{ts}Total Participants{/ts}{/capture}{/if}
      {$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
      ----------------------------------------------------------{if $pricesetFieldsCount }-------------------{/if}
      {foreach from=$value item=line} {if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture}{/if} {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|string_format:"%10s"} {$line.line_total|crmMoney|string_format:"%10s"}{$ts_participant_count|string_format:"%10s"} {/foreach}{/if} {/foreach} {/if} {if $amount && !$lineItem} {foreach from=$amount item=amnt key=level}{$amnt.amount|crmMoney} {$amnt.label}{/foreach} {/if} {if $isPrimary }
      {ts}Total Amount{/ts}: {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
      {if $pricesetFieldsCount }
      {assign var="count" value= 0}
      {foreach from=$lineItem item=pcount}
      {assign var="lineItemCount" value=0}
      {if $pcount neq \'skip\'}
      {foreach from=$pcount item=p_count}
      {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
      {/foreach}
      {if $lineItemCount < 1 }
      {assign var="lineItemCount" value=1}
      {/if}
      {assign var="count" value=$count+$lineItemCount}
      {/if}
      {/foreach}
      {ts}Total Participants{/ts}: {$count} {/if}
      {if $is_pay_later }

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$pay_later_receipt}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {/if}
      {if $register_date} {ts}Registration Date{/ts}: {$register_date|crmDate}{/if} {if $receive_date} {ts}Transaction Date{/ts}: {$receive_date|crmDate} {/if} {if $contributionTypeName}{ts}Contribution Type{/ts}: {$contributionTypeName} {/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 ne \'notify\' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}

      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Billing Name and Address{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$billingName}
      {$address}{/if}
      {if $contributeMode eq \'direct\' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Credit Card Information{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$credit_card_type}
      {$credit_card_number} {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:\'\'|crmDate}{/if} {/if} {* End of conditional section for Paid events *}

      {if $customPre} {foreach from=$customPre item=customPr key=i}
      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$customPre_grouptitle.$i}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$customPr item=customValue key=customName} {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      {$customName}: {$customValue} {/if} {/foreach}{/if}
      {if $customPost} {foreach from=$customPost item=customPos key=j}
      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$customPost_grouptitle.$j}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$customPos item=customValue key=customName}{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      {$customName}: {$customValue} {/if} {/foreach}{/if} {if $customProfile}
      {foreach from=$customProfile.profile item=eachParticipant key=participantID}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts 1=$participantID+2}Participant Information - Participant %1{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$eachParticipant item=eachProfile key=pid}
      ---------------------------------------------------------{if $pricesetFieldsCount }-------------------{/if}

      {$customProfile.title.$pid}
      ----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
      {foreach from=$eachProfile item=val key=field} {foreach from=$val item=v key=f}
      {$field}: {$v} {/foreach} {/foreach}{/if} {if $customGroup} {foreach from=$customGroup item=value key=customName}
      =========================================================={if $pricesetFieldsCount }===================={/if}

      {$customName}
      =========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$value item=v key=n}
      {$n}: {$v} {/foreach} {/if}
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_text = @content));

      SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'membership_online_receipt';
      SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_html = '<!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="500" 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 $receipt_text}
      <p>{$receipt_text|htmlize}</p>
      {/if}

      {if $is_pay_later}
      <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
      {else}
      <p>{ts}Please print this confirmation for your records.{/ts}</p>
      {/if}

      </td>
      </tr>
      </table>
      <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">

      {if $membership_assign}
      <tr>
      <th {$headerStyle}>
      {ts}Membership Information{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts}Membership Type{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_name}
      </td>
      </tr>
      {if $mem_start_date}
      <tr>
      <td {$labelStyle}>
      {ts}Membership Start Date{/ts}
      </td>
      <td {$valueStyle}>
      {$mem_start_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $mem_end_date}
      <tr>
      <td {$labelStyle}>
      {ts}Membership End Date{/ts}
      </td>
      <td {$valueStyle}>
      {$mem_end_date|crmDate}
      </td>
      </tr>
      {/if}


      {if $amount}


      <tr>
      <th {$headerStyle}>
      {ts}Membership Fee{/ts}
      </th>
      </tr>

      {if $membership_amount}

      <tr>
      <td {$labelStyle}>
      {ts 1=$membership_name}%1 Membership{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_amount|crmMoney}
      </td>
      </tr>
      {if $amount}
      {if ! $is_separate_payment }
      <tr>
      <td {$labelStyle}>
      {ts}Contribution Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney}
      </td>
      </tr>
      {else}
      <tr>
      <td {$labelStyle}>
      {ts}Additional Contribution{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney}
      </td>
      </tr>
      {/if}
      <tr>
      <td {$labelStyle}>
      {ts}Total{/ts}
      </td>
      <td {$valueStyle}>
      {$amount+$membership_amount|crmMoney}
      </td>
      </tr>

      {elseif $lineItem and $priceSetID}

      {foreach from=$lineItem item=value key=priceset}
      <tr>
      <td colspan="2" {$valueStyle}>
      <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
      <tr>
      <th>{ts}Item{/ts}</th>
      <th>{ts}Qty{/ts}</th>
      <th>{ts}Each{/ts}</th>
      <th>{ts}Total{/ts}</th>
      </tr>
      {foreach from=$value item=line}
      <tr>
      <td>
      {$line.description|truncate:30:"..."}
      </td>
      <td>
      {$line.qty}
      </td>
      <td>
      {$line.unit_price|crmMoney}
      </td>
      <td>
      {$line.line_total|crmMoney}
      </td>
      </tr>
      {/foreach}
      </table>
      </td>
      </tr>
      {/foreach}
      <tr>
      <td {$labelStyle}>
      {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney}
      </td>
      </tr>

      {else}

      <tr>
      <td {$labelStyle}>
      {ts}Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney} {if $amount_level} - {$amount_level}{/if}
      </td>
      </tr>

      {/if}


      {elseif $membership_amount}


      <tr>
      <th {$headerStyle}>
      {ts}Membership Fee{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts 1=$membership_name}%1 Membership{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_amount|crmMoney}
      </td>
      </tr>


      {/if}


      {if $receive_date}
      <tr>
      <td {$labelStyle}>
      {ts}Date{/ts}
      </td>
      <td {$valueStyle}>
      {$receive_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $is_monetary and $trxn_id}
      <tr>
      <td {$labelStyle}>
      {ts}Transaction #{/ts}
      </td>
      <td {$valueStyle}>
      {$trxn_id}
      </td>
      </tr>
      {/if}

      {if $membership_trx_id}
      <tr>
      <td {$labelStyle}>
      {ts}Membership Transaction #{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_trx_id}
      </td>
      </tr>
      {/if}
      {if $is_recur}
      {if $contributeMode eq \'notify\' or $contributeMode eq \'directIPN\'}
      <tr>
      <td {$labelStyle}>
      {ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can modify or cancel the auto-renewal option by <a href="%1">visiting this web page</a>.{/ts}
      </td>
      </tr>
      {/if}
      {/if}

      {if $honor_block_is_active}
      <tr>
      <th {$headerStyle}>
      {$honor_type}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$honor_prefix} {$honor_first_name} {$honor_last_name}
      </td>
      </tr>
      {if $honor_email}
      <tr>
      <td {$labelStyle}>
      {ts}Honoree Email{/ts}
      </td>
      <td {$valueStyle}>
      {$honor_email}
      </td>
      </tr>
      {/if}
      {/if}

      {if $pcpBlock}
      <tr>
      <th {$headerStyle}>
      {ts}Personal Campaign Page{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts}Display In Honor Roll{/ts}
      </td>
      <td {$valueStyle}>
      {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}
      </td>
      </tr>
      {if $pcp_roll_nickname}
      <tr>
      <td {$labelStyle}>
      {ts}Nick Name{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_roll_nickname}
      </td>
      </tr>
      {/if}
      {if $pcp_personal_note}
      <tr>
      <td {$labelStyle}>
      {ts}Personal Note{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_personal_note}
      </td>
      </tr>
      {/if}

      {if $onBehalfProfile}
      <tr>
      <th {$headerStyle}>
      {$onBehalfProfile_grouptitle}
      </th>
      </tr>
      {foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
      <tr>
      <td {$labelStyle}>
      {$onBehalfName}
      </td>
      <td {$valueStyle}>
      {$onBehalfValue}
      </td>
      </tr>
      {/foreach}
      {/if}

      {if ! ($contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\') and $is_monetary}
      {if $is_pay_later}
      <tr>
      <th {$headerStyle}>
      {ts}Registered Email{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$email}
      </td>
      </tr>
      {elseif $amount GT 0 OR $membership_amount GT 0}
      <tr>
      <th {$headerStyle}>
      {ts}Billing Name and Address{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$billingName}<br />
      {$address|nl2br}<br />
      {$email}
      </td>
      </tr>
      {/if}

      {if $contributeMode eq \'direct\' AND !$is_pay_later AND ($amount GT 0 OR $membership_amount GT 0)}
      <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}<br />
      </td>
      </tr>
      {/if}

      {if $selectPremium}
      <tr>
      <th {$headerStyle}>
      {ts}Premium Information{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$product_name}
      </td>
      </tr>
      {if $option}
      <tr>
      <td {$labelStyle}>
      {ts}Option{/ts}
      </td>
      <td {$valueStyle}>
      {$option}
      </td>
      </tr>
      {/if}
      {if $sku}
      <tr>
      <td {$labelStyle}>
      {ts}SKU{/ts}
      </td>
      <td {$valueStyle}>
      {$sku}
      </td>
      </tr>
      {/if}
      {if $start_date}
      <tr>
      <td {$labelStyle}>
      {ts}Start Date{/ts}
      </td>
      <td {$valueStyle}>
      {$start_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $end_date}
      <tr>
      <td {$labelStyle}>
      {ts}End Date{/ts}
      </td>
      <td {$valueStyle}>
      {$end_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $contact_email OR $contact_phone}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{ts}For information about this premium, contact:{/ts}</p>
      {if $contact_email}
      <p>{$contact_email}</p>
      {/if}
      {if $contact_phone}
      <p>{$contact_phone}</p>
      {/if}
      </td>
      </tr>
      {/if}
      {if $is_deductible AND $price}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{ts 1=$price|crmMoney}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}</p>
      </td>
      </tr>
      {/if}

      {if $customPre}
      <tr>
      <th {$headerStyle}>
      {$customPre_grouptitle}
      </th>
      </tr>
      {foreach from=$customPre item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      {if $customPost}
      <tr>
      <th {$headerStyle}>
      {$customPost_grouptitle}
      </th>
      </tr>
      {foreach from=$customPost item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      </table>
      </center>

      </body>
      </html>
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_html = @content));




      CREATE TABLE IF NOT EXISTS civicrm_action_log (
      id int UNSIGNED NOT NULL AUTO_INCREMENT,
      contact_id int UNSIGNED NULL DEFAULT NULL COMMENT 'FK to Contact ID',
      entity_id int UNSIGNED NOT NULL COMMENT 'FK to id of the entity that the action was performed on. Pseudo - FK.',
      entity_table varchar(255) COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant',
      action_schedule_id int UNSIGNED NOT NULL COMMENT 'FK to the action schedule that this action originated from.',
      action_date_time DATETIME NULL DEFAULT NULL COMMENT 'date time that the action was performed on.',
      is_error TINYINT( 4 ) NULL DEFAULT '0' COMMENT 'Was there any error sending the reminder?',
      message TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Description / text in case there was an error encountered.',
      repetition_number INT( 10 ) UNSIGNED NULL COMMENT 'Keeps track of the sequence number of this repetition.',
      PRIMARY KEY ( id ),
      CONSTRAINT FK_civicrm_action_log_contact_id FOREIGN KEY (contact_id) REFERENCES civicrm_contact(id) ON DELETE CASCADE,
      CONSTRAINT FK_civicrm_action_log_action_schedule_id FOREIGN KEY (action_schedule_id) REFERENCES civicrm_action_schedule(id) ON DELETE CASCADE
      ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;



      ALTER TABLE `civicrm_action_log` CHANGE `repetition_number` `repetition_number` INT( 10 ) UNSIGNED NULL COMMENT 'Keeps track of the sequence number of this repetition.';



      UPDATE civicrm_mailing SET domain_id = 1 WHERE domain_id IS NULL;



      DELETE et2.* from civicrm_entity_tag et1
      INNER JOIN civicrm_entity_tag et2 ON et1.entity_table = et2.entity_table AND et1.entity_id = et2.entity_id AND et1.tag_id = et2.tag_id
      WHERE et1.id < et2.id;

      ALTER TABLE civicrm_entity_tag
      DROP INDEX index_entity;

      ALTER TABLE civicrm_entity_tag
      ADD UNIQUE INDEX UI_entity_id_entity_table_tag_id( entity_table, entity_id, tag_id );




      SELECT @report_template_gid := MAX(id) FROM civicrm_option_group WHERE name = 'report_template';

      UPDATE civicrm_option_value SET label = 'Pledge Report (Detail)', description = 'Pledge Report' WHERE option_group_id = @report_template_gid AND value = 'pledge/summary';

      UPDATE civicrm_option_value SET name = 'CRM_Report_Form_Pledge_Detail', value = 'pledge/detail' WHERE option_group_id = @report_template_gid AND value = 'pledge/summary';

      UPDATE civicrm_report_instance SET report_id = 'pledge/detail' WHERE report_id = 'pledge/summary';

      SELECT @weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @report_template_gid;
      SELECT @pledgeCompId := MAX(id) FROM civicrm_component where name = 'CiviPledge';
      INSERT INTO civicrm_option_value
      (option_group_id, label, value, name, weight, description, is_active, component_id) VALUES
      (@report_template_gid, 'Pledge Summary Report', 'pledge/summary', 'CRM_Report_Form_Pledge_Summary', @weight := @weight + 1, 'Pledge Summary Report.', 1, @pledgeCompId);



      UPDATE civicrm_payment_processor
      SET `url_site` = 'https://sec.paymentexpress.com/pxpay/pxpay.aspx'
      WHERE `url_site` = 'https://www.paymentexpress.com/pxpay/pxpay.aspx'
      OR url_site = 'https://sec2.paymentexpress.com/pxpay/pxpay.aspx';

      UPDATE civicrm_payment_processor
      SET `url_site` = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx'
      WHERE `url_site` = 'https://www.paymentexpress.com/pxpay/pxaccess.aspx'
      OR url_site = 'https://sec2.paymentexpress.com/pxpay/pxpay/pxaccess.aspx';

      UPDATE civicrm_payment_processor_type
      SET url_site_default = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx',
      url_site_test_default = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx'
      WHERE name = 'Payment_Express';




      SELECT @option_group_id_languages := MAX(id) FROM civicrm_option_group WHERE name = 'languages';
      SELECT @languages_max_weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_languages;

      UPDATE civicrm_option_value SET label = 'Persian (Iran)' WHERE value = 'fa' AND option_group_id = @option_group_id_languages;

      INSERT INTO civicrm_option_value
      (option_group_id, is_default, is_active, name, value, label, weight)
      VALUES
      (@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @weight := @languages_max_weight + 1),
      (@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @weight := @languages_max_weight + 2);



      ALTER TABLE `civicrm_dashboard` DROP `content`, DROP `created_date`;
      ALTER TABLE `civicrm_dashboard_contact` ADD `content` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL AFTER `weight`, ADD `created_date` DATETIME NULL DEFAULT NULL AFTER `content`; [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workf' at line 2]
      [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'contribution_online_receipt';
      SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_html = '<!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="500" 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 $receipt_text}
      <p>{$receipt_text|htmlize}</p>
      {/if}

      {if $is_pay_later}
      <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
      {else}
      <p>{ts}Please print this confirmation for your records.{/ts}</p>
      {/if}

      </td>
      </tr>
      </table>
      <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">

      {if $amount}


      <tr>
      <th {$headerStyle}>
      {ts}Contribution Information{/ts}
      </th>
      </tr>

      {if $lineItem and $priceSetID}

      {foreach from=$lineItem item=value key=priceset}
      <tr>
      <td colspan="2" {$valueStyle}>
      <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
      <tr>
      <th>{ts}Item{/ts}</th>
      <th>{ts}Qty{/ts}</th>
      <th>{ts}Each{/ts}</th>
      <th>{ts}Total{/ts}</th>
      </tr>
      {foreach from=$value item=line}
      <tr>
      <td>
      {if $line.html_type eq \'Text\'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
      </td>
      <td>
      {$line.qty}
      </td>
      <td>
      {$line.unit_price|crmMoney:$currency}
      </td>
      <td>
      {$line.line_total|crmMoney:$currency}
      </td>
      </tr>
      {/foreach}
      </table>
      </td>
      </tr>
      {/foreach}
      <tr>
      <td {$labelStyle}>
      {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney:$currency}
      </td>
      </tr>

      {else}

      <tr>
      <td {$labelStyle}>
      {ts}Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney:$currency} {if $amount_level} - {$amount_level}{/if}
      </td>
      </tr>

      {/if}


      {if $receive_date}
      <tr>
      <td {$labelStyle}>
      {ts}Date{/ts}
      </td>
      <td {$valueStyle}>
      {$receive_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $is_monetary and $trxn_id}
      <tr>
      <td {$labelStyle}>
      {ts}Transaction #{/ts}
      </td>
      <td {$valueStyle}>
      {$trxn_id}
      </td>
      </tr>
      {/if}

      {if $is_recur}
      {if $contributeMode eq \'notify\'}
      <tr>
      <td {$labelStyle}>
      {ts 1=$cancelSubscriptionUrl}This is a recurring contribution. You can modify or cancel future contributions by <a href="%1">logging in to your account</a>.{/ts}
      </td>
      </tr>
      {elseif $contributeMode eq \'directIPN\' and $receiptFromEmail}
      <tr>
      <td {$labelStyle}>
      {ts 1=$receiptFromEmail}This is a recurring contribution. To modify or cancel future contributions please contact us at %1.{/ts}
      </td>
      </tr>
      {/if}

      {if $honor_block_is_active}
      <tr>
      <th {$headerStyle}>
      {$honor_type}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$honor_prefix} {$honor_first_name} {$honor_last_name}
      </td>
      </tr>
      {if $honor_email}
      <tr>
      <td {$labelStyle}>
      {ts}Honoree Email{/ts}
      </td>
      <td {$valueStyle}>
      {$honor_email}
      </td>
      </tr>
      {/if}

      {if $pcpBlock}
      <tr>
      <th {$headerStyle}>
      {ts}Personal Campaign Page{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts}Display In Honor Roll{/ts}
      </td>
      <td {$valueStyle}>
      {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}
      </td>
      </tr>
      {if $pcp_roll_nickname}
      <tr>
      <td {$labelStyle}>
      {ts}Nick Name{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_roll_nickname}
      </td>
      </tr>
      {/if}
      {if $pcp_personal_note}
      <tr>
      <td {$labelStyle}>
      {ts}Personal Note{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_personal_note}
      </td>
      </tr>
      {/if}

      {if $onBehalfProfile}
      <tr>
      <th {$headerStyle}>
      {$onBehalfProfile_grouptitle}
      </th>
      </tr>
      {foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
      <tr>
      <td {$labelStyle}>
      {$onBehalfName}
      </td>
      <td {$valueStyle}>
      {$onBehalfValue}
      </td>
      </tr>
      {/foreach}
      {/if}

      {if ! ($contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\') and $is_monetary}
      {if $is_pay_later}
      <tr>
      <th {$headerStyle}>
      {ts}Registered Email{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$email}
      </td>
      </tr>
      {elseif $amount GT 0}
      <tr>
      <th {$headerStyle}>
      {ts}Billing Name and Address{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$billingName}<br />
      {$address|nl2br}<br />
      {$email}
      </td>
      </tr>
      {/if}
      {/if}

      {if $contributeMode eq \'direct\' AND !$is_pay_later AND $amount GT 0}
      <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}<br />
      </td>
      </tr>
      {/if}

      {if $selectPremium}
      <tr>
      <th {$headerStyle}>
      {ts}Premium Information{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$product_name}
      </td>
      </tr>
      {if $option}
      <tr>
      <td {$labelStyle}>
      {ts}Option{/ts}
      </td>
      <td {$valueStyle}>
      {$option}
      </td>
      </tr>
      {/if}
      {if $sku}
      <tr>
      <td {$labelStyle}>
      {ts}SKU{/ts}
      </td>
      <td {$valueStyle}>
      {$sku}
      </td>
      </tr>
      {/if}
      {if $start_date}
      <tr>
      <td {$labelStyle}>
      {ts}Start Date{/ts}
      </td>
      <td {$valueStyle}>
      {$start_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $end_date}
      <tr>
      <td {$labelStyle}>
      {ts}End Date{/ts}
      </td>
      <td {$valueStyle}>
      {$end_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $contact_email OR $contact_phone}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{ts}For information about this premium, contact:{/ts}</p>
      {if $contact_email}
      <p>{$contact_email}</p>
      {/if}
      {if $contact_phone}
      <p>{$contact_phone}</p>
      {/if}
      </td>
      </tr>
      {/if}
      {if $is_deductible AND $price}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{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}</p>
      </td>
      </tr>
      {/if}

      {if $customPre}
      <tr>
      <th {$headerStyle}>
      {$customPre_grouptitle}
      </th>
      </tr>
      {foreach from=$customPre item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      {if $customPost}
      <tr>
      <th {$headerStyle}>
      {$customPost_grouptitle}
      </th>
      </tr>
      {foreach from=$customPost item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      </table>
      </center>

      </body>
      </html>
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_html = @content));

      SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'event_online_receipt';
      SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_html = '<!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="500" 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 $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
      <p>{$event.confirm_email_text|htmlize}</p>
      {/if}

      {if $isOnWaitlist}
      <p>{ts}You have been added to the WAIT LIST for this event.{/ts}</p>
      {if $isPrimary}
      <p>{ts}If space becomes available you will receive an email with
      a link to a web page where you can complete your registration.{/ts}</p>
      {/if}
      {elseif $isRequireApproval}
      <p>{ts}Your registration has been submitted.{/ts}</p>
      {if $isPrimary}
      <p>{ts}Once your registration has been reviewed, you will receive
      an email with a link to a web page where you can complete the
      registration process.{/ts}</p>
      {/if}
      {elseif $is_pay_later && !$isAmountzero}
      <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
      {else}
      <p>{ts}Please print this confirmation for your records.{/ts}</p>
      {/if}

      </td>
      </tr>
      </table>
      <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">
      <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}
      </td>
      </tr>

      {if $event.participant_role neq \'Attendee\' and $defaultRole}
      <tr>
      <td {$labelStyle}>
      {ts}Participant Role{/ts}
      </td>
      <td {$valueStyle}>
      {$event.participant_role}
      </td>
      </tr>
      {/if}

      {if $isShowLocation}
      <tr>
      <td colspan="2" {$valueStyle}>
      {if $location.address.1.name}
      {$location.address.1.name}<br />
      {/if}
      {if $location.address.1.street_address}
      {$location.address.1.street_address}<br />
      {/if}
      {if $location.address.1.supplemental_address_1}
      {$location.address.1.supplemental_address_1}<br />
      {/if}
      {if $location.address.1.supplemental_address_2}
      {$location.address.1.supplemental_address_2}<br />
      {/if}
      {if $location.address.1.city}
      {$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}<br />
      {/if}
      </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}
      </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}
      <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 $email}
      <tr>
      <th {$headerStyle}>
      {ts}Registered Email{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$email}
      </td>
      </tr>
      {/if}


      {if $event.is_monetary}

      <tr>
      <th {$headerStyle}>
      {$event.fee_label}
      </th>
      </tr>

      {if $lineItem}
      {foreach from=$lineItem item=value key=priceset}
      {if $value neq \'skip\'}
      {if $isPrimary}
      {if $lineItem|@count GT 1}

      {* Header for multi participant registration cases. *}
      <tr>
      <td colspan="2" {$labelStyle}>

      {ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info}
      </td>
      </tr>
      {/if}
      <tr>
      <td colspan="2" {$valueStyle}>
      <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
      <tr>
      <th>{ts}Item{/ts}</th>
      <th>{ts}Qty{/ts}</th>
      <th>{ts}Each{/ts}</th>
      <th>{ts}Total{/ts}</th>
      {if $pricesetFieldsCount }<th>{ts}Total Participants{/ts}</th>{/if}
      </tr>
      {foreach from=$value item=line}
      <tr>
      <td>
      {if $line.html_type eq \'Text\'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
      </td>
      <td>
      {$line.qty}
      </td>
      <td>
      {$line.unit_price|crmMoney}
      </td>
      <td>
      {$line.line_total|crmMoney}
      </td>
      {if $pricesetFieldsCount }<td>{$line.participant_count}</td> {/if}
      </tr>
      {/foreach}
      </table>
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      {if $amount && !$lineItem}
      {foreach from=$amount item=amnt key=level}
      <tr>
      <td colspan="2" {$valueStyle}>
      {$amnt.amount|crmMoney} {$amnt.label}
      </td>
      </tr>
      {/foreach}
      {/if}

      {if $isPrimary}
      <tr>
      <td {$labelStyle}>
      {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
      </td>
      </tr>
      {if $pricesetFieldsCount }
      <tr>
      <td {$labelStyle}>
      {ts}Total Participants{/ts}</td>
      <td {$valueStyle}>
      {assign var="count" value= 0}
      {foreach from=$lineItem item=pcount}
      {assign var="lineItemCount" value=0}
      {if $pcount neq \'skip\'}
      {foreach from=$pcount item=p_count}
      {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
      {/foreach}
      {if $lineItemCount < 1 }
      {assign var="lineItemCount" value=1}
      {/if}
      {assign var="count" value=$count+$lineItemCount}
      {/if}
      {/foreach}
      {$count}
      </td> </tr>
      {/if}
      {if $is_pay_later}
      <tr>
      <td colspan="2" {$labelStyle}>
      {$pay_later_receipt}
      </td>
      </tr>
      {/if}

      {if $register_date}
      <tr>
      <td {$labelStyle}>
      {ts}Registration Date{/ts}
      </td>
      <td {$valueStyle}>
      {$register_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $receive_date}
      <tr>
      <td {$labelStyle}>
      {ts}Transaction Date{/ts}
      </td>
      <td {$valueStyle}>
      {$receive_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $contributionTypeName}
      <tr>
      <td {$labelStyle}>
      {ts}Contribution Type{/ts}
      </td>
      <td {$valueStyle}>
      {$contributionTypeName}
      </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}

      {if $contributeMode ne \'notify\' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
      <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 and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
      <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} {* End of conditional section for Paid events *}
      {if $customPre} {foreach from=$customPre item=customPr key=i}
      <tr> <th {$headerStyle}>{$customPre_grouptitle.$i}</th></tr>
      {foreach from=$customPr item=customValue key=customName}
      {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>{$customName}</td>
      <td {$valueStyle}>{$customValue}</td>
      </tr>
      {/if}
      {/foreach}{/if}
      {if $customPost} {foreach from=$customPost item=customPos key=j}
      <tr> <th {$headerStyle}>{$customPost_grouptitle.$j}</th></tr>
      {foreach from=$customPos item=customValue key=customName}
      {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>{$customName}</td>
      <td {$valueStyle}>{$customValue}</td>
      </tr> {/if} {/foreach}{/if}
      {if $customProfile} {foreach from=$customProfile.profile item=eachParticipant key=participantID}
      <tr><th {$headerStyle}>{ts 1=$participantID+2}Participant Information - Participant %1{/ts} </th></tr>
      {foreach from=$eachParticipant item=eachProfile key=pid}
      <tr><th {$headerStyle}>{$customProfile.title.$pid}</th></tr>
      {foreach from=$eachProfile item=val key=field}
      <tr>{foreach from=$val item=v key=f}
      <td {$labelStyle}>{$field}</td>
      <td {$valueStyle}>{$v}</td>
      {/foreach}
      </tr>
      {/foreach} {/foreach} {/if}

      {if $customGroup}
      {foreach from=$customGroup item=value key=customName}
      <tr>
      <th {$headerStyle}>
      {$customName}
      </th>
      </tr>
      {foreach from=$value item=v key=n}
      <tr>
      <td {$labelStyle}>
      {$n}
      </td>
      <td {$valueStyle}>
      {$v}
      </td>
      </tr>
      {/foreach}
      {/if}

      </table>
      </center>

      </body>
      </html>
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_html = @content));

      SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'event_online_receipt';
      SELECT @content := msg_text FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_text = '{if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
      {$event.confirm_email_text} {/if}
      {if $isOnWaitlist}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}You have been added to the WAIT LIST for this event.{/ts}
      {if $isPrimary} {ts}If space becomes available you will receive an email with
      a link to a web page where you can complete your registration.{/ts} {/if}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {elseif $isRequireApproval}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Your registration has been submitted.{/ts}
      {if $isPrimary} {ts}Once your registration has been reviewed, you will receive
      an email with a link to a web page where you can complete the
      registration process.{/ts}
      {/if}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {elseif $is_pay_later && !$isAmountzero}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$pay_later_receipt}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {else}
      {ts}Please print this confirmation for your records.{/ts} {/if}


      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Event Information and Location{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$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 neq \'Attendee\' and $defaultRole} {ts}Participant Role{/ts}: {$event.participant_role}{/if}
      {if $isShowLocation} {if $location.address.1.name}

      {$location.address.1.name} {/if} {if $location.address.1.street_address}{$location.address.1.street_address}{/if} {if $location.address.1.supplemental_address_1}{$location.address.1.supplemental_address_1} {/if} {if $location.address.1.supplemental_address_2}{$location.address.1.supplemental_address_2}{/if} {if $location.address.1.city}{$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}
      {/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} {/foreach} {foreach from=$location.email item=eventEmail} {if $eventEmail.email}
      {ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach} {/if}
      {capture assign=icalFeed}{crmURL p=\'civicrm/event/ical\' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture} {ts}Download iCalendar File:{/ts} {$icalFeed} {if $email}

      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Registered Email{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$email} {/if} {if $event.is_monetary} {* This section for Paid events only.*}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$event.fee_label}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {if $lineItem}{foreach from=$lineItem item=value key=priceset}
      {if $value neq \'skip\'} {if $isPrimary} {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}{ts 1=$priceset+1}

      Participant %1

      {/ts} {$part.$priceset.info}
      {/if}
      ----------------------------------------------------------{if $pricesetFieldsCount }-------------------{/if}
      {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} {if $pricesetFieldsCount }{capture assign=ts_participant_total}{ts}Total Participants{/ts} {/capture}{/if}
      {$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
      ----------------------------------------------------------{if $pricesetFieldsCount }-------------------{/if}
      {foreach from=$value item=line} {if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture} {/if} {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|string_format:"%10s"} {$line.line_total|crmMoney|string_format:"%10s"}{$ts_participant_count|string_format:"%10s"} {/foreach}{/if} {/foreach} {/if} {if $amount && !$lineItem} {foreach from=$amount item=amnt key=level}{$amnt.amount|crmMoney} {$amnt.label}{/foreach} {/if} {if $isPrimary }
      {ts}Total Amount{/ts}: {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if} {if $pricesetFieldsCount }
      {assign var="count" value= 0}
      {foreach from=$lineItem item=pcount}
      {assign var="lineItemCount" value=0}
      {if $pcount neq \'skip\'}
      {foreach from=$pcount item=p_count}
      {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
      {/foreach}
      {if $lineItemCount < 1 }
      {assign var="lineItemCount" value=1}
      {/if}
      {assign var="count" value=$count+$lineItemCount}
      {/if}
      {/foreach}
      {ts}Total Participants{/ts}: {$count} {/if}
      {if $is_pay_later }

      ==========================================================={if $pricesetFieldsCount }

      ====================

      {/if}

      {$pay_later_receipt}
      ==========================================================={if $pricesetFieldsCount }===================={/if} {/if}
      {if $register_date} {ts}Registration Date{/ts}: {$register_date|crmDate}{/if} {if $receive_date} {ts}Transaction Date{/ts}: {$receive_date|crmDate} {/if} {if $contributionTypeName}{ts}Contribution Type{/ts}: {$contributionTypeName} {/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 ne \'notify\' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}

      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Billing Name and Address{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$billingName}
      {$address}{/if}
      {if $contributeMode eq \'direct\' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts}Credit Card Information{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$credit_card_type}
      {$credit_card_number} {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:\'\'|crmDate}{/if} {/if} {* End of conditional section for Paid events *}

      {if $customPre} {foreach from=$customPre item=customPr key=i}
      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$customPre_grouptitle.$i}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$customPr item=customValue key=customName} {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      {$customName}: {$customValue} {/if} {/foreach}{/if}
      {if $customPost} {foreach from=$customPost item=customPos key=j}
      ==========================================================={if $pricesetFieldsCount }===================={/if}

      {$customPost_grouptitle.$j}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$customPos item=customValue key=customName}{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
      {$customName}: {$customValue} {/if} {/foreach}{/if} {if $customProfile}
      {foreach from=$customProfile.profile item=eachParticipant key=participantID}
      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {ts 1=$participantID+2}Participant Information - Participant %1{/ts}

      ==========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$eachParticipant item=eachProfile key=pid}
      ---------------------------------------------------------{if $pricesetFieldsCount }-------------------{/if}

      {$customProfile.title.$pid}
      ----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
      {foreach from=$eachProfile item=val key=field} {foreach from=$val item=v key=f}
      {$field}: {$v} {/foreach} {/foreach}{/if} {if $customGroup} {foreach from=$customGroup item=value key=customName}
      =========================================================={if $pricesetFieldsCount }===================={/if}

      {$customName}
      =========================================================={if $pricesetFieldsCount }===================={/if}
      {foreach from=$value item=v key=n}
      {$n}: {$v} {/foreach} {/if}
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_text = @content));

      SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = 'membership_online_receipt';
      SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
      UPDATE civicrm_msg_template SET msg_html = '<!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="500" 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 $receipt_text}
      <p>{$receipt_text|htmlize}</p>
      {/if}

      {if $is_pay_later}
      <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
      {else}
      <p>{ts}Please print this confirmation for your records.{/ts}</p>
      {/if}

      </td>
      </tr>
      </table>
      <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">

      {if $membership_assign}
      <tr>
      <th {$headerStyle}>
      {ts}Membership Information{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts}Membership Type{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_name}
      </td>
      </tr>
      {if $mem_start_date}
      <tr>
      <td {$labelStyle}>
      {ts}Membership Start Date{/ts}
      </td>
      <td {$valueStyle}>
      {$mem_start_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $mem_end_date}
      <tr>
      <td {$labelStyle}>
      {ts}Membership End Date{/ts}
      </td>
      <td {$valueStyle}>
      {$mem_end_date|crmDate}
      </td>
      </tr>
      {/if}


      {if $amount}


      <tr>
      <th {$headerStyle}>
      {ts}Membership Fee{/ts}
      </th>
      </tr>

      {if $membership_amount}

      <tr>
      <td {$labelStyle}>
      {ts 1=$membership_name}%1 Membership{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_amount|crmMoney}
      </td>
      </tr>
      {if $amount}
      {if ! $is_separate_payment }
      <tr>
      <td {$labelStyle}>
      {ts}Contribution Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney}
      </td>
      </tr>
      {else}
      <tr>
      <td {$labelStyle}>
      {ts}Additional Contribution{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney}
      </td>
      </tr>
      {/if}
      <tr>
      <td {$labelStyle}>
      {ts}Total{/ts}
      </td>
      <td {$valueStyle}>
      {$amount+$membership_amount|crmMoney}
      </td>
      </tr>

      {elseif $lineItem and $priceSetID}

      {foreach from=$lineItem item=value key=priceset}
      <tr>
      <td colspan="2" {$valueStyle}>
      <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
      <tr>
      <th>{ts}Item{/ts}</th>
      <th>{ts}Qty{/ts}</th>
      <th>{ts}Each{/ts}</th>
      <th>{ts}Total{/ts}</th>
      </tr>
      {foreach from=$value item=line}
      <tr>
      <td>
      {$line.description|truncate:30:"..."}
      </td>
      <td>
      {$line.qty}
      </td>
      <td>
      {$line.unit_price|crmMoney}
      </td>
      <td>
      {$line.line_total|crmMoney}
      </td>
      </tr>
      {/foreach}
      </table>
      </td>
      </tr>
      {/foreach}
      <tr>
      <td {$labelStyle}>
      {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney}
      </td>
      </tr>

      {else}

      <tr>
      <td {$labelStyle}>
      {ts}Amount{/ts}
      </td>
      <td {$valueStyle}>
      {$amount|crmMoney} {if $amount_level} - {$amount_level}{/if}
      </td>
      </tr>

      {/if}


      {elseif $membership_amount}


      <tr>
      <th {$headerStyle}>
      {ts}Membership Fee{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts 1=$membership_name}%1 Membership{/ts}
      </td>
      <td {$valueStyle}>
      {$membership_amount|crmMoney}
      </td>
      </tr>


      {/if}


      {if $receive_date}

      <tr>
      <td {$labelStyle}>

      {ts}Date{/ts}
      </td>
      <td {$valueStyle}>
      {$receive_date|crmDate}
      </td>
      </tr>
      {/if}

      {if $is_monetary and $trxn_id}
      <tr>
      <td {$labelStyle}>
      {ts}

      Transaction #

      {/ts}
      </td>
      <td {$valueStyle}>
      {$trxn_id}
      </td>
      </tr>
      {/if}

      {if $membership_trx_id}
      <tr>
      <td {$labelStyle}>
      {ts}Membership Transaction #{/ts}

      </td>
      <td {$valueStyle}>
      {$membership_trx_id}
      </td>
      </tr>

      {/if}
      {if $is_recur}
      {if $contributeMode eq \'notify\' or $contributeMode eq \'directIPN\'}
      <tr>
      <td {$labelStyle}>
      {ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can modify or cancel the auto-renewal option by <a href="%1">visiting this web page</a>.{/ts}
      </td>
      </tr>
      {/if} {/if}

      {if $honor_block_is_active}
      <tr>
      <th {$headerStyle}>
      {$honor_type}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$honor_prefix} {$honor_first_name} {$honor_last_name}
      </td>
      </tr>
      {if $honor_email}
      <tr>
      <td {$labelStyle}>
      {ts}Honoree Email{/ts}
      </td>
      <td {$valueStyle}>
      {$honor_email}
      </td>
      </tr>
      {/if} {/if}

      {if $pcpBlock}
      <tr>
      <th {$headerStyle}>
      {ts}Personal Campaign Page{/ts}
      </th>
      </tr>
      <tr>
      <td {$labelStyle}>
      {ts}Display In Honor Roll{/ts}
      </td>
      <td {$valueStyle}>
      {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}

      </td>
      </tr>

      {if $pcp_roll_nickname}

      <tr>
      <td {$labelStyle}>

      {ts}Nick Name{/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_roll_nickname}
      </td>
      </tr>
      {/if}
      {if $pcp_personal_note}
      <tr>
      <td {$labelStyle}>
      {ts}

      Personal Note

      {/ts}
      </td>
      <td {$valueStyle}>
      {$pcp_personal_note}
      </td>
      </tr>
      {/if}

      {if $onBehalfProfile}
      <tr>
      <th {$headerStyle}>
      {$onBehalfProfile_grouptitle}
      </th>
      </tr>
      {foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
      <tr>
      <td {$labelStyle}>
      {$onBehalfName}
      </td>
      <td {$valueStyle}>
      {$onBehalfValue}
      </td>
      </tr>
      {/foreach}
      {/if}

      {if ! ($contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\') and $is_monetary}
      {if $is_pay_later}
      <tr>
      <th {$headerStyle}>
      {ts}Registered Email{/ts}

      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$email}
      </td>
      </tr>

      {elseif $amount GT 0 OR $membership_amount GT 0}

      <tr>
      <th {$headerStyle}>

      {ts}Billing Name and Address{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$valueStyle}>
      {$billingName}<br />
      {$address|nl2br}<br />
      {$email}
      </td>
      </tr>
      {/if}

      {if $contributeMode eq \'direct\' AND !$is_pay_later AND ($amount GT 0 OR $membership_amount GT 0)}
      <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}<br />
      </td>
      </tr>

      {/if}

      {if $selectPremium}
      <tr>
      <th {$headerStyle}>
      {ts}Premium Information{/ts}
      </th>
      </tr>
      <tr>
      <td colspan="2" {$labelStyle}>
      {$product_name}
      </td>
      </tr>
      {if $option}
      <tr>
      <td {$labelStyle}>
      {ts}Option{/ts}
      </td>
      <td {$valueStyle}>
      {$option}
      </td>
      </tr>
      {/if} {if $sku}

      <tr>
      <td {$labelStyle}>

      {ts}SKU{/ts}
      </td>
      <td {$valueStyle}>
      {$sku}
      </td>
      </tr>
      {/if}
      {if $start_date}
      <tr>
      <td {$labelStyle}>
      {ts}

      Start Date

      {/ts}
      </td>
      <td {$valueStyle}>
      {$start_date|crmDate}
      </td>
      </tr>
      {/if}
      {if $end_date}
      <tr>
      <td {$labelStyle}>
      {ts}End Date{/ts}

      </td>
      <td {$valueStyle}>
      {$end_date|crmDate}
      </td>
      </tr>

      {/if}
      {if $contact_email OR $contact_phone}
      <tr>
      <td colspan="2" {$valueStyle}>
      <p>{ts}For information about this premium, contact:{/ts}</p>
      {if $contact_email}
      <p>{$contact_email}</p>
      {/if} {if $contact_phone}

      <p>{$contact_phone}</p>

      {/if}
      </td>
      </tr>
      {/if} {if $is_deductible AND $price}

      <tr>
      <td colspan="2" {$valueStyle}>
      <p>

      {ts 1=$price|crmMoney}

      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}

      </p>
      </td>
      </tr>

      {/if} {if $customPre}

      <tr>
      <th {$headerStyle}>
      {$customPre_grouptitle}
      </th>
      </tr>

      {foreach from=$customPre item=customValue key=customName} {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>
      {/if}
      {/foreach}
      {/if}

      {if $customPost}
      <tr>
      <th {$headerStyle}>
      {$customPost_grouptitle}
      </th>
      </tr>
      {foreach from=$customPost item=customValue key=customName}
      {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}

      <tr>
      <td {$labelStyle}>
      {$customName}
      </td>
      <td {$valueStyle}>
      {$customValue}
      </td>
      </tr>

      {/if}
      {/foreach}
      {/if}

      </table>
      </center>

      </body>
      </html>
      ' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_html = @content));

      CREATE TABLE IF NOT EXISTS civicrm_action_log (
      id int UNSIGNED NOT NULL AUTO_INCREMENT,
      contact_id int UNSIGNED NULL DEFAULT NULL COMMENT 'FK to Contact ID',
      entity_id int UNSIGNED NOT NULL COMMENT 'FK to id of the entity that the action was performed on. Pseudo - FK.',
      entity_table varchar(255) COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant',
      action_schedule_id int UNSIGNED NOT NULL COMMENT 'FK to the action schedule that this action originated from.',
      action_date_time DATETIME NULL DEFAULT NULL COMMENT 'date time that the action was performed on.',
      is_error TINYINT( 4 ) NULL DEFAULT '0' COMMENT 'Was there any error sending the reminder?',
      message TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Description / text in case there was an error encountered.',
      repetition_number INT( 10 ) UNSIGNED NULL COMMENT 'Keeps track of the sequence number of this repetition.',
      PRIMARY KEY ( id ),
      CONSTRAINT FK_civicrm_action_log_contact_id FOREIGN KEY (contact_id) REFERENCES civicrm_contact(id) ON DELETE CASCADE,
      CONSTRAINT FK_civicrm_action_log_action_schedule_id FOREIGN KEY (action_schedule_id) REFERENCES civicrm_action_schedule(id) ON DELETE CASCADE
      ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

      ALTER TABLE `civicrm_action_log` CHANGE `repetition_number` `repetition_number` INT( 10 ) UNSIGNED NULL COMMENT 'Keeps track of the sequence number of this repetition.';

      UPDATE civicrm_mailing SET domain_id = 1 WHERE domain_id IS NULL;

      DELETE et2.* from civicrm_entity_tag et1
      INNER JOIN civicrm_entity_tag et2 ON et1.entity_table = et2.entity_table AND et1.entity_id = et2.entity_id AND et1.tag_id = et2.tag_id
      WHERE et1.id < et2.id;

      ALTER TABLE civicrm_entity_tag
      DROP INDEX index_entity;

      ALTER TABLE civicrm_entity_tag
      ADD UNIQUE INDEX UI_entity_id_entity_table_tag_id( entity_table, entity_id, tag_id );

      SELECT @report_template_gid := MAX(id) FROM civicrm_option_group WHERE name = 'report_template';

      UPDATE civicrm_option_value SET label = 'Pledge Report (Detail)', description = 'Pledge Report' WHERE option_group_id = @report_template_gid AND value = 'pledge/summary';

      UPDATE civicrm_option_value SET name = 'CRM_Report_Form_Pledge_Detail', value = 'pledge/detail' WHERE option_group_id = @report_template_gid AND value = 'pledge/summary';

      UPDATE civicrm_report_instance SET report_id = 'pledge/detail' WHERE report_id = 'pledge/summary';

      SELECT @weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @report_template_gid;
      SELECT @pledgeCompId := MAX(id) FROM civicrm_component where name = 'CiviPledge';
      INSERT INTO civicrm_option_value
      (option_group_id, label, value, name, weight, description, is_active, component_id) VALUES
      (@report_template_gid, 'Pledge Summary Report', 'pledge/summary', 'CRM_Report_Form_Pledge_Summary', @weight := @weight + 1, 'Pledge Summary Report.', 1, @pledgeCompId);

      UPDATE civicrm_payment_processor
      SET `url_site` = 'https://sec.paymentexpress.com/pxpay/pxpay.aspx'
      WHERE `url_site` = 'https://www.paymentexpress.com/pxpay/pxpay.aspx'
      OR url_site = 'https://sec2.paymentexpress.com/pxpay/pxpay.aspx';

      UPDATE civicrm_payment_processor
      SET `url_site` = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx'
      WHERE `url_site` = 'https://www.paymentexpress.com/pxpay/pxaccess.aspx'
      OR url_site = 'https://sec2.paymentexpress.com/pxpay/pxpay/pxaccess.aspx';

      UPDATE civicrm_payment_processor_type
      SET url_site_default = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx',
      url_site_test_default = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx'
      WHERE name = 'Payment_Express';

      SELECT @option_group_id_languages := MAX(id) FROM civicrm_option_group WHERE name = 'languages';
      SELECT @languages_max_weight := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_languages;

      UPDATE civicrm_option_value SET label = 'Persian (Iran)' WHERE value = 'fa' AND option_group_id = @option_group_id_languages;

      INSERT INTO civicrm_option_value
      (option_group_id, is_default, is_active, name, value, label, weight)
      VALUES
      (@option_group_id_languages, 0, 1, 'de_CH', 'de', 'German (Swiss)', @weight := @languages_max_weight + 1),
      (@option_group_id_languages, 0, 1, 'es_PR', 'es', 'Spanish; Castilian (Puerto Rico)', @weight := @languages_max_weight + 2);

      ALTER TABLE `civicrm_dashboard` DROP `content`, DROP `created_date`;
      ALTER TABLE `civicrm_dashboard_contact` ADD `content` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL AFTER `weight`, ADD `created_date` DATETIME NULL DEFAULT NULL AFTER `content`; [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT @content := msg_html FROM civicrm_msg_template WHERE workflow_id = @workf' at line 2]"]
      )
      _____________________________________________________________________________________________________________
      After running the script, the systems still works, except (of course), the dashboard hangs when dashlets are selected.

      ____________________________________________________________________________________________________________
      Running on Drupal 7.8 - Status report follows:

      Here you can find a short overview of your site's parameters as well as any problems detected with your installation. It may be useful to copy and paste this information into support requests filed on drupal.org's support forums and project issue queues.

      Info
      Drupal 7.8
      OK
      Access to update.php Protected
      Info
      CAPTCHA Already 0 blocked form submissions
      OK
      CTools CSS Cache Exists
      OK
      Configuration file Protected
      OK
      Contact Importer Setup correctly
      OK
      Cron maintenance tasks Last run 55 min 20 sec ago
      You can run cron manually.
      To run cron from outside the site, go to http://localhost/cron.php?cron_key=wwFigTtCXKiUHaj-8YVad5aivK8R_cDryJfZF0gcipI
      OK
      Database system MySQL, MariaDB, or equivalent
      OK
      Database system version 5.1.53-community-log
      OK
      Database updates Up to date
      OK
      Date API System date settings
      The timezone has been set to America/Chicago. The first day of the week has been set to Sunday. The medium date format has been set to to D, m/d/Y - H:i.
      OK
      Drupal core update status Up to date
      OK
      File system Writable (public download method)
      OK
      GD library PNG support bundled (2.0.34 compatible)
      OK
      GD library rotate and desaturate effects bundled (2.0.34 compatible)
      OK
      Module and theme update status Up to date
      OK
      Node Access Permissions 2 permissions in use
      If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Rebuilding will remove all privileges to content and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions. Rebuild permissions
      OK
      OpenID Math library Installed
      OK
      PHP 5.3.4 (more information)
      OK
      PHP DOMDocument class Enabled
      OK
      PHP extensions Enabled
      OK
      PHP memory limit 256M
      OK
      PHP open_basedir restriction Disabled
      OK
      PHP register globals Disabled
      OK
      TCPDF Library version 5.9.120
      OK
      TinyMCE CodeMagic Installed correctly
      OK
      Unicode library PHP Mbstring Extension
      OK
      Update notifications Enabled
      OK
      Upload progress Enabled (APC RFC1867)
      Your server is capable of displaying file upload progress using APC RFC1867. Note that only one upload at a time is supported. It is recommended to use the PECL uploadprogress library if possible.
      OK
      Web server Apache/2.2.17 (Win32) PHP/5.3.4
      OK
      cURL Enabled
      OK
      hash Enabled

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              barbarae Barbara Errickson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: