From: Web Access Date: Fri, 15 Jan 2016 09:40:53 +0000 (+0530) Subject: CRM-17815 fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2f3e0ab649a4c7b3153243e19a5953237380c545;p=civicrm-core.git CRM-17815 fix --- diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index f0a0c912ec..90cd0e3dfc 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -245,6 +245,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { $contributionStatusID = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); $refundedStatusId = CRM_Utils_Array::key('Refunded', $contributionStatusID); $cancelledStatusId = CRM_Utils_Array::key('Cancelled', $contributionStatusID); + $pendingStatusId = CRM_Utils_Array::key('Pending', $contributionStatusID); // getting data from admin page $prefixValue = Civi::settings()->get('contribution_invoice_settings'); @@ -428,6 +429,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { 'lineItem' => $lineItem, 'dataArray' => $dataArray, 'refundedStatusId' => $refundedStatusId, + 'pendingStatusId' => $pendingStatusId, 'cancelledStatusId' => $cancelledStatusId, 'contribution_status_id' => $contribution->contribution_status_id, 'subTotal' => $subTotal, diff --git a/CRM/Upgrade/4.7.beta8.msg_template/civicrm_msg_template.tpl b/CRM/Upgrade/4.7.beta8.msg_template/civicrm_msg_template.tpl new file mode 100644 index 0000000000..c1335a695c --- /dev/null +++ b/CRM/Upgrade/4.7.beta8.msg_template/civicrm_msg_template.tpl @@ -0,0 +1,16 @@ +{php} + $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.7.beta8.msg_template/message_templates'; + $templates = array(); + foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) { + $parts = explode('_', basename($filename, '.tpl')); + $templates[] = array('type' => array_pop($parts), 'name' => implode('_', $parts), 'filename' => "$dir/$filename"); + } + $this->assign('templates', $templates); +{/php} + +{foreach from=$templates item=tpl} + {fetch assign=content file=$tpl.filename} + SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = '{$tpl.name}'; + SELECT @content := msg_{$tpl.type} FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1; + UPDATE civicrm_msg_template SET msg_{$tpl.type} = '{$content|escape:"quotes"}' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_{$tpl.type} = @content)); +{/foreach} diff --git a/CRM/Upgrade/4.7.beta8.msg_template/message_templates/contribution_invoice_receipt_html.tpl b/CRM/Upgrade/4.7.beta8.msg_template/message_templates/contribution_invoice_receipt_html.tpl new file mode 100644 index 0000000000..16064ca53c --- /dev/null +++ b/CRM/Upgrade/4.7.beta8.msg_template/message_templates/contribution_invoice_receipt_html.tpl @@ -0,0 +1,437 @@ + + + + + + + + + + + +
+
+ + + + + + + + + {if $organization_name} + + {else} + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{ts}INVOICE{/ts}{ts}Invoice Date:{/ts}{$domain_organization}
{$display_name} ({$organization_name}){$display_name}{$invoice_date} + {if $domain_street_address } + {$domain_street_address} + {/if} + {if $domain_supplemental_address_1 }{$domain_supplemental_address_1}{/if}
{$street_address} {$supplemental_address_1}{ts}Invoice Number:{/ts}{if $domain_supplemental_address_2 }{$domain_supplemental_address_2}{/if} + {if $domain_state }{$domain_state}{/if}
{$supplemental_address_2} {$stateProvinceAbbreviation}{$invoice_id}{if $domain_city} + {$domain_city} + {/if} + {if $domain_postal_code } + {$domain_postal_code} + {/if} +
{$city} {$postal_code}{ts}Reference:{/ts} {if $domain_country} + {$domain_country} + {/if}
{$source} {if $domain_phone}{$domain_phone}{/if}
{if $domain_email} + {$domain_email} + {/if}
+ + + + +
+ {* FIXME: style this table so that it looks like the text version (justification, etc.) *} + + + + + + + + {foreach from=$lineItem item=value key=priceset name=taxpricevalue} + {if $smarty.foreach.taxpricevalue.index eq 0} + + {else} + + {/if} + + + + + {if $value.tax_amount != ''} + + {else} + + {/if} + + + {/foreach} + + + + + + + {foreach from = $dataArray item = value key = priceset} + + + {if $priceset} + + + {elseif $priceset == 0} + + + + {/if} + {/foreach} + + + + + + + + + + + + {if $is_pay_later == 0} + + + + + + + + + + + + + + + {/if} +


