[Vtigercrm-commits] [vtiger-commits] r11059 - in /vtigercrm/branches/5.0.3/modules/Migration: DBChanges/42P2_to_50.php DBChanges/501_to_502.php DBChanges/502_to_503rc2.php DBChanges/503rc2_to_503.php PatchApply.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sat May 26 09:00:43 EDT 2007


Author: richie
Date: Sat May 26 07:00:36 2007
New Revision: 11059

Log:
* Added the missed database changes for 5.0.3 release

Modified:
    vtigercrm/branches/5.0.3/modules/Migration/DBChanges/42P2_to_50.php
    vtigercrm/branches/5.0.3/modules/Migration/DBChanges/501_to_502.php
    vtigercrm/branches/5.0.3/modules/Migration/DBChanges/502_to_503rc2.php
    vtigercrm/branches/5.0.3/modules/Migration/DBChanges/503rc2_to_503.php
    vtigercrm/branches/5.0.3/modules/Migration/PatchApply.php

Modified: vtigercrm/branches/5.0.3/modules/Migration/DBChanges/42P2_to_50.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Migration/DBChanges/42P2_to_50.php (original)
+++ vtigercrm/branches/5.0.3/modules/Migration/DBChanges/42P2_to_50.php Sat May 26 07:00:36 2007
@@ -2792,10 +2792,10 @@
 $query_array2 = Array(
 				//"INSERT INTO vtiger_parenttabrel VALUES(2,4,2)",
 				//"INSERT INTO vtiger_parenttabrel VALUES(2,6,3)",
-				"update vtiger_cvcolumnlist set columnname ='vtiger_crmentity:smownerid:assigned_user_id:Emails_Sender:V' where cvid=20 and columnindex=3",
+				"update vtiger_cvcolumnlist set columnname ='vtiger_crmentity:smownerid:assigned_user_id:Emails_Sender:V' where columnname='vtiger_crmentity:smownerid:assigned_user_id:Emails_Assigned_To:V'",
 				"update vtiger_field set sequence = 2 where columnname='filename' and tablename = 'vtiger_attachments'",
 				"delete from vtiger_cvcolumnlist where columnname = 'vtiger_seactivityrel:crmid:parent_id:Emails_Related_To:I'",
-				"update vtiger_cvcolumnlist set columnindex = 1 where cvid=20 and columnindex=3",
+				//"update vtiger_cvcolumnlist set columnindex = 1 where cvid=20 and columnindex=3",
 				"update vtiger_field set info_type='ADV' where tabid=18 and columnname in ('street','pobox','city','state','postalcode','country','description')",
 				"update vtiger_field set info_type='ADV' where tabid in (20,21,22,23) and columnname in ('description','terms_conditions')",
 

Modified: vtigercrm/branches/5.0.3/modules/Migration/DBChanges/501_to_502.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Migration/DBChanges/501_to_502.php (original)
+++ vtigercrm/branches/5.0.3/modules/Migration/DBChanges/501_to_502.php Sat May 26 07:00:36 2007
@@ -11,7 +11,9 @@
 
 
 //5.0.2 database changes - added on 27-10-06
-global $adb;
+//we have to use the current object (stored in PatchApply.php) to execute the queries
+$adb = $_SESSION['adodb_current_object'];
+$conn = $_SESSION['adodb_current_object'];
 
 $migrationlog->debug("\n\nDB Changes from 5.0.1 to 5.0.2 -------- Starts \n\n");
 

Modified: vtigercrm/branches/5.0.3/modules/Migration/DBChanges/502_to_503rc2.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Migration/DBChanges/502_to_503rc2.php (original)
+++ vtigercrm/branches/5.0.3/modules/Migration/DBChanges/502_to_503rc2.php Sat May 26 07:00:36 2007
@@ -11,7 +11,9 @@
 
 
 //5.0.2 to 5.0.3 RC2 database changes - added on 05-01-07
-global $adb;
+//we have to use the current object (stored in PatchApply.php) to execute the queries
+$adb = $_SESSION['adodb_current_object'];
+$conn = $_SESSION['adodb_current_object'];
 
 $migrationlog->debug("\n\nDB Changes from 5.0.2 to 5.0.3 RC2 -------- Starts \n\n");
 

Modified: vtigercrm/branches/5.0.3/modules/Migration/DBChanges/503rc2_to_503.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Migration/DBChanges/503rc2_to_503.php (original)
+++ vtigercrm/branches/5.0.3/modules/Migration/DBChanges/503rc2_to_503.php Sat May 26 07:00:36 2007
@@ -11,7 +11,9 @@
 
 
 //5.0.3 RC2 to 5.0.3 database changes - added on 29-03-07
-global $adb;
+//we have to use the current object (stored in PatchApply.php) to execute the queries
+$adb = $_SESSION['adodb_current_object'];
+$conn = $_SESSION['adodb_current_object'];
 
 $migrationlog->debug("\n\nDB Changes from 5.0.3RC2 to 5.0.3 -------- Starts \n\n");
 
@@ -407,6 +409,39 @@
 ExecuteQuery("ALTER TABLE vtiger_invoicegrouprelation ADD CONSTRAINT fk_1_vtiger_invoicegrouprelation FOREIGN KEY (groupname) REFERENCES vtiger_groups(groupname) ON UPDATE CASCADE");
 ExecuteQuery("ALTER TABLE vtiger_invoicegrouprelation ADD CONSTRAINT fk_2_vtiger_invoicegrouprelation FOREIGN KEY (invoiceid) REFERENCES vtiger_invoice(invoiceid) ON DELETE CASCADE");
 
+//For emails listview, we have to update the column sender
+ExecuteQuery("update vtiger_cvcolumnlist set columnname='vtiger_crmentity:smownerid:assigned_user_id:Emails_Sender:V' where columnname='vtiger_crmentity:smownerid:assigned_user_id:Emails_Assigned_To:V'");
+
+//if is_admin is set as 0 then we have to update as off and update status as Active if the status is NULL
+ExecuteQuery("update vtiger_users set is_admin='off' where is_admin='0'");
+ExecuteQuery("update vtiger_users set status='Active' where status is NULL");
+
+//Update the City, State, Zip and Country to Mailing City, State, Zip and Country
+ExecuteQuery("update vtiger_cvcolumnlist set columnname='vtiger_contactaddress:mailingcity:mailingcity:Contacts_Mailing_City:V' where columnname='vtiger_contactaddress:mailingcity:mailingcity:Contacts_City:V'");
+ExecuteQuery("update vtiger_cvcolumnlist set columnname='vtiger_contactaddress:mailingstate:mailingstate:Contacts_Mailing_State:V' where columnname='vtiger_contactaddress:mailingstate:mailingstate:Contacts_State:V'");
+ExecuteQuery("update vtiger_cvcolumnlist set columnname='vtiger_contactaddress:mailingzip:mailingzip:Contacts_Mailing_Zip:V' where columnname='vtiger_contactaddress:mailingzip:mailingzip:Contacts_Zip:V'");
+ExecuteQuery("update vtiger_cvcolumnlist set columnname='vtiger_contactaddress:mailingcountry:mailingcountry:Contacts_Mailing_Country:V' where columnname='vtiger_contactaddress:mailingcountry:mailingcountry:Contacts_Country:V'");
+
+//Added Attachments and Quote stage history in Quotes relatedlist
+ExecuteQuery("update vtiger_relatedlists set sequence=4 where tabid=20 and name='get_history'");
+ExecuteQuery("insert into vtiger_relatedlists values (".$adb->getUniqueID('vtiger_relatedlists').",20,0,'get_attachments',3,'Attachments',0), (".$adb->getUniqueID('vtiger_relatedlists').",20,0,'get_quotestagehistory',5,'Quote Stage History',0)");
+
+//Added SalesOrder Status History in SalesOrder relatedlist
+ExecuteQuery("insert into vtiger_relatedlists values (".$adb->getUniqueID('vtiger_relatedlists').",22,0,'get_sostatushistory',5,'SalesOrder Status History',0)");
+
+//Added PurchaseOrder Status History in PurchaseOrder relatedlist
+ExecuteQuery("insert into vtiger_relatedlists values (".$adb->getUniqueID('vtiger_relatedlists').",21,0,'get_postatushistory',4,'PurchaseOrder Status History',0)");
+
+//Update SalesOrder Id as SalesOrder No for default All SalesOrder customview (only All customview has this field)
+ExecuteQuery("update vtiger_cvcolumnlist set columnname='vtiger_crmentity:crmid::SalesOrder_Order_No:I' where columnname='vtiger_crmentity:crmid::SalesOrder_Order_Id:I'");
+
+//Update PurchaseOrder Id as Purchase No for default All PurchaseOrder customview (only All customview has this field)
+ExecuteQuery("update vtiger_cvcolumnlist set columnname='vtiger_crmentity:crmid::PurchaseOrder_Order_No:I' where columnname='vtiger_crmentity:crmid::PurchaseOrder_Order_Id:I'");
+
+
+
+
+
 
 $migrationlog->debug("\n\nDB Changes from 5.0.3RC2 to 5.0.3 -------- Ends \n\n");
 

Modified: vtigercrm/branches/5.0.3/modules/Migration/PatchApply.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Migration/PatchApply.php (original)
+++ vtigercrm/branches/5.0.3/modules/Migration/PatchApply.php Sat May 26 07:00:36 2007
@@ -48,6 +48,17 @@
 	//echo '<table width="98%" cellpadding="3" cellspacing="0" border="0" class="MigInfo">';
 	echo '<table width="98%" border="1px" cellpadding="3" cellspacing="0" height="100%">';
 }
+
+//Here we have to decide the database object to which we have to run the migration queries
+//For options 1 and 2 we need to execute the queries in current database ie., adb object
+//But for option 3, we have to run the queries in given 4.2.3 database ie., conn object
+//This session variable should be used in all patch files(which contains the queries) so that based on the option selected the queries will be executed in the corresponding database. ie., in all patch files we have to assign this session object to adb and conn objects
+global $adb;
+if($_REQUEST['migration_option'] == 'alter_db_details')
+	$_SESSION['adodb_current_object'] = $conn;
+else
+	$_SESSION['adodb_current_object'] = $adb;
+
 
 for($i=0;$i<count($temp);$i++)
 {





More information about the vtigercrm-commits mailing list