Answers.Body: <p>The message template 'Memberships - Receipt (on-line)' is either missing and linked incorrectly in your database. Try running below query to fix the data before running the upgrade.</p>
  
  <pre><code>SELECT @option_group_id_msg_tmp := max(id) from civicrm_option_group WHERE name = 'msg_tpl_workflow_membership';
  SELECT @option_option_value_id := max(id) from civicrm_option_value WHERE name = 'membership_online_receipt' AND option_group_id = @option_group_id_msg_tmp;
  UPDATE civicrm_msg_template SET workflow_id = @option_option_value_id WHERE workflow_id IS NOT NULL AND msg_title LIKE "Memberships - Receipt (on-line)";
  </code></pre>
  
  <p>Cheers</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-09T21:44:53.787Z
Answers.LastActivityDate: 2019-06-09T21:44:53.787Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I've had this problem previously on another site going from 5.2 to 5.10 and was helped here : "<a href="https://civicrm.stackexchange.com/questions/28650/upgrade-5-2-2-to-5-10-4-fails-with-update-civicrm-msg-template-error">Upgrade 5.2.2 to 5.10.4 fails with UPDATE civicrm_msg_template error</a>"  with lines to comment out from CRM/Upgrade/Incremental/MessageTemplates.php</p>
  
  <p>Unfortunately MessageTemplates.php has changed quite a lot so I don't know how/if I can use the "comment out" solution.</p>
  
  <p>I have no custom templates</p>
  
  <p>here is the error message
  Jun 07 21:35:46  [info] $Fatal Error Details = Array
  (
      [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => handle
          )</p>
  
  <pre><code>[code] =&gt; -2
  [message] =&gt; DB Error: syntax error
  [mode] =&gt; 16
  [debug_info] =&gt; 
        UPDATE civicrm_msg_template SET msg_text = '{assign var=\"greeting\" value=\"{contact.email_greeting}\"}{if $greeting}{$greeting},{/if}\n{if $receipt_text}\n{$receipt_text}\n{/if}\n{if $is_pay_later}\n\n===========================================================\n{$pay_later_receipt}\n===========================================================\n{else}\n\n{ts}Please print this receipt for your records.{/ts}\n{/if}\n\n{if $membership_assign &amp;&amp; !$useForMember}\n===========================================================\n{ts}Membership Information{/ts}\n\n===========================================================\n{ts}Membership Type{/ts}: {$membership_name}\n{if $mem_start_date}{ts}Membership Start Date{/ts}: {$mem_start_date|crmDate}\n{/if}\n{if $mem_end_date}{ts}Membership End Date{/ts}: {$mem_end_date|crmDate}\n{/if}\n\n{/if}\n{if $amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{if !$useForMember &amp;&amp; $membership_amount &amp;&amp; $is_quick_config}\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{if $amount &amp;&amp; !$is_separate_payment }\n{ts}Contribution Amount{/ts}: {$amount|crmMoney}\n-------------------------------------------\n{ts}Total{/ts}: {$amount+$membership_amount|crmMoney}\n{/if}\n{elseif !$useForMember &amp;&amp; $lineItem and $priceSetID &amp; !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n---------------------------------------------------------\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_qty}{ts}Qty{/ts}{/capture}\n{capture assign=ts_each}{ts}Each{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_qty|string_format:\"%5s\"} {$ts_each|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"}\n----------------------------------------------------------\n{foreach from=$value item=line}\n{$line.description|truncate:30:\"...\"|string_format:\"%-30s\"} {$line.qty|string_format:\"%5s\"} {$line.unit_price|crmMoney|string_format:\"%10s\"} {$line.line_total|crmMoney|string_format:\"%10s\"}\n{/foreach}\n{/foreach}\n\n{ts}Total Amount{/ts}: {$amount|crmMoney}\n{else}\n{if $useForMember &amp;&amp; $lineItem &amp;&amp; !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_total}{ts}Fee{/ts}{/capture}\n{if $dataArray}\n{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}\n{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}\n{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{/if}\n{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}\n{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_total|string_format:\"%10s\"} {if $dataArray} {$ts_subtotal|string_format:\"%10s\"} {$ts_taxRate|string_format:\"%10s\"} {$ts_taxAmount|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"} {/if} {$ts_start_date|string_format:\"%20s\"} {$ts_end_date|string_format:\"%20s\"}\n--------------------------------------------------------------------------------------------------\n\n{foreach from=$value item=line}\n{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.line_total|crmMoney|string_format:\"%10s\"}  {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:\"%10s\"} {if $line.tax_rate != \"\" || $line.tax_amount != \"\"}  {$line.tax_rate|string_format:\"%.2f\"} %  {$line.tax_amount|crmMoney:$currency|string_format:\"%10s\"} {else}                  {/if}   {$line.line_total+$line.tax_amount|crmMoney|string_format:\"%10s\"} {/if} {$line.start_date|string_format:\"%20s\"} {$line.end_date|string_format:\"%20s\"}\n{/foreach}\n{/foreach}\n\n{if $dataArray}\n{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}\n\n{foreach from=$dataArray item=value key=priceset}\n{if $priceset || $priceset == 0}\n{$taxTerm} {$priceset|string_format:\"%.2f\"}%: {$value|crmMoney:$currency}\n{else}\n{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}\n{/if}\n{/foreach}\n{/if}\n--------------------------------------------------------------------------------------------------\n{/if}\n\n{if $totalTaxAmount}\n{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}\n{/if}\n\n{ts}Amount{/ts}: {$amount|crmMoney} {if $amount_level } - {$amount_level} {/if}\n{/if}\n{elseif $membership_amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{/if}\n\n{if $receive_date}\n\n{ts}Date{/ts}: {$receive_date|crmDate}\n{/if}\n{if $is_monetary and $trxn_id}\n{ts}Transaction #{/ts}: {$trxn_id}\n\n{/if}\n{if $membership_trx_id}\n{ts}Membership Transaction #{/ts}: {$membership_trx_id}\n\n{/if}\n{if $is_recur}\n{ts}This membership will be renewed automatically.{/ts}\n{if $cancelSubscriptionUrl}\n\n{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by visiting this web page: %1.{/ts}\n\n{/if}\n\n{if $updateSubscriptionBillingUrl}\n\n{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by &lt;a href=\"%1\"&gt;visiting this web page&lt;/a&gt;.{/ts}\n{/if}\n{/if}\n\n{if $honor_block_is_active }\n===========================================================\n{$soft_credit_type}\n===========================================================\n{foreach from=$honoreeProfile item=value key=label}\n{$label}: {$value}\n{/foreach}\n\n{/if}\n{if $pcpBlock}\n===========================================================\n{ts}Personal Campaign Page{/ts}\n\n===========================================================\n{ts}Display In Honor Roll{/ts}: {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}\n\n{if $pcp_roll_nickname}{ts}Nickname{/ts}: {$pcp_roll_nickname}{/if}\n\n{if $pcp_personal_note}{ts}Personal Note{/ts}: {$pcp_personal_note}{/if}\n\n{/if}\n{if $onBehalfProfile}\n===========================================================\n{ts}On Behalf Of{/ts}\n\n===========================================================\n{foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}\n{$onBehalfName}: {$onBehalfValue}\n{/foreach}\n{/if}\n\n{if !( $contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\' ) and $is_monetary}\n{if $is_pay_later}\n===========================================================\n{ts}Registered Email{/ts}\n\n===========================================================\n{$email}\n{elseif $amount GT 0 OR $membership_amount GT 0 }\n===========================================================\n{ts}Billing Name and Address{/ts}\n\n===========================================================\n{$billingName}\n{$address}\n\n{$email}\n{/if} {* End ! is_pay_later condition. *}\n{/if}\n{if $contributeMode eq \'direct\' AND !$is_pay_later AND ( $amount GT 0 OR $membership_amount GT 0 ) }\n\n===========================================================\n{ts}Credit Card Information{/ts}\n\n===========================================================\n{$credit_card_type}\n{$credit_card_number}\n{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:\'\'|crmDate}\n{/if}\n\n{if $selectPremium }\n===========================================================\n{ts}Premium Information{/ts}\n\n===========================================================\n{$product_name}\n{if $option}\n{ts}Option{/ts}: {$option}\n{/if}\n{if $sku}\n{ts}SKU{/ts}: {$sku}\n{/if}\n{if $start_date}\n{ts}Start Date{/ts}: {$start_date|crmDate}\n{/if}\n{if $end_date}\n{ts}End Date{/ts}: {$end_date|crmDate}\n{/if}\n{if $contact_email OR $contact_phone}\n\n{ts}For information about this premium, contact:{/ts}\n\n{if $contact_email}\n  {$contact_email}\n{/if}\n{if $contact_phone}\n  {$contact_phone}\n{/if}\n{/if}\n{if $is_deductible AND $price}\n\n{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}{/if}\n{/if}\n\n{if $customPre}\n===========================================================\n{$customPre_grouptitle}\n\n===========================================================\n{foreach from=$customPre item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n\n\n{if $customPost}\n===========================================================\n{$customPost_grouptitle}\n\n===========================================================\n{foreach from=$customPost item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n' WHERE id IN () [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 ')' at line 1]
  [type] =&gt; DB_Error
  [user_info] =&gt; 
        UPDATE civicrm_msg_template SET msg_text = '{assign var=\"greeting\" value=\"{contact.email_greeting}\"}{if $greeting}{$greeting},{/if}\n{if $receipt_text}\n{$receipt_text}\n{/if}\n{if $is_pay_later}\n\n===========================================================\n{$pay_later_receipt}\n===========================================================\n{else}\n\n{ts}Please print this receipt for your records.{/ts}\n{/if}\n\n{if $membership_assign &amp;&amp; !$useForMember}\n===========================================================\n{ts}Membership Information{/ts}\n\n===========================================================\n{ts}Membership Type{/ts}: {$membership_name}\n{if $mem_start_date}{ts}Membership Start Date{/ts}: {$mem_start_date|crmDate}\n{/if}\n{if $mem_end_date}{ts}Membership End Date{/ts}: {$mem_end_date|crmDate}\n{/if}\n\n{/if}\n{if $amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{if !$useForMember &amp;&amp; $membership_amount &amp;&amp; $is_quick_config}\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{if $amount &amp;&amp; !$is_separate_payment }\n{ts}Contribution Amount{/ts}: {$amount|crmMoney}\n-------------------------------------------\n{ts}Total{/ts}: {$amount+$membership_amount|crmMoney}\n{/if}\n{elseif !$useForMember &amp;&amp; $lineItem and $priceSetID &amp; !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n---------------------------------------------------------\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_qty}{ts}Qty{/ts}{/capture}\n{capture assign=ts_each}{ts}Each{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_qty|string_format:\"%5s\"} {$ts_each|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"}\n----------------------------------------------------------\n{foreach from=$value item=line}\n{$line.description|truncate:30:\"...\"|string_format:\"%-30s\"} {$line.qty|string_format:\"%5s\"} {$line.unit_price|crmMoney|string_format:\"%10s\"} {$line.line_total|crmMoney|string_format:\"%10s\"}\n{/foreach}\n{/foreach}\n\n{ts}Total Amount{/ts}: {$amount|crmMoney}\n{else}\n{if $useForMember &amp;&amp; $lineItem &amp;&amp; !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_total}{ts}Fee{/ts}{/capture}\n{if $dataArray}\n{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}\n{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}\n{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{/if}\n{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}\n{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_total|string_format:\"%10s\"} {if $dataArray} {$ts_subtotal|string_format:\"%10s\"} {$ts_taxRate|string_format:\"%10s\"} {$ts_taxAmount|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"} {/if} {$ts_start_date|string_format:\"%20s\"} {$ts_end_date|string_format:\"%20s\"}\n--------------------------------------------------------------------------------------------------\n\n{foreach from=$value item=line}\n{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.line_total|crmMoney|string_format:\"%10s\"}  {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:\"%10s\"} {if $line.tax_rate != \"\" || $line.tax_amount != \"\"}  {$line.tax_rate|string_format:\"%.2f\"} %  {$line.tax_amount|crmMoney:$currency|string_format:\"%10s\"} {else}                  {/if}   {$line.line_total+$line.tax_amount|crmMoney|string_format:\"%10s\"} {/if} {$line.start_date|string_format:\"%20s\"} {$line.end_date|string_format:\"%20s\"}\n{/foreach}\n{/foreach}\n\n{if $dataArray}\n{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}\n\n{foreach from=$dataArray item=value key=priceset}\n{if $priceset || $priceset == 0}\n{$taxTerm} {$priceset|string_format:\"%.2f\"}%: {$value|crmMoney:$currency}\n{else}\n{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}\n{/if}\n{/foreach}\n{/if}\n--------------------------------------------------------------------------------------------------\n{/if}\n\n{if $totalTaxAmount}\n{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}\n{/if}\n\n{ts}Amount{/ts}: {$amount|crmMoney} {if $amount_level } - {$amount_level} {/if}\n{/if}\n{elseif $membership_amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{/if}\n\n{if $receive_date}\n\n{ts}Date{/ts}: {$receive_date|crmDate}\n{/if}\n{if $is_monetary and $trxn_id}\n{ts}Transaction #{/ts}: {$trxn_id}\n\n{/if}\n{if $membership_trx_id}\n{ts}Membership Transaction #{/ts}: {$membership_trx_id}\n\n{/if}\n{if $is_recur}\n{ts}This membership will be renewed automatically.{/ts}\n{if $cancelSubscriptionUrl}\n\n{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by visiting this web page: %1.{/ts}\n\n{/if}\n\n{if $updateSubscriptionBillingUrl}\n\n{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by &lt;a href=\"%1\"&gt;visiting this web page&lt;/a&gt;.{/ts}\n{/if}\n{/if}\n\n{if $honor_block_is_active }\n===========================================================\n{$soft_credit_type}\n===========================================================\n{foreach from=$honoreeProfile item=value key=label}\n{$label}: {$value}\n{/foreach}\n\n{/if}\n{if $pcpBlock}\n===========================================================\n{ts}Personal Campaign Page{/ts}\n\n===========================================================\n{ts}Display In Honor Roll{/ts}: {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}\n\n{if $pcp_roll_nickname}{ts}Nickname{/ts}: {$pcp_roll_nickname}{/if}\n\n{if $pcp_personal_note}{ts}Personal Note{/ts}: {$pcp_personal_note}{/if}\n\n{/if}\n{if $onBehalfProfile}\n===========================================================\n{ts}On Behalf Of{/ts}\n\n===========================================================\n{foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}\n{$onBehalfName}: {$onBehalfValue}\n{/foreach}\n{/if}\n\n{if !( $contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\' ) and $is_monetary}\n{if $is_pay_later}\n===========================================================\n{ts}Registered Email{/ts}\n\n===========================================================\n{$email}\n{elseif $amount GT 0 OR $membership_amount GT 0 }\n===========================================================\n{ts}Billing Name and Address{/ts}\n\n===========================================================\n{$billingName}\n{$address}\n\n{$email}\n{/if} {* End ! is_pay_later condition. *}\n{/if}\n{if $contributeMode eq \'direct\' AND !$is_pay_later AND ( $amount GT 0 OR $membership_amount GT 0 ) }\n\n===========================================================\n{ts}Credit Card Information{/ts}\n\n===========================================================\n{$credit_card_type}\n{$credit_card_number}\n{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:\'\'|crmDate}\n{/if}\n\n{if $selectPremium }\n===========================================================\n{ts}Premium Information{/ts}\n\n===========================================================\n{$product_name}\n{if $option}\n{ts}Option{/ts}: {$option}\n{/if}\n{if $sku}\n{ts}SKU{/ts}: {$sku}\n{/if}\n{if $start_date}\n{ts}Start Date{/ts}: {$start_date|crmDate}\n{/if}\n{if $end_date}\n{ts}End Date{/ts}: {$end_date|crmDate}\n{/if}\n{if $contact_email OR $contact_phone}\n\n{ts}For information about this premium, contact:{/ts}\n\n{if $contact_email}\n  {$contact_email}\n{/if}\n{if $contact_phone}\n  {$contact_phone}\n{/if}\n{/if}\n{if $is_deductible AND $price}\n\n{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}{/if}\n{/if}\n\n{if $customPre}\n===========================================================\n{$customPre_grouptitle}\n\n===========================================================\n{foreach from=$customPre item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n\n\n{if $customPost}\n===========================================================\n{$customPost_grouptitle}\n\n===========================================================\n{foreach from=$customPost item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n' WHERE id IN () [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 ')' at line 1]
  [to_string] =&gt; [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="
        UPDATE civicrm_msg_template SET msg_text = '{assign var=\"greeting\" value=\"{contact.email_greeting}\"}{if $greeting}{$greeting},{/if}\n{if $receipt_text}\n{$receipt_text}\n{/if}\n{if $is_pay_later}\n\n===========================================================\n{$pay_later_receipt}\n===========================================================\n{else}\n\n{ts}Please print this receipt for your records.{/ts}\n{/if}\n\n{if $membership_assign &amp;&amp; !$useForMember}\n===========================================================\n{ts}Membership Information{/ts}\n\n===========================================================\n{ts}Membership Type{/ts}: {$membership_name}\n{if $mem_start_date}{ts}Membership Start Date{/ts}: {$mem_start_date|crmDate}\n{/if}\n{if $mem_end_date}{ts}Membership End Date{/ts}: {$mem_end_date|crmDate}\n{/if}\n\n{/if}\n{if $amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{if !$useForMember &amp;&amp; $membership_amount &amp;&amp; $is_quick_config}\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{if $amount &amp;&amp; !$is_separate_payment }\n{ts}Contribution Amount{/ts}: {$amount|crmMoney}\n-------------------------------------------\n{ts}Total{/ts}: {$amount+$membership_amount|crmMoney}\n{/if}\n{elseif !$useForMember &amp;&amp; $lineItem and $priceSetID &amp; !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n---------------------------------------------------------\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_qty}{ts}Qty{/ts}{/capture}\n{capture assign=ts_each}{ts}Each{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_qty|string_format:\"%5s\"} {$ts_each|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"}\n----------------------------------------------------------\n{foreach from=$value item=line}\n{$line.description|truncate:30:\"...\"|string_format:\"%-30s\"} {$line.qty|string_format:\"%5s\"} {$line.unit_price|crmMoney|string_format:\"%10s\"} {$line.line_total|crmMoney|string_format:\"%10s\"}\n{/foreach}\n{/foreach}\n\n{ts}Total Amount{/ts}: {$amount|crmMoney}\n{else}\n{if $useForMember &amp;&amp; $lineItem &amp;&amp; !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_total}{ts}Fee{/ts}{/capture}\n{if $dataArray}\n{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}\n{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}\n{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{/if}\n{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}\n{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_total|string_format:\"%10s\"} {if $dataArray} {$ts_subtotal|string_format:\"%10s\"} {$ts_taxRate|string_format:\"%10s\"} {$ts_taxAmount|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"} {/if} {$ts_start_date|string_format:\"%20s\"} {$ts_end_date|string_format:\"%20s\"}\n--------------------------------------------------------------------------------------------------\n\n{foreach from=$value item=line}\n{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.line_total|crmMoney|string_format:\"%10s\"}  {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:\"%10s\"} {if $line.tax_rate != \"\" || $line.tax_amount != \"\"}  {$line.tax_rate|string_format:\"%.2f\"} %  {$line.tax_amount|crmMoney:$currency|string_format:\"%10s\"} {else}                  {/if}   {$line.line_total+$line.tax_amount|crmMoney|string_format:\"%10s\"} {/if} {$line.start_date|string_format:\"%20s\"} {$line.end_date|string_format:\"%20s\"}\n{/foreach}\n{/foreach}\n\n{if $dataArray}\n{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}\n\n{foreach from=$dataArray item=value key=priceset}\n{if $priceset || $priceset == 0}\n{$taxTerm} {$priceset|string_format:\"%.2f\"}%: {$value|crmMoney:$currency}\n{else}\n{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}\n{/if}\n{/foreach}\n{/if}\n--------------------------------------------------------------------------------------------------\n{/if}\n\n{if $totalTaxAmount}\n{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}\n{/if}\n\n{ts}Amount{/ts}: {$amount|crmMoney} {if $amount_level } - {$amount_level} {/if}\n{/if}\n{elseif $membership_amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{/if}\n\n{if $receive_date}\n\n{ts}Date{/ts}: {$receive_date|crmDate}\n{/if}\n{if $is_monetary and $trxn_id}\n{ts}Transaction #{/ts}: {$trxn_id}\n\n{/if}\n{if $membership_trx_id}\n{ts}Membership Transaction #{/ts}: {$membership_trx_id}\n\n{/if}\n{if $is_recur}\n{ts}This membership will be renewed automatically.{/ts}\n{if $cancelSubscriptionUrl}\n\n{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by visiting this web page: %1.{/ts}\n\n{/if}\n\n{if $updateSubscriptionBillingUrl}\n\n{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by &lt;a href=\"%1\"&gt;visiting this web page&lt;/a&gt;.{/ts}\n{/if}\n{/if}\n\n{if $honor_block_is_active }\n===========================================================\n{$soft_credit_type}\n===========================================================\n{foreach from=$honoreeProfile item=value key=label}\n{$label}: {$value}\n{/foreach}\n\n{/if}\n{if $pcpBlock}\n===========================================================\n{ts}Personal Campaign Page{/ts}\n\n===========================================================\n{ts}Display In Honor Roll{/ts}: {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}\n\n{if $pcp_roll_nickname}{ts}Nickname{/ts}: {$pcp_roll_nickname}{/if}\n\n{if $pcp_personal_note}{ts}Personal Note{/ts}: {$pcp_personal_note}{/if}\n\n{/if}\n{if $onBehalfProfile}\n===========================================================\n{ts}On Behalf Of{/ts}\n\n===========================================================\n{foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}\n{$onBehalfName}: {$onBehalfValue}\n{/foreach}\n{/if}\n\n{if !( $contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\' ) and $is_monetary}\n{if $is_pay_later}\n===========================================================\n{ts}Registered Email{/ts}\n\n===========================================================\n{$email}\n{elseif $amount GT 0 OR $membership_amount GT 0 }\n===========================================================\n{ts}Billing Name and Address{/ts}\n\n===========================================================\n{$billingName}\n{$address}\n\n{$email}\n{/if} {* End ! is_pay_later condition. *}\n{/if}\n{if $contributeMode eq \'direct\' AND !$is_pay_later AND ( $amount GT 0 OR $membership_amount GT 0 ) }\n\n===========================================================\n{ts}Credit Card Information{/ts}\n\n===========================================================\n{$credit_card_type}\n{$credit_card_number}\n{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:\'\'|crmDate}\n{/if}\n\n{if $selectPremium }\n===========================================================\n{ts}Premium Information{/ts}\n\n===========================================================\n{$product_name}\n{if $option}\n{ts}Option{/ts}: {$option}\n{/if}\n{if $sku}\n{ts}SKU{/ts}: {$sku}\n{/if}\n{if $start_date}\n{ts}Start Date{/ts}: {$start_date|crmDate}\n{/if}\n{if $end_date}\n{ts}End Date{/ts}: {$end_date|crmDate}\n{/if}\n{if $contact_email OR $contact_phone}\n\n{ts}For information about this premium, contact:{/ts}\n\n{if $contact_email}\n  {$contact_email}\n{/if}\n{if $contact_phone}\n  {$contact_phone}\n{/if}\n{/if}\n{if $is_deductible AND $price}\n\n{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}{/if}\n{/if}\n\n{if $customPre}\n===========================================================\n{$customPre_grouptitle}\n\n===========================================================\n{foreach from=$customPre item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n\n\n{if $customPost}\n===========================================================\n{$customPost_grouptitle}\n\n===========================================================\n{foreach from=$customPost item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n' WHERE id IN () [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 ')' at line 1]"]
  </code></pre>
  
  <p>)</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-07T21:08:57.813Z
Comments.Text: Is it possible for you to add the DB error in your question? just want to make sure the db query is same in both case you facing.
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-07T21:09:27.773Z
Comments.Text: Add also can you mention at what stage the import fails with fatal error?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-08T02:09:41.340Z
Comments.Text: Thanks Pradeep - it's the same error as last time and occurs as soon as the upgrade url is invoked
Comments.UserDisplayName: LesleyJill
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-09T21:36:27.877Z
Comments.Text: The message template is either missing and linked incorrectly in your database
Comments.UserDisplayName: Pradeep Nayak
Tags: <upgrade><message-templates>
Title: wordpress Upgrade 5.2.2 to 5.14 fails with UPDATE civicrm_msg_template error
ThreadText: # wordpress Upgrade 5.2.2 to 5.14 fails with UPDATE civicrm_msg_template error
  
  (Asked by: username_0 on 2019-06-07)
  
  I've had this problem previously on another site going from 5.2 to 5.10 and was helped here : "[Upgrade 5.2.2 to 5.10.4 fails with UPDATE civicrm\_msg\_template error](https://civicrm.stackexchange.com/questions/28650/upgrade-5-2-2-to-5-10-4-fails-with-update-civicrm-msg-template-error)" with lines to comment out from CRM/Upgrade/Incremental/MessageTemplates.php
  
  Unfortunately MessageTemplates.php has changed quite a lot so I don't know how/if I can use the "comment out" solution.
  
  I have no custom templates
  
  here is the error message
  Jun 07 21:35:46 [info] $Fatal Error Details = Array
  (
  [callback] => Array
  (
  [0] => CRM\_Core\_Error
  [1] => handle
  )
  
  ```
  [code] => -2
  [message] => DB Error: syntax error
  [mode] => 16
  [debug_info] => 
        UPDATE civicrm_msg_template SET msg_text = '{assign var=\"greeting\" value=\"{contact.email_greeting}\"}{if $greeting}{$greeting},{/if}\n{if $receipt_text}\n{$receipt_text}\n{/if}\n{if $is_pay_later}\n\n===========================================================\n{$pay_later_receipt}\n===========================================================\n{else}\n\n{ts}Please print this receipt for your records.{/ts}\n{/if}\n\n{if $membership_assign && !$useForMember}\n===========================================================\n{ts}Membership Information{/ts}\n\n===========================================================\n{ts}Membership Type{/ts}: {$membership_name}\n{if $mem_start_date}{ts}Membership Start Date{/ts}: {$mem_start_date|crmDate}\n{/if}\n{if $mem_end_date}{ts}Membership End Date{/ts}: {$mem_end_date|crmDate}\n{/if}\n\n{/if}\n{if $amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{if !$useForMember && $membership_amount && $is_quick_config}\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{if $amount && !$is_separate_payment }\n{ts}Contribution Amount{/ts}: {$amount|crmMoney}\n-------------------------------------------\n{ts}Total{/ts}: {$amount+$membership_amount|crmMoney}\n{/if}\n{elseif !$useForMember && $lineItem and $priceSetID & !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n---------------------------------------------------------\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_qty}{ts}Qty{/ts}{/capture}\n{capture assign=ts_each}{ts}Each{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_qty|string_format:\"%5s\"} {$ts_each|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"}\n----------------------------------------------------------\n{foreach from=$value item=line}\n{$line.description|truncate:30:\"...\"|string_format:\"%-30s\"} {$line.qty|string_format:\"%5s\"} {$line.unit_price|crmMoney|string_format:\"%10s\"} {$line.line_total|crmMoney|string_format:\"%10s\"}\n{/foreach}\n{/foreach}\n\n{ts}Total Amount{/ts}: {$amount|crmMoney}\n{else}\n{if $useForMember && $lineItem && !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_total}{ts}Fee{/ts}{/capture}\n{if $dataArray}\n{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}\n{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}\n{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{/if}\n{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}\n{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_total|string_format:\"%10s\"} {if $dataArray} {$ts_subtotal|string_format:\"%10s\"} {$ts_taxRate|string_format:\"%10s\"} {$ts_taxAmount|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"} {/if} {$ts_start_date|string_format:\"%20s\"} {$ts_end_date|string_format:\"%20s\"}\n--------------------------------------------------------------------------------------------------\n\n{foreach from=$value item=line}\n{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.line_total|crmMoney|string_format:\"%10s\"}  {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:\"%10s\"} {if $line.tax_rate != \"\" || $line.tax_amount != \"\"}  {$line.tax_rate|string_format:\"%.2f\"} %  {$line.tax_amount|crmMoney:$currency|string_format:\"%10s\"} {else}                  {/if}   {$line.line_total+$line.tax_amount|crmMoney|string_format:\"%10s\"} {/if} {$line.start_date|string_format:\"%20s\"} {$line.end_date|string_format:\"%20s\"}\n{/foreach}\n{/foreach}\n\n{if $dataArray}\n{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}\n\n{foreach from=$dataArray item=value key=priceset}\n{if $priceset || $priceset == 0}\n{$taxTerm} {$priceset|string_format:\"%.2f\"}%: {$value|crmMoney:$currency}\n{else}\n{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}\n{/if}\n{/foreach}\n{/if}\n--------------------------------------------------------------------------------------------------\n{/if}\n\n{if $totalTaxAmount}\n{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}\n{/if}\n\n{ts}Amount{/ts}: {$amount|crmMoney} {if $amount_level } - {$amount_level} {/if}\n{/if}\n{elseif $membership_amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{/if}\n\n{if $receive_date}\n\n{ts}Date{/ts}: {$receive_date|crmDate}\n{/if}\n{if $is_monetary and $trxn_id}\n{ts}Transaction #{/ts}: {$trxn_id}\n\n{/if}\n{if $membership_trx_id}\n{ts}Membership Transaction #{/ts}: {$membership_trx_id}\n\n{/if}\n{if $is_recur}\n{ts}This membership will be renewed automatically.{/ts}\n{if $cancelSubscriptionUrl}\n\n{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by visiting this web page: %1.{/ts}\n\n{/if}\n\n{if $updateSubscriptionBillingUrl}\n\n{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by <a href=\"%1\">visiting this web page</a>.{/ts}\n{/if}\n{/if}\n\n{if $honor_block_is_active }\n===========================================================\n{$soft_credit_type}\n===========================================================\n{foreach from=$honoreeProfile item=value key=label}\n{$label}: {$value}\n{/foreach}\n\n{/if}\n{if $pcpBlock}\n===========================================================\n{ts}Personal Campaign Page{/ts}\n\n===========================================================\n{ts}Display In Honor Roll{/ts}: {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}\n\n{if $pcp_roll_nickname}{ts}Nickname{/ts}: {$pcp_roll_nickname}{/if}\n\n{if $pcp_personal_note}{ts}Personal Note{/ts}: {$pcp_personal_note}{/if}\n\n{/if}\n{if $onBehalfProfile}\n===========================================================\n{ts}On Behalf Of{/ts}\n\n===========================================================\n{foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}\n{$onBehalfName}: {$onBehalfValue}\n{/foreach}\n{/if}\n\n{if !( $contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\' ) and $is_monetary}\n{if $is_pay_later}\n===========================================================\n{ts}Registered Email{/ts}\n\n===========================================================\n{$email}\n{elseif $amount GT 0 OR $membership_amount GT 0 }\n===========================================================\n{ts}Billing Name and Address{/ts}\n\n===========================================================\n{$billingName}\n{$address}\n\n{$email}\n{/if} {* End ! is_pay_later condition. *}\n{/if}\n{if $contributeMode eq \'direct\' AND !$is_pay_later AND ( $amount GT 0 OR $membership_amount GT 0 ) }\n\n===========================================================\n{ts}Credit Card Information{/ts}\n\n===========================================================\n{$credit_card_type}\n{$credit_card_number}\n{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:\'\'|crmDate}\n{/if}\n\n{if $selectPremium }\n===========================================================\n{ts}Premium Information{/ts}\n\n===========================================================\n{$product_name}\n{if $option}\n{ts}Option{/ts}: {$option}\n{/if}\n{if $sku}\n{ts}SKU{/ts}: {$sku}\n{/if}\n{if $start_date}\n{ts}Start Date{/ts}: {$start_date|crmDate}\n{/if}\n{if $end_date}\n{ts}End Date{/ts}: {$end_date|crmDate}\n{/if}\n{if $contact_email OR $contact_phone}\n\n{ts}For information about this premium, contact:{/ts}\n\n{if $contact_email}\n  {$contact_email}\n{/if}\n{if $contact_phone}\n  {$contact_phone}\n{/if}\n{/if}\n{if $is_deductible AND $price}\n\n{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}{/if}\n{/if}\n\n{if $customPre}\n===========================================================\n{$customPre_grouptitle}\n\n===========================================================\n{foreach from=$customPre item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n\n\n{if $customPost}\n===========================================================\n{$customPost_grouptitle}\n\n===========================================================\n{foreach from=$customPost item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n' WHERE id IN () [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 ')' at line 1]
  [type] => DB_Error
  [user_info] => 
        UPDATE civicrm_msg_template SET msg_text = '{assign var=\"greeting\" value=\"{contact.email_greeting}\"}{if $greeting}{$greeting},{/if}\n{if $receipt_text}\n{$receipt_text}\n{/if}\n{if $is_pay_later}\n\n===========================================================\n{$pay_later_receipt}\n===========================================================\n{else}\n\n{ts}Please print this receipt for your records.{/ts}\n{/if}\n\n{if $membership_assign && !$useForMember}\n===========================================================\n{ts}Membership Information{/ts}\n\n===========================================================\n{ts}Membership Type{/ts}: {$membership_name}\n{if $mem_start_date}{ts}Membership Start Date{/ts}: {$mem_start_date|crmDate}\n{/if}\n{if $mem_end_date}{ts}Membership End Date{/ts}: {$mem_end_date|crmDate}\n{/if}\n\n{/if}\n{if $amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{if !$useForMember && $membership_amount && $is_quick_config}\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{if $amount && !$is_separate_payment }\n{ts}Contribution Amount{/ts}: {$amount|crmMoney}\n-------------------------------------------\n{ts}Total{/ts}: {$amount+$membership_amount|crmMoney}\n{/if}\n{elseif !$useForMember && $lineItem and $priceSetID & !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n---------------------------------------------------------\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_qty}{ts}Qty{/ts}{/capture}\n{capture assign=ts_each}{ts}Each{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_qty|string_format:\"%5s\"} {$ts_each|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"}\n----------------------------------------------------------\n{foreach from=$value item=line}\n{$line.description|truncate:30:\"...\"|string_format:\"%-30s\"} {$line.qty|string_format:\"%5s\"} {$line.unit_price|crmMoney|string_format:\"%10s\"} {$line.line_total|crmMoney|string_format:\"%10s\"}\n{/foreach}\n{/foreach}\n\n{ts}Total Amount{/ts}: {$amount|crmMoney}\n{else}\n{if $useForMember && $lineItem && !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_total}{ts}Fee{/ts}{/capture}\n{if $dataArray}\n{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}\n{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}\n{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{/if}\n{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}\n{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_total|string_format:\"%10s\"} {if $dataArray} {$ts_subtotal|string_format:\"%10s\"} {$ts_taxRate|string_format:\"%10s\"} {$ts_taxAmount|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"} {/if} {$ts_start_date|string_format:\"%20s\"} {$ts_end_date|string_format:\"%20s\"}\n--------------------------------------------------------------------------------------------------\n\n{foreach from=$value item=line}\n{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.line_total|crmMoney|string_format:\"%10s\"}  {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:\"%10s\"} {if $line.tax_rate != \"\" || $line.tax_amount != \"\"}  {$line.tax_rate|string_format:\"%.2f\"} %  {$line.tax_amount|crmMoney:$currency|string_format:\"%10s\"} {else}                  {/if}   {$line.line_total+$line.tax_amount|crmMoney|string_format:\"%10s\"} {/if} {$line.start_date|string_format:\"%20s\"} {$line.end_date|string_format:\"%20s\"}\n{/foreach}\n{/foreach}\n\n{if $dataArray}\n{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}\n\n{foreach from=$dataArray item=value key=priceset}\n{if $priceset || $priceset == 0}\n{$taxTerm} {$priceset|string_format:\"%.2f\"}%: {$value|crmMoney:$currency}\n{else}\n{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}\n{/if}\n{/foreach}\n{/if}\n--------------------------------------------------------------------------------------------------\n{/if}\n\n{if $totalTaxAmount}\n{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}\n{/if}\n\n{ts}Amount{/ts}: {$amount|crmMoney} {if $amount_level } - {$amount_level} {/if}\n{/if}\n{elseif $membership_amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{/if}\n\n{if $receive_date}\n\n{ts}Date{/ts}: {$receive_date|crmDate}\n{/if}\n{if $is_monetary and $trxn_id}\n{ts}Transaction #{/ts}: {$trxn_id}\n\n{/if}\n{if $membership_trx_id}\n{ts}Membership Transaction #{/ts}: {$membership_trx_id}\n\n{/if}\n{if $is_recur}\n{ts}This membership will be renewed automatically.{/ts}\n{if $cancelSubscriptionUrl}\n\n{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by visiting this web page: %1.{/ts}\n\n{/if}\n\n{if $updateSubscriptionBillingUrl}\n\n{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by <a href=\"%1\">visiting this web page</a>.{/ts}\n{/if}\n{/if}\n\n{if $honor_block_is_active }\n===========================================================\n{$soft_credit_type}\n===========================================================\n{foreach from=$honoreeProfile item=value key=label}\n{$label}: {$value}\n{/foreach}\n\n{/if}\n{if $pcpBlock}\n===========================================================\n{ts}Personal Campaign Page{/ts}\n\n===========================================================\n{ts}Display In Honor Roll{/ts}: {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}\n\n{if $pcp_roll_nickname}{ts}Nickname{/ts}: {$pcp_roll_nickname}{/if}\n\n{if $pcp_personal_note}{ts}Personal Note{/ts}: {$pcp_personal_note}{/if}\n\n{/if}\n{if $onBehalfProfile}\n===========================================================\n{ts}On Behalf Of{/ts}\n\n===========================================================\n{foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}\n{$onBehalfName}: {$onBehalfValue}\n{/foreach}\n{/if}\n\n{if !( $contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\' ) and $is_monetary}\n{if $is_pay_later}\n===========================================================\n{ts}Registered Email{/ts}\n\n===========================================================\n{$email}\n{elseif $amount GT 0 OR $membership_amount GT 0 }\n===========================================================\n{ts}Billing Name and Address{/ts}\n\n===========================================================\n{$billingName}\n{$address}\n\n{$email}\n{/if} {* End ! is_pay_later condition. *}\n{/if}\n{if $contributeMode eq \'direct\' AND !$is_pay_later AND ( $amount GT 0 OR $membership_amount GT 0 ) }\n\n===========================================================\n{ts}Credit Card Information{/ts}\n\n===========================================================\n{$credit_card_type}\n{$credit_card_number}\n{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:\'\'|crmDate}\n{/if}\n\n{if $selectPremium }\n===========================================================\n{ts}Premium Information{/ts}\n\n===========================================================\n{$product_name}\n{if $option}\n{ts}Option{/ts}: {$option}\n{/if}\n{if $sku}\n{ts}SKU{/ts}: {$sku}\n{/if}\n{if $start_date}\n{ts}Start Date{/ts}: {$start_date|crmDate}\n{/if}\n{if $end_date}\n{ts}End Date{/ts}: {$end_date|crmDate}\n{/if}\n{if $contact_email OR $contact_phone}\n\n{ts}For information about this premium, contact:{/ts}\n\n{if $contact_email}\n  {$contact_email}\n{/if}\n{if $contact_phone}\n  {$contact_phone}\n{/if}\n{/if}\n{if $is_deductible AND $price}\n\n{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}{/if}\n{/if}\n\n{if $customPre}\n===========================================================\n{$customPre_grouptitle}\n\n===========================================================\n{foreach from=$customPre item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n\n\n{if $customPost}\n===========================================================\n{$customPost_grouptitle}\n\n===========================================================\n{foreach from=$customPost item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n' WHERE id IN () [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 ')' at line 1]
  [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="
        UPDATE civicrm_msg_template SET msg_text = '{assign var=\"greeting\" value=\"{contact.email_greeting}\"}{if $greeting}{$greeting},{/if}\n{if $receipt_text}\n{$receipt_text}\n{/if}\n{if $is_pay_later}\n\n===========================================================\n{$pay_later_receipt}\n===========================================================\n{else}\n\n{ts}Please print this receipt for your records.{/ts}\n{/if}\n\n{if $membership_assign && !$useForMember}\n===========================================================\n{ts}Membership Information{/ts}\n\n===========================================================\n{ts}Membership Type{/ts}: {$membership_name}\n{if $mem_start_date}{ts}Membership Start Date{/ts}: {$mem_start_date|crmDate}\n{/if}\n{if $mem_end_date}{ts}Membership End Date{/ts}: {$mem_end_date|crmDate}\n{/if}\n\n{/if}\n{if $amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{if !$useForMember && $membership_amount && $is_quick_config}\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{if $amount && !$is_separate_payment }\n{ts}Contribution Amount{/ts}: {$amount|crmMoney}\n-------------------------------------------\n{ts}Total{/ts}: {$amount+$membership_amount|crmMoney}\n{/if}\n{elseif !$useForMember && $lineItem and $priceSetID & !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n---------------------------------------------------------\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_qty}{ts}Qty{/ts}{/capture}\n{capture assign=ts_each}{ts}Each{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_qty|string_format:\"%5s\"} {$ts_each|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"}\n----------------------------------------------------------\n{foreach from=$value item=line}\n{$line.description|truncate:30:\"...\"|string_format:\"%-30s\"} {$line.qty|string_format:\"%5s\"} {$line.unit_price|crmMoney|string_format:\"%10s\"} {$line.line_total|crmMoney|string_format:\"%10s\"}\n{/foreach}\n{/foreach}\n\n{ts}Total Amount{/ts}: {$amount|crmMoney}\n{else}\n{if $useForMember && $lineItem && !$is_quick_config}\n{foreach from=$lineItem item=value key=priceset}\n{capture assign=ts_item}{ts}Item{/ts}{/capture}\n{capture assign=ts_total}{ts}Fee{/ts}{/capture}\n{if $dataArray}\n{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}\n{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}\n{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}\n{capture assign=ts_total}{ts}Total{/ts}{/capture}\n{/if}\n{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}\n{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}\n{$ts_item|string_format:\"%-30s\"} {$ts_total|string_format:\"%10s\"} {if $dataArray} {$ts_subtotal|string_format:\"%10s\"} {$ts_taxRate|string_format:\"%10s\"} {$ts_taxAmount|string_format:\"%10s\"} {$ts_total|string_format:\"%10s\"} {/if} {$ts_start_date|string_format:\"%20s\"} {$ts_end_date|string_format:\"%20s\"}\n--------------------------------------------------------------------------------------------------\n\n{foreach from=$value item=line}\n{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.line_total|crmMoney|string_format:\"%10s\"}  {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:\"%10s\"} {if $line.tax_rate != \"\" || $line.tax_amount != \"\"}  {$line.tax_rate|string_format:\"%.2f\"} %  {$line.tax_amount|crmMoney:$currency|string_format:\"%10s\"} {else}                  {/if}   {$line.line_total+$line.tax_amount|crmMoney|string_format:\"%10s\"} {/if} {$line.start_date|string_format:\"%20s\"} {$line.end_date|string_format:\"%20s\"}\n{/foreach}\n{/foreach}\n\n{if $dataArray}\n{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}\n\n{foreach from=$dataArray item=value key=priceset}\n{if $priceset || $priceset == 0}\n{$taxTerm} {$priceset|string_format:\"%.2f\"}%: {$value|crmMoney:$currency}\n{else}\n{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}\n{/if}\n{/foreach}\n{/if}\n--------------------------------------------------------------------------------------------------\n{/if}\n\n{if $totalTaxAmount}\n{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}\n{/if}\n\n{ts}Amount{/ts}: {$amount|crmMoney} {if $amount_level } - {$amount_level} {/if}\n{/if}\n{elseif $membership_amount}\n===========================================================\n{ts}Membership Fee{/ts}\n\n===========================================================\n{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}\n{/if}\n\n{if $receive_date}\n\n{ts}Date{/ts}: {$receive_date|crmDate}\n{/if}\n{if $is_monetary and $trxn_id}\n{ts}Transaction #{/ts}: {$trxn_id}\n\n{/if}\n{if $membership_trx_id}\n{ts}Membership Transaction #{/ts}: {$membership_trx_id}\n\n{/if}\n{if $is_recur}\n{ts}This membership will be renewed automatically.{/ts}\n{if $cancelSubscriptionUrl}\n\n{ts 1=$cancelSubscriptionUrl}You can cancel the auto-renewal option by visiting this web page: %1.{/ts}\n\n{/if}\n\n{if $updateSubscriptionBillingUrl}\n\n{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by <a href=\"%1\">visiting this web page</a>.{/ts}\n{/if}\n{/if}\n\n{if $honor_block_is_active }\n===========================================================\n{$soft_credit_type}\n===========================================================\n{foreach from=$honoreeProfile item=value key=label}\n{$label}: {$value}\n{/foreach}\n\n{/if}\n{if $pcpBlock}\n===========================================================\n{ts}Personal Campaign Page{/ts}\n\n===========================================================\n{ts}Display In Honor Roll{/ts}: {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}\n\n{if $pcp_roll_nickname}{ts}Nickname{/ts}: {$pcp_roll_nickname}{/if}\n\n{if $pcp_personal_note}{ts}Personal Note{/ts}: {$pcp_personal_note}{/if}\n\n{/if}\n{if $onBehalfProfile}\n===========================================================\n{ts}On Behalf Of{/ts}\n\n===========================================================\n{foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}\n{$onBehalfName}: {$onBehalfValue}\n{/foreach}\n{/if}\n\n{if !( $contributeMode eq \'notify\' OR $contributeMode eq \'directIPN\' ) and $is_monetary}\n{if $is_pay_later}\n===========================================================\n{ts}Registered Email{/ts}\n\n===========================================================\n{$email}\n{elseif $amount GT 0 OR $membership_amount GT 0 }\n===========================================================\n{ts}Billing Name and Address{/ts}\n\n===========================================================\n{$billingName}\n{$address}\n\n{$email}\n{/if} {* End ! is_pay_later condition. *}\n{/if}\n{if $contributeMode eq \'direct\' AND !$is_pay_later AND ( $amount GT 0 OR $membership_amount GT 0 ) }\n\n===========================================================\n{ts}Credit Card Information{/ts}\n\n===========================================================\n{$credit_card_type}\n{$credit_card_number}\n{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:\'\'|crmDate}\n{/if}\n\n{if $selectPremium }\n===========================================================\n{ts}Premium Information{/ts}\n\n===========================================================\n{$product_name}\n{if $option}\n{ts}Option{/ts}: {$option}\n{/if}\n{if $sku}\n{ts}SKU{/ts}: {$sku}\n{/if}\n{if $start_date}\n{ts}Start Date{/ts}: {$start_date|crmDate}\n{/if}\n{if $end_date}\n{ts}End Date{/ts}: {$end_date|crmDate}\n{/if}\n{if $contact_email OR $contact_phone}\n\n{ts}For information about this premium, contact:{/ts}\n\n{if $contact_email}\n  {$contact_email}\n{/if}\n{if $contact_phone}\n  {$contact_phone}\n{/if}\n{/if}\n{if $is_deductible AND $price}\n\n{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}{/if}\n{/if}\n\n{if $customPre}\n===========================================================\n{$customPre_grouptitle}\n\n===========================================================\n{foreach from=$customPre item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n\n\n{if $customPost}\n===========================================================\n{$customPost_grouptitle}\n\n===========================================================\n{foreach from=$customPost item=customValue key=customName}\n{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}\n {$customName}: {$customValue}\n{/if}\n{/foreach}\n{/if}\n' WHERE id IN () [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 ')' at line 1]"]
  
  ```
  
  )
  
  **Tags:** upgrade, message-templates
  
  > **Comments:**
  > **username_1**: Is it possible for you to add the DB error in your question? just want to make sure the db query is same in both case you facing.  
  > **username_1**: Add also can you mention at what stage the import fails with fatal error?  
  > **username_0**: Thanks username_1 - it's the same error as last time and occurs as soon as the upgrade url is invoked  
  > **username_1**: The message template is either missing and linked incorrectly in your database  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-06-09. Score: 1
  
  The message template 'Memberships - Receipt (on-line)' is either missing and linked incorrectly in your database. Try running below query to fix the data before running the upgrade.
  
  ```
  SELECT @option_group_id_msg_tmp := max(id) from civicrm_option_group WHERE name = 'msg_tpl_workflow_membership';
  SELECT @option_option_value_id := max(id) from civicrm_option_value WHERE name = 'membership_online_receipt' AND option_group_id = @option_group_id_msg_tmp;
  UPDATE civicrm_msg_template SET workflow_id = @option_option_value_id WHERE workflow_id IS NOT NULL AND msg_title LIKE "Memberships - Receipt (on-line)";
  
  ```
  
  Cheers
  
  username_1
  
  
  ---
  
  