From 82b0700d8ba02b1afadc9ee8a16e5a858ba32734 Mon Sep 17 00:00:00 2001 From: Parag Bhilkar Date: Tue, 12 Aug 2014 16:00:43 +0530 Subject: [PATCH] VAT-651 Move message templates and db fixes to beta5. --- .../contribution_invoice_receipt_html.tpl | 434 ------------------ .../contribution_invoice_receipt_subject.tpl | 2 - .../contribution_invoice_receipt_text.tpl | 1 - .../contribution_invoice_receipt_html.tpl | 278 ++++++----- .../contribution_online_receipt_html.tpl | 2 +- .../contribution_online_receipt_text.tpl | 2 +- .../event_online_receipt_html.tpl | 2 +- .../event_online_receipt_text.tpl | 2 +- .../membership_offline_receipt_html.tpl | 2 +- .../membership_offline_receipt_text.tpl | 2 +- .../Incremental/sql/4.5.alpha1.mysql.tpl | 54 --- .../Incremental/sql/4.5.beta5.mysql.tpl | 57 ++- 12 files changed, 227 insertions(+), 611 deletions(-) delete mode 100644 CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl delete mode 100644 CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl delete mode 100644 CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_text.tpl diff --git a/CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl b/CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl deleted file mode 100644 index 421c123589..0000000000 --- a/CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - - - - - - -
-
- - - - - - - - - {if $organization_name} - - {else} - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TAX INVOICEInvoice Date:{$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}Incoice Number:{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}Reference: {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} -


- - - - - - - -
DescriptionQuantityUnit Price{$taxTerm} Amount {$defaultCurrency}


- {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}%No {$taxTerm}{$value.subTotal|crmMoney:$currency}

Sub Total {$subTotal|crmMoney:$currency}
TOTAL {$taxTerm} {$priceset}%{$value|crmMoney:$currency} TOTAL NO {$taxTerm}{$value|crmMoney:$currency}

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

AMOUNT DUE: {$amountDue|crmMoney:$currency}
DUE DATE: {$dueDate}
-
- - - - -
- - - - - -
PAYMENT ADVICE

To:
- {$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} - - - - - - - - -
Customer: {$display_name}
Invoice Number: {$invoice_id}

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

