From d18df7f3f5c604bf54bf0720816e710b6fbc911f Mon Sep 17 00:00:00 2001 From: dpradeep Date: Tue, 30 Sep 2014 20:04:25 +0530 Subject: [PATCH] Migrated update code from 4.5.beta5 to 4.6.alpha1 --- .../civicrm_msg_template.tpl | 8 +- .../contribution_invoice_receipt_html.tpl | 0 .../contribution_invoice_receipt_subject.tpl | 0 .../contribution_invoice_receipt_text.tpl | 0 .../contribution_offline_receipt_html.tpl | 0 .../contribution_offline_receipt_text.tpl | 0 .../contribution_online_receipt_html.tpl | 0 .../contribution_online_receipt_text.tpl | 0 .../event_offline_receipt_html.tpl | 0 .../event_offline_receipt_text.tpl | 0 .../event_online_receipt_html.tpl | 0 .../event_online_receipt_text.tpl | 0 .../membership_offline_receipt_html.tpl | 0 .../membership_offline_receipt_text.tpl | 0 .../membership_online_receipt_html.tpl | 0 .../membership_online_receipt_text.tpl | 0 CRM/Upgrade/Incremental/php/FourSix.php | 110 ++++++++++++++++++ .../Incremental/sql/4.5.beta5.mysql.tpl | 59 +--------- .../Incremental/sql/4.6.alpha1.mysql.tpl | 58 +++++++++ 19 files changed, 173 insertions(+), 62 deletions(-) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/civicrm_msg_template.tpl (90%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/contribution_invoice_receipt_html.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/contribution_invoice_receipt_subject.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/contribution_invoice_receipt_text.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/contribution_offline_receipt_html.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/contribution_offline_receipt_text.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/contribution_online_receipt_html.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/contribution_online_receipt_text.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/event_offline_receipt_html.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/event_offline_receipt_text.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/event_online_receipt_html.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/event_online_receipt_text.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/membership_offline_receipt_html.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/membership_offline_receipt_text.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/membership_online_receipt_html.tpl (100%) rename CRM/Upgrade/{4.5.beta5.msg_template => 4.6.alpha1.msg_template}/message_templates/membership_online_receipt_text.tpl (100%) create mode 100644 CRM/Upgrade/Incremental/php/FourSix.php create mode 100644 CRM/Upgrade/Incremental/sql/4.6.alpha1.mysql.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/civicrm_msg_template.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/civicrm_msg_template.tpl similarity index 90% rename from CRM/Upgrade/4.5.beta5.msg_template/civicrm_msg_template.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/civicrm_msg_template.tpl index b71aad5de9..e68f1f339a 100644 --- a/CRM/Upgrade/4.5.beta5.msg_template/civicrm_msg_template.tpl +++ b/CRM/Upgrade/4.6.alpha1.msg_template/civicrm_msg_template.tpl @@ -1,5 +1,5 @@ {php} - $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.5.beta5.msg_template/message_templates'; + $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.6.alpha1.msg_template/message_templates'; $templates = array(); foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) { $parts = explode('_', basename($filename, '.tpl')); @@ -48,9 +48,9 @@ INSERT INTO civicrm_msg_template (msg_title, msg_subject, msg_text, msg_html, workflow_id, is_default, is_reserved) VALUES {foreach from=$ovNames key=gName item=ovs name=for_groups} {foreach from=$ovs key=vName item=title name=for_values} - {fetch assign=subject file="`$smarty.const.SMARTY_DIR`/../../CRM/Upgrade/4.5.beta5.msg_template/message_templates/`$vName`_subject.tpl"} - {fetch assign=text file="`$smarty.const.SMARTY_DIR`/../../CRM/Upgrade/4.5.beta5.msg_template/message_templates/`$vName`_text.tpl"} - {fetch assign=html file="`$smarty.const.SMARTY_DIR`/../../CRM/Upgrade/4.5.beta5.msg_template/message_templates/`$vName`_html.tpl"} + {fetch assign=subject file="`$smarty.const.SMARTY_DIR`/../../CRM/Upgrade/4.6.alpha1.msg_template/message_templates/`$vName`_subject.tpl"} + {fetch assign=text file="`$smarty.const.SMARTY_DIR`/../../CRM/Upgrade/4.6.alpha1.msg_template/message_templates/`$vName`_text.tpl"} + {fetch assign=html file="`$smarty.const.SMARTY_DIR`/../../CRM/Upgrade/4.6.alpha1.msg_template/message_templates/`$vName`_html.tpl"} ('{$title}', '{$subject|escape:"quotes"}', '{$text|escape:"quotes"}', '{$html|escape:"quotes"}', @tpl_ovid_{$vName}, 1, 0), ('{$title}', '{$subject|escape:"quotes"}', '{$text|escape:"quotes"}', '{$html|escape:"quotes"}', @tpl_ovid_{$vName}, 0, 1) {if $smarty.foreach.for_groups.last and $smarty.foreach.for_values.last};{else},{/if} {/foreach} diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_html.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_html.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_subject.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_subject.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_text.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_invoice_receipt_text.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_text.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_invoice_receipt_text.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_offline_receipt_html.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_offline_receipt_html.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_offline_receipt_html.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_offline_receipt_html.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_offline_receipt_text.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_offline_receipt_text.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_offline_receipt_text.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_offline_receipt_text.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_html.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_online_receipt_html.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_html.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_online_receipt_html.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_text.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_online_receipt_text.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_text.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_online_receipt_text.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_offline_receipt_html.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_offline_receipt_html.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_offline_receipt_html.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_offline_receipt_html.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_offline_receipt_text.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_offline_receipt_text.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_offline_receipt_text.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_offline_receipt_text.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_html.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_online_receipt_html.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_html.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_online_receipt_html.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_text.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_online_receipt_text.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_text.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_online_receipt_text.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_html.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_offline_receipt_html.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_html.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_offline_receipt_html.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_text.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_offline_receipt_text.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_text.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_offline_receipt_text.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_online_receipt_html.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_online_receipt_html.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_online_receipt_html.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_online_receipt_html.tpl diff --git a/CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_online_receipt_text.tpl b/CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_online_receipt_text.tpl similarity index 100% rename from CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_online_receipt_text.tpl rename to CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_online_receipt_text.tpl diff --git a/CRM/Upgrade/Incremental/php/FourSix.php b/CRM/Upgrade/Incremental/php/FourSix.php new file mode 100644 index 0000000000..1da76993f6 --- /dev/null +++ b/CRM/Upgrade/Incremental/php/FourSix.php @@ -0,0 +1,110 @@ +
' . ts('Default versions of the following System Workflow Message Templates have been modified to handle new functionality: If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).'); + } + } + + + + /** + * (Queue Task Callback) + */ + static function task_4_6_x_runSql(CRM_Queue_TaskContext $ctx, $rev) { + $upgrade = new CRM_Upgrade_Form(); + $upgrade->processSQL($rev); + + return TRUE; + } + + /** + * Syntactic sugar for adding a task which (a) is in this class and (b) has + * a high priority. + * + * After passing the $funcName, you can also pass parameters that will go to + * the function. Note that all params must be serializable. + */ + protected function addTask($title, $funcName) { + $queue = CRM_Queue_Service::singleton()->load(array( + 'type' => 'Sql', + 'name' => CRM_Upgrade_Form::QUEUE_NAME, + )); + + $args = func_get_args(); + $title = array_shift($args); + $funcName = array_shift($args); + $task = new CRM_Queue_Task( + array(get_class($this), $funcName), + $args, + $title + ); + $queue->createItem($task, array('weight' => -1)); + } +} diff --git a/CRM/Upgrade/Incremental/sql/4.5.beta5.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.5.beta5.mysql.tpl index c28bef6e69..2779ecb9b4 100644 --- a/CRM/Upgrade/Incremental/sql/4.5.beta5.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/4.5.beta5.mysql.tpl @@ -1,58 +1 @@ -{* file to handle db changes in 4.5.beta5 during upgrade *} - -{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 +{* file to handle db changes in 4.5.beta5 during upgrade *} \ No newline at end of file diff --git a/CRM/Upgrade/Incremental/sql/4.6.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.6.alpha1.mysql.tpl new file mode 100644 index 0000000000..77b196b523 --- /dev/null +++ b/CRM/Upgrade/Incremental/sql/4.6.alpha1.mysql.tpl @@ -0,0 +1,58 @@ +{* file to handle db changes in 4.6.alpha1 during upgrade *} + +{include file='../CRM/Upgrade/4.6.alpha1.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