Migrated update code from 4.5.beta5 to 4.6.alpha1
authordpradeep <pradeep.dorugade@webaccess.co.in>
Tue, 30 Sep 2014 14:34:25 +0000 (20:04 +0530)
committerdpradeep <pradeep.dorugade@webaccess.co.in>
Tue, 30 Sep 2014 14:34:25 +0000 (20:04 +0530)
19 files changed:
CRM/Upgrade/4.6.alpha1.msg_template/civicrm_msg_template.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/civicrm_msg_template.tpl with 90% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_html.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_subject.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_invoice_receipt_text.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_invoice_receipt_text.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_offline_receipt_html.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_offline_receipt_html.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_offline_receipt_text.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_offline_receipt_text.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_online_receipt_html.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_html.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/contribution_online_receipt_text.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/contribution_online_receipt_text.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_offline_receipt_html.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_offline_receipt_html.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_offline_receipt_text.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_offline_receipt_text.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_online_receipt_html.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_html.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/event_online_receipt_text.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/event_online_receipt_text.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_offline_receipt_html.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_html.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_offline_receipt_text.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_offline_receipt_text.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_online_receipt_html.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_online_receipt_html.tpl with 100% similarity]
CRM/Upgrade/4.6.alpha1.msg_template/message_templates/membership_online_receipt_text.tpl [moved from CRM/Upgrade/4.5.beta5.msg_template/message_templates/membership_online_receipt_text.tpl with 100% similarity]
CRM/Upgrade/Incremental/php/FourSix.php [new file with mode: 0644]
CRM/Upgrade/Incremental/sql/4.5.beta5.mysql.tpl
CRM/Upgrade/Incremental/sql/4.6.alpha1.mysql.tpl [new file with mode: 0644]

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 b71aad5de9f58b6a770fc38b8326b33d356b8eaa..e68f1f339ac5320363aef53b58b1279e7fbfb3b3 100644 (file)
@@ -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/Incremental/php/FourSix.php b/CRM/Upgrade/Incremental/php/FourSix.php
new file mode 100644 (file)
index 0000000..1da7699
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6.alpha1                                         |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007.                                       |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License along with this program; if not, contact CiviCRM LLC       |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2014
+ * $Id$
+ *
+ */
+class CRM_Upgrade_Incremental_php_FourSix {
+  const BATCH_SIZE = 5000;
+
+  /**
+   * @param $errors
+   *
+   * @return bool
+   */
+  function verifyPreDBstate(&$errors) {
+    return TRUE;
+  }
+
+  /**
+   * Compute any messages which should be displayed beforeupgrade
+   *
+   * Note: This function is called iteratively for each upcoming
+   * revision to the database.
+   *
+   * @param $preUpgradeMessage
+   * @param $rev string, a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'
+   * @param null $currentVer
+   *
+   * @internal param string $postUpgradeMessage , alterable
+   * @return void
+   */
+  function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
+  }
+
+  /**
+   * Compute any messages which should be displayed after upgrade
+   *
+   * @param $postUpgradeMessage string, alterable
+   * @param $rev string, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs
+   * @return void
+   */
+  function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+   if ($rev == '4.6.alpha1') {
+      $postUpgradeMessage .= '<br /><br />' . ts('Default versions of the following System Workflow Message Templates have been modified to handle new functionality: <ul><li>Events - Registration Confirmation and Receipt (on-line)</li><li>Events - Registration Confirmation and Receipt (off-line)</li><li>Contributions - Receipt (on-line)</li><li>Contributions - Receipt (off-line)</li><li>Memberships - Receipt (on-line)</li><li>Memberships - Signup and Renewal Receipts (off-line)</li></ul> 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));
+  }
+}
index c28bef6e69cb677aa95598a2351bc7d539403a0b..2779ecb9b43cd7fe9e14a2d9a1103f153f6af3bb 100644 (file)
@@ -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 (file)
index 0000000..77b196b
--- /dev/null
@@ -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