+ + + + {if $contribution_status_id == $pendingStatusId && $is_pay_later == 1} + + + + + {/if} +
{ts}Description{/ts}{ts}Quantity{/ts}{ts}Unit Price{/ts}{$taxTerm} {ts 1=$defaultCurrency}Amount %1{/ts}


+ {if $value.html_type eq 'Text'}{$value.label}{else}{$value.field_title} - {$value.label}{/if} {if $value.description}
{$value.description|truncate:30:"..."}
{/if} +
{$value.qty} {$value.unit_price|crmMoney:$currency} {$value.tax_rate}%{ts 1=$taxTerm}No %1{/ts}{$value.subTotal|crmMoney:$currency}

{ts}Sub Total{/ts} {$subTotal|crmMoney:$currency}
{ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{$value|crmMoney:$currency} {ts 1=$taxTerm}TOTAL NO %1{/ts}{$value|crmMoney:$currency}

{ts 1=$defaultCurrency}TOTAL %1{/ts}{$amount|crmMoney:$currency}
+ {if $contribution_status_id == $refundedStatusId} + {ts}LESS Amount Credited{/ts} + {else} + {ts}LESS Amount Paid{/ts} + {/if} + {$amount|crmMoney:$currency}

{ts}AMOUNT DUE:{/ts} {$amountDue|crmMoney:$currency}
{ts 1=$dueDate}DUE DATE: %1{/ts}
+
+ + + + +
+ + + + + +
{ts}PAYMENT ADVICE{/ts}

{ts}To: {/ts}
+ {$domain_organization}
+ {$domain_street_address} {$domain_supplemental_address_1}
+ {$domain_supplemental_address_2} {$domain_state}
+ {$domain_city} {$domain_postal_code}
+ {$domain_country}
+ {$domain_phone}
+ {$domain_email}
+


{$notes} +
+ + + + + + + + + + + + + {if $is_pay_later == 1} + + + + + + {else} + + + + + + {/if} + + + {if $contribution_status_id == $pendingStatusId && $is_pay_later == 1} + + + {/if} + + + + +
{ts}Customer: {/ts}{$display_name}
{ts}Invoice Number: {/ts}{$invoice_id}

{ts}Amount Due:{/ts}{$amount|crmMoney:$currency}
{ts}Amount Due: {/ts}{$amountDue|crmMoney:$currency}
{ts}Due Date: {/ts}{$dueDate}

+
+ + + {if $contribution_status_id == $refundedStatusId || $contribution_status_id == $cancelledStatusId} + + + + +
+
+ + + + + + + + + + {if $organization_name} + + {else} + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{ts}CREDIT NOTE{/ts}{ts}Date:{/ts}{$domain_organization}
{$display_name} ({$organization_name}){$display_name}{$invoice_date} + {if $domain_street_address } + {$domain_street_address} + {/if} + {if $domain_supplemental_address_1 } + {$domain_supplemental_address_1} + {/if}
{$street_address} {$supplemental_address_1}{ts}Credit Note Number:{/ts}{if $domain_supplemental_address_2 } + {$domain_supplemental_address_2} + {/if} + {if $domain_state } + {$domain_state} + {/if} +
{$supplemental_address_2} {$stateProvinceAbbreviation}{$creditnote_id}{if $domain_city} + {$domain_city} + {/if} + {if $domain_postal_code } + {$domain_postal_code} + {/if} +
{$city} {$postal_code}{ts}Reference:{/ts} {if $domain_country} + {$domain_country} + {/if}
{$source} {if $domain_phone} + {$domain_phone} + {/if}
{if $domain_email} + {$domain_email} + {/if}
+ + + + + +
+ {* FIXME: style this table so that it looks like the text version (justification, etc.) *} + + + + + + + + {foreach from=$lineItem item=value key=priceset name=pricevalue} + {if $smarty.foreach.pricevalue.index eq 0} + + {else} + + {/if} + + + + + {if $value.tax_amount != ''} + + {else} + + {/if} + + + {/foreach} + + + + + + + {foreach from = $dataArray item = value key = priceset} + + + {if $priceset} + + + {elseif $priceset == 0} + + + + {/if} + {/foreach} + + + + + + + + + + + + {if $is_pay_later == 0} + + + + + + + + + + + + + + + + {/if} +


+ + + + + + + +
{ts}Description{/ts}{ts}Quantity{/ts}{ts}Unit Price{/ts}{$taxTerm} {ts 1=$defaultCurrency}Amount %1{/ts}


+ {if $value.html_type eq 'Text'}{$value.label}{else}{$value.field_title} - {$value.label}{/if} {if $value.description}
{$value.description|truncate:30:"..."}
{/if} +
{$value.qty} {$value.unit_price|crmMoney:$currency} {$value.tax_rate}%{ts 1=$taxTerm}No %1{/ts}{$value.subTotal|crmMoney:$currency}

{ts}Sub Total{/ts} {$subTotal|crmMoney:$currency}
{ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{$value|crmMoney:$currency} {ts 1=$taxTerm}TOTAL NO %1{/ts}{$value|crmMoney:$currency}

{ts 1=$defaultCurrency}TOTAL %1{/ts}{$amount|crmMoney:$currency}
{ts}LESS Credit to invoice(s){/ts}{$amount|crmMoney:$currency}

{ts}REMAINING CREDIT{/ts}{$amountDue|crmMoney:$currency}
+
+ + + + + +
+ + + + + + +
{ts}CREDIT ADVICE{/ts}

{ts}Please do not pay on this advice. Deduct the amount of this Credit Note from your next payment to us{/ts}

+ + + + + + + + + + + + + + + + + +
{ts}Customer:{/ts} {$display_name}
{ts}Credit Note#:{/ts} {$creditnote_id}

{ts}Credit Amount:{/ts}{$amount|crmMoney:$currency}
+
+ {/if} +
+ + diff --git a/CRM/Upgrade/Incremental/sql/4.7.beta8.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.7.beta8.mysql.tpl index 9f51e0679a..e62327848d 100644 --- a/CRM/Upgrade/Incremental/sql/4.7.beta8.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.7.beta8.mysql.tpl @@ -6,3 +6,7 @@ UPDATE civicrm_membership_block cmb JOIN civicrm_price_set_entity cpse ON cmb.en -- CRM-17429 - Old contributions may be using this payment processor type, so we'll disable rather than delete it for existing installs: UPDATE civicrm_payment_processor_type SET is_active = 0 WHERE name = 'Google_Checkout'; UPDATE civicrm_payment_processor pp, civicrm_payment_processor_type ppt SET pp.is_active = 0 WHERE pp.payment_processor_type_id = ppt.id AND ppt.name = 'Google_Checkout'; + +-- CRM-17815 +{include file='../CRM/Upgrade/4.7.beta8.msg_template/civicrm_msg_template.tpl'} + diff --git a/xml/templates/message_templates/contribution_invoice_receipt_html.tpl b/xml/templates/message_templates/contribution_invoice_receipt_html.tpl index 6794485467..16064ca53c 100644 --- a/xml/templates/message_templates/contribution_invoice_receipt_html.tpl +++ b/xml/templates/message_templates/contribution_invoice_receipt_html.tpl @@ -160,10 +160,12 @@ - - {ts 1=$dueDate}DUE DATE: %1{/ts} - - + {if $contribution_status_id == $pendingStatusId && $is_pay_later == 1} + + {ts 1=$dueDate}DUE DATE: %1{/ts} + + + {/if} @@ -213,8 +215,10 @@ {/if} - {ts}Due Date: {/ts} - {$dueDate} + {if $contribution_status_id == $pendingStatusId && $is_pay_later == 1} + {ts}Due Date: {/ts} + {$dueDate} + {/if}