-
- - - {if $contribution_status_id == $refundedStatusId} - - - - -
-
- - - - - - - - - - {if $organization_name} - - {else} - - {/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CREDIT NOTEDate:{$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}Credit Note Number:{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}Reference: {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} -


- - - - - - - -
DescriptionQuantityUnit Price{$taxTerm} Amount {$defaultCurrency}


- {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}%No {$taxTerm}{$value.subTotal|crmMoney:$currency}

Sub Total {$subTotal|crmMoney:$currency}
TOTAL {$taxTerm} {$priceset}%{$value|crmMoney:$currency} TOTAL NO {$taxTerm}{$value|crmMoney:$currency}

TOTAL {$defaultCurrency}{$amount|crmMoney:$currency}
LESS Credit to invoice(s){$amount|crmMoney:$currency}

REMAINING CREDIT{$amountDue|crmMoney:$currency}
-
- - - - - -
- - - - - - -
CREDIT ADVICE

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

- - - - - - - - - - - - - - - - - -
Customer: {$display_name}
Credit Note#: {$creditnote_id}

Credit Amount:{$amount|crmMoney:$currency}
-
- {/if} -
- - diff --git a/CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl b/CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl deleted file mode 100644 index fb7e871ba4..0000000000 --- a/CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{if $title}{if $component}{if $component == 'event'} {ts}Event Registration Invoice:-{$title}{/ts}{else}{ts}Contribution Invoice : - {$title}{/ts}{/if}{/if} {else} {ts}Invoice {/ts} {/if} diff --git a/CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_text.tpl b/CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_text.tpl deleted file mode 100644 index 37e2edf09d..0000000000 --- a/CRM/Upgrade/4.5.alpha1.msg_template/message_templates/contribution_invoice_receipt_text.tpl +++ /dev/null @@ -1 +0,0 @@ -{ts}Contribution Invoice{/ts} diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_html.tpl b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_html.tpl index db609f9c82..421c123589 100644 --- a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_html.tpl +++ b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_html.tpl @@ -5,57 +5,76 @@ - +
-

- +
- - - + - - - - + + {if $organization_name} - - {else} - + + {else} + {/if} - + + - + - - + + - + - + + - + - + + + + + + + + - + +
TAX INVOICETAX INVOICE Invoice Date:{$organization_name}Invoice Date:{$domain_organization}
{$display_name} ({$organization_name}){$display_name}{$display_name} ({$organization_name}){$display_name}{$invoice_date}{$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}{$street_address} {$supplemental_address_1} Incoice Number:Incoice Number:{if $domain_supplemental_address_2 }{$domain_supplemental_address_2}{/if} + {if $domain_state }{$domain_state}{/if}
{$supplemental_address_2} {$stateProvinceAbbreviation}{$supplemental_address_2} {$stateProvinceAbbreviation} {$invoice_id}{$invoice_id}{if $domain_city} + {$domain_city} + {/if} + {if $domain_postal_code } + {$domain_postal_code} + {/if} +
{$city} {$postal_code}{$city} {$postal_code} Reference:Reference: {if $domain_country} + {$domain_country} + {/if}
{$source} {if $domain_phone}{$domain_phone}{/if}
{$title} {if $domain_email} + {$domain_email} + {/if}
- - +
{* FIXME: style this table so that it looks like the text version (justification, etc.) *} @@ -66,8 +85,12 @@ - {foreach from=$lineItem item=value key=priceset} - + {foreach from=$lineItem item=value key=priceset name=taxpricevalue} + {if $smarty.foreach.taxpricevalue.index eq 0} + + {else} + + {/if} {if $value.tax_amount != ''} - {else} - + {else} + {/if} - {/foreach} + {/foreach} - + {foreach from = $dataArray item = value key = priceset} {if $priceset} - + - {elseif $priceset == 0} - - + {elseif $priceset == 0} + + {/if} {/foreach} @@ -107,16 +130,20 @@ - + {if $is_pay_later == 0} - - - - + + @@ -125,51 +152,52 @@ - - - - - + + {/if}


- - - - + +
{$taxTerm} Amount {$defaultCurrency}



{if $value.html_type eq 'Text'}{$value.label}{else}{$value.field_title} - {$value.label}{/if} {if $value.description}
{$value.description|truncate:30:"..."}
{/if} @@ -76,27 +99,27 @@
{$value.unit_price|crmMoney:$currency} {$value.tax_rate}%No {$taxTerm}No {$taxTerm}{$value.subTotal|crmMoney:$currency}

Sub TotalSub Total {$subTotal|crmMoney:$currency}
TOTAL {$taxTerm} {$priceset}% TOTAL {$taxTerm} {$priceset}% {$value|crmMoney:$currency} TOTAL NO {$taxTerm}{$value|crmMoney:$currency} TOTAL NO {$taxTerm}{$value|crmMoney:$currency}
TOTAL {$defaultCurrency}TOTAL {$defaultCurrency} {$amount|crmMoney:$currency}
LESS Amount Paid + {if $contribution_status_id == $refundedStatusId} + LESS Amount Credited + {else} + LESS Amount Paid + {/if} + {$amount|crmMoney:$currency}
AMOUNT DUE: {$amountDue|crmMoney:$currency}AMOUNT DUE: {$amountDue|crmMoney:$currency}
DUE DATE: {$dueDate}
DUE DATE: {$dueDate}
-
- +
- -
PAYMENT ADVICE

To: - {$organization_name}

{$notes} +
PAYMENT ADVICE

To:
+ {$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} @@ -198,59 +226,87 @@ {if $contribution_status_id == $refundedStatusId} -
Customer:
{$display_name}
{$display_name}
Invoice Number: {$invoice_id}


+
-

- - - - - - + +
CREDIT NOTE
+ + - - - - + + {if $organization_name} - + {else} - + {/if} - + + - - - - - + + + + - + - + + - + - + + - + + + + + + + +
CREDIT NOTE Date:{$organization_name}Date:{$domain_organization}
{$display_name} ({$organization_name}){$display_name} ({$organization_name}){$display_name}{$display_name}{$invoice_date}{$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}Credit Note Number:{$street_address} {$supplemental_address_1}Credit Note Number:{if $domain_supplemental_address_2 } + {$domain_supplemental_address_2} + {/if} + {if $domain_state } + {$domain_state} + {/if} +
{$supplemental_address_2} {$stateProvinceAbbreviation}{$supplemental_address_2} {$stateProvinceAbbreviation} {$invoice_id}{$creditnote_id}{if $domain_city} + {$domain_city} + {/if} + {if $domain_postal_code } + {$domain_postal_code} + {/if} +
{$city} {$postal_code}{$city} {$postal_code} Reference:Reference: {if $domain_country} + {$domain_country} + {/if}
{$title}{$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.) *} @@ -261,8 +317,12 @@ - {foreach from=$lineItem item=value key=priceset} + {foreach from=$lineItem item=value key=priceset name=pricevalue} + {if $smarty.foreach.pricevalue.index eq 0} + {else} + + {/if} {if $value.tax_amount != ''} - {else} - + {else} + {/if} - + {/foreach} @@ -287,11 +347,11 @@ {if $priceset} - - - {elseif $priceset == 0} - - + + + {elseif $priceset == 0} + + {/if} {/foreach} @@ -308,10 +368,8 @@ {if $is_pay_later == 0} - - - - + + @@ -319,11 +377,9 @@ - - - - - + + + {/if} @@ -332,9 +388,7 @@ - - - +
{$taxTerm} Amount {$defaultCurrency}


{if $value.html_type eq 'Text'}{$value.label}{else}{$value.field_title} - {$value.label}{/if} {if $value.description}
{$value.description|truncate:30:"..."}
{/if} @@ -271,10 +331,10 @@
{$value.unit_price|crmMoney:$currency} {$value.tax_rate}%No {$taxTerm}No {$taxTerm}{$value.subTotal|crmMoney:$currency}{$value.subTotal|crmMoney:$currency}

TOTAL {$taxTerm}{$priceset}%{$value|crmMoney:$currency} TOTAL NO {$taxTerm}{$value|crmMoney:$currency} TOTAL {$taxTerm} {$priceset}%{$value|crmMoney:$currency} TOTAL NO {$taxTerm}{$value|crmMoney:$currency}
LESS Credit to invoice(s)LESS Credit to invoice(s) {$amount|crmMoney:$currency}

REMAINING CREDIT{$amountDue|crmMoney:$currency}REMAINING CREDIT{$amountDue|crmMoney:$currency}
@@ -348,34 +402,32 @@
- - +
- - {/if} - {if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} + {if $contributeMode ne 'notify' and !$isAmountzero and (!$is_pay_later or $isBillingAddressRequiredForPayLater) and !$isOnWaitlist and !$isRequireApproval} {/if} - {if $formValues.total_amount} + {if $formValues.total_amount OR $formValues.total_amount eq 0 }
CREDIT ADVICE

{$notes}
- + +
CREDIT ADVICE

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

+ - + - + - +
Customer:
{$display_name}
{$display_name}
Credit Note#: {$invoice_id}{$creditnote_id}

Credit Amount:{$amount|crmMoney:$currency}{$amount|crmMoney:$currency}
- - {/if} diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_html.tpl b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_html.tpl index 8d629700ee..f920d3eff5 100644 --- a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_html.tpl +++ b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_html.tpl @@ -311,7 +311,7 @@ {/if} {if ! ($contributeMode eq 'notify' OR $contributeMode eq 'directIPN') and $is_monetary} - {if $is_pay_later} + {if $is_pay_later && !$isBillingAddressRequiredForPayLater}
{ts}Registered Email{/ts} diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_text.tpl b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_text.tpl index 6b60eadcd0..6b36b189a4 100644 --- a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_text.tpl +++ b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_text.tpl @@ -121,7 +121,7 @@ {/if} {if !( $contributeMode eq 'notify' OR $contributeMode eq 'directIPN' ) and $is_monetary} -{if $is_pay_later} +{if $is_pay_later && !$isBillingAddressRequiredForPayLater} =========================================================== {ts}Registered Email{/ts} diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_html.tpl b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_html.tpl index 11030468f3..d3e6f0790d 100644 --- a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_html.tpl +++ b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_html.tpl @@ -401,7 +401,7 @@ registration process.{/ts}

{ts}Billing Name and Address{/ts} diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_text.tpl b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_text.tpl index 70dfd9604f..a8434ccfc9 100644 --- a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_text.tpl +++ b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_text.tpl @@ -212,7 +212,7 @@ You were registered by: {$payer.name} {if $checkNumber} {ts}Check Number{/ts}: {$checkNumber} {/if} -{if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} +{if $contributeMode ne 'notify' and !$isAmountzero and (!$is_pay_later or $isBillingAddressRequiredForPayLater) and !$isOnWaitlist and !$isRequireApproval} ==========================================================={if $pricesetFieldsCount }===================={/if} diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_html.tpl b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_html.tpl index 625f047073..17fdb8f660 100644 --- a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_html.tpl +++ b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_html.tpl @@ -70,7 +70,7 @@
{ts}Membership Fee{/ts} diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_text.tpl b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_text.tpl index 2033b71530..072957de86 100644 --- a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_text.tpl +++ b/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_text.tpl @@ -21,7 +21,7 @@ {ts}Membership End Date{/ts}: {$mem_end_date} {/if} -{if $formValues.total_amount} +{if $formValues.total_amount OR $formValues.total_amount eq 0 } =========================================================== {ts}Membership Fee{/ts} diff --git a/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl index 9ed1c8ba36..624938724f 100644 --- a/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl @@ -523,60 +523,6 @@ WHERE co.id IS NULL; WHERE v.name = 'Awaiting Information'; {/if} --- Financial account relationship -SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship'; -SELECT @option_group_id_arel_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel; -SELECT @option_group_id_arel_val := MAX(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel; -INSERT INTO - `civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) -VALUES -(@option_group_id_arel, {localize}'{ts escape="sql"}Sales Tax Account is{/ts}'{/localize}, @option_group_id_arel_val+1, 'Sales Tax Account is', NULL, 0, 0, @option_group_id_arel_wt+1, {localize}'Sales Tax Account is'{/localize}, 0, 1, 1, 2, NULL); - --- Add new column tax_amount in contribution and lineitem table -ALTER TABLE `civicrm_contribution` ADD `tax_amount` DECIMAL( 20, 2 ) DEFAULT NULL COMMENT 'Total tax amount of this contribution.'; -ALTER TABLE `civicrm_line_item` ADD `tax_amount` DECIMAL( 20, 2 ) DEFAULT NULL COMMENT 'tax of each item'; - --- Insert menu item at Administer > CiviContribute, below the Payment Processors. -SELECT @parent_id := id from `civicrm_navigation` where name = 'CiviContribute' AND domain_id = {$domainID}; -SELECT @add_weight_id := weight from `civicrm_navigation` where `name` = 'Payment Processors' and `parent_id` = @parent_id; - -UPDATE `civicrm_navigation` -SET `weight` = `weight`+1 -WHERE `parent_id` = @parent_id -AND `weight` > @add_weight_id; - -INSERT INTO `civicrm_navigation` - ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) -VALUES - ( {$domainID}, 'civicrm/admin/setting/preferences/contribute', '{ts escape="sql" skip="true"}CiviContribute Component Settings{/ts}', 'CiviContribute Component Settings', 'administer CiviCRM', '', @parent_id, '1', NULL, @add_weight_id + 1 ); - --- New activity types required for Print and Email Invoice -SELECT @option_group_id_act_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act; -SELECT @option_group_id_act_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act; - -INSERT INTO - `civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) -VALUES - (@option_group_id_act, {localize}'{ts escape="sql"}Downloaded Invoice{/ts}'{/localize}, @option_group_id_act_val+1, 'Downloaded Invoice', NULL, 1, NULL, @option_group_id_act_wt+1, {localize}'{ts escape="sql"}Downloaded Invoice.{/ts}'{/localize}, 0, 1, 1, NULL, NULL), - (@option_group_id_act, {localize}'{ts escape="sql"}Emailed Invoice{/ts}'{/localize}, @option_group_id_act_val+2, 'Emailed Invoice', NULL, 1, NULL, @option_group_id_act_wt+2, {localize}'{ts escape="sql"}Emailed Invoice.{/ts}'{/localize}, 0, 1, 1, NULL, NULL); - --- New option for Contact Dashboard -SELECT @option_group_id_udOpt := max(id) from civicrm_option_group where name = 'user_dashboard_options'; -SELECT @option_group_id_udOpt_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_udOpt; -SELECT @option_group_id_udOpt_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_udOpt; - -INSERT INTO - `civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) -VALUES - (@option_group_id_udOpt, {localize}'{ts escape="sql"}Invoices / Credit Notes{/ts}'{/localize}, @option_group_id_udOpt_val+1, 'Invoices / Credit Notes', NULL, 0, NULL, @option_group_id_udOpt_wt+1, NULL, 0, 0, 1, NULL, NULL); - --- Add new column creditnote_id in contribution table -ALTER TABLE `civicrm_contribution` ADD `creditnote_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'unique credit note id, system generated or passed in'; - --- Add new column is_billing_required in contribution_page and event table -ALTER TABLE `civicrm_event` ADD COLUMN `is_billing_required` tinyint(4) DEFAULT '0' COMMENT 'Billing block required for Event'; -ALTER TABLE `civicrm_contribution_page` ADD COLUMN `is_billing_required` tinyint(4) DEFAULT '0' COMMENT 'Billing block required for Contribution Page'; - -- CRM-14197 Add contribution_id to civicrm_line_item ALTER TABLE civicrm_line_item ADD contribution_id INT(10) unsigned COMMENT 'Contribution ID' NULL AFTER entity_id; diff --git a/CRM/Upgrade/Incremental/sql/4.5.beta5.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.5.beta5.mysql.tpl index 05996cb0d3..c28bef6e69 100644 --- a/CRM/Upgrade/Incremental/sql/4.5.beta5.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.5.beta5.mysql.tpl @@ -1,3 +1,58 @@ {* file to handle db changes in 4.5.beta5 during upgrade *} -{include file='../CRM/Upgrade/4.5.beta5.msg_template/civicrm_msg_template.tpl'} \ No newline at end of file +{include file='../CRM/Upgrade/4.5.beta5.msg_template/civicrm_msg_template.tpl'} + +-- Financial account relationship +SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship'; +SELECT @option_group_id_arel_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel; +SELECT @option_group_id_arel_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel; +INSERT INTO + `civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) +VALUES +(@option_group_id_arel, {localize}'{ts escape="sql"}Sales Tax Account is{/ts}'{/localize}, @option_group_id_arel_val+1, 'Sales Tax Account is', NULL, 0, 0, @option_group_id_arel_wt+1, {localize}'Sales Tax Account is'{/localize}, 0, 1, 1, 2, NULL); + +-- Add new column tax_amount in contribution and lineitem table +ALTER TABLE `civicrm_contribution` ADD `tax_amount` DECIMAL( 20, 2 ) DEFAULT NULL COMMENT 'Total tax amount of this contribution.'; +ALTER TABLE `civicrm_line_item` ADD `tax_amount` DECIMAL( 20, 2 ) DEFAULT NULL COMMENT 'tax of each item'; + +-- Insert menu item at Administer > CiviContribute, below the Payment Processors. +SELECT @parent_id := id from `civicrm_navigation` where name = 'CiviContribute' AND domain_id = {$domainID}; +SELECT @add_weight_id := weight from `civicrm_navigation` where `name` = 'Payment Processors' and `parent_id` = @parent_id; + +UPDATE `civicrm_navigation` +SET `weight` = `weight`+1 +WHERE `parent_id` = @parent_id +AND `weight` > @add_weight_id; + +INSERT INTO `civicrm_navigation` + ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) +VALUES + ( {$domainID}, 'civicrm/admin/setting/preferences/contribute', '{ts escape="sql" skip="true"}CiviContribute Component Settings{/ts}', 'CiviContribute Component Settings', 'administer CiviCRM', '', @parent_id, '1', NULL, @add_weight_id + 1 ); + +-- New activity types required for Print and Email Invoice +SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type'; +SELECT @option_group_id_act_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act; +SELECT @option_group_id_act_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act; + +INSERT INTO + `civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) +VALUES + (@option_group_id_act, {localize}'{ts escape="sql"}Downloaded Invoice{/ts}'{/localize}, @option_group_id_act_val+1, 'Downloaded Invoice', NULL, 1, NULL, @option_group_id_act_wt+1, {localize}'{ts escape="sql"}Downloaded Invoice.{/ts}'{/localize}, 0, 1, 1, NULL, NULL), + (@option_group_id_act, {localize}'{ts escape="sql"}Emailed Invoice{/ts}'{/localize}, @option_group_id_act_val+2, 'Emailed Invoice', NULL, 1, NULL, @option_group_id_act_wt+2, {localize}'{ts escape="sql"}Emailed Invoice.{/ts}'{/localize}, 0, 1, 1, NULL, NULL); + +-- New option for Contact Dashboard +SELECT @option_group_id_udOpt := max(id) from civicrm_option_group where name = 'user_dashboard_options'; +SELECT @option_group_id_udOpt_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_udOpt; +SELECT @option_group_id_udOpt_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_udOpt; + +INSERT INTO + `civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) +VALUES + (@option_group_id_udOpt, {localize}'{ts escape="sql"}Invoices / Credit Notes{/ts}'{/localize}, @option_group_id_udOpt_val+1, 'Invoices / Credit Notes', NULL, 0, NULL, @option_group_id_udOpt_wt+1, NULL, 0, 0, 1, NULL, NULL); + +-- Add new column creditnote_id in contribution table +ALTER TABLE `civicrm_contribution` ADD `creditnote_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'unique credit note id, system generated or passed in'; + +-- Add new column is_billing_required in contribution_page and event table +ALTER TABLE `civicrm_event` ADD COLUMN `is_billing_required` tinyint(4) DEFAULT '0' COMMENT 'Billing block required for Event'; +ALTER TABLE `civicrm_contribution_page` ADD COLUMN `is_billing_required` tinyint(4) DEFAULT '0' COMMENT 'Billing block required for Contribution Page'; \ No newline at end of file -- 2.25.1