[Vtigercrm-commits] [vtiger-commits] r10842 - in /vtigercrm/branches/5.0.3/modules/Migration: DBChanges/42P2_to_50.php DBChanges/503rc2_to_503.php PatchApply.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Thu May 10 17:19:31 EDT 2007
Author: richie
Date: Thu May 10 15:19:21 2007
New Revision: 10842
Log:
* Fixed the issues in migration, Fixed #3820#3823#3825#3827#3828
Modified:
vtigercrm/branches/5.0.3/modules/Migration/DBChanges/42P2_to_50.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 Thu May 10 15:19:21 2007
@@ -451,6 +451,7 @@
$name = $conn->query_result($res,$i,'name');
$role_map_array[$roleid] = $name;
}
+$conn->println("List of Roles (roleid => name) ==> ");$conn->println($role_map_array);
//echo '<pre> List of vtiger_roles :';print_r($role_map_array);echo '</pre>';
//Before delete the vtiger_role take a backup array for the table vtiger_user2role
@@ -463,6 +464,7 @@
$roleid = $conn->query_result($res,$i,'roleid');
$user2role_array[$userid] = $roleid;
}
+$conn->println("Users 2 Roles (userid => roleid) ==> ");$conn->println($user2role_array);
//echo '<pre> List of vtiger_user2role : (userid => vtiger_roleid)';print_r($user2role_array);echo '</pre>';
//Delete the vtiger_role entries
@@ -520,6 +522,7 @@
$new_role_id = localcreateRole($rolename,$parentRole,$empty_array);
$new_role_map_array[$roleid] = $new_role_id;
}
+$conn->println("Roles (oldroleid => newroleid) ==> ");$conn->println($new_role_map_array);
//Before insert the new entry we should remove the old entries -- added on 06-06-06
$user2role_del = "truncate vtiger_user2role";
@@ -566,6 +569,7 @@
$desc = $conn->query_result($res,$i,'description');
$group_map_array[$name] = $desc;
}
+$conn->println("List of Groups (name => description) ==> ");$conn->println($group_map_array);
//echo '<pre>List of Groups : ';print_r($group_map_array);echo '</pre>';
@@ -579,6 +583,7 @@
$userid = $conn->query_result($res,$i,'userid');
$users2group_map_array[$userid] = $groupname;
}
+$conn->println("Users 2 Groups (userid => groupname) ==> ");$conn->println($users2group_map_array);
//echo '<pre>List of vtiger_users2group : ';print_r($users2group_map_array);echo '</pre>';
//Step 3 : delete all entries from vtiger_groups table
@@ -675,6 +680,7 @@
$groupid = createGroup($groupname,$empty_array,$description);
$group_name_id_mapping[$groupname] = $groupid;
}
+$conn->println("List of Groups Created (groupname => groupid) ==> ");$conn->println($group_name_id_mapping);
//Copy all mappings in a user2grop table in a array;
@@ -746,7 +752,7 @@
$altersql1 = "alter table vtiger_vendor drop column company_name";
Execute($altersql1);
$altersql2 = "alter table vtiger_vendor change column name vendorname varchar(100) default NULL";
-Execute($altersql2);
+$conn->query($altersql2);
Execute("update vtiger_field set fieldname='vendorname', columnname='vendorname' where tabid=18 and fieldname='name'");
//TODO (check): Remove this company_name entry from the vtiger_field table if it already exists
@@ -1298,7 +1304,7 @@
"insert into vtiger_cvcolumnlist values ($cvid,0,'vtiger_contactdetails:firstname:firstname:Contacts_First_Name:V')",
"insert into vtiger_cvcolumnlist values ($cvid,1,'vtiger_contactdetails:lastname:lastname:Contacts_Last_Name:V')",
"insert into vtiger_cvcolumnlist values ($cvid,2,'vtiger_contactdetails:title:title:Contacts_Title:V')",
- "insert into vtiger_cvcolumnlist values ($cvid,3,'vtiger_contactdetails:accountid:account_id:Contacts_Account_Name:I')",
+ "insert into vtiger_cvcolumnlist values ($cvid,3,'vtiger_account:accountname:accountname:Contacts_Account_Name:V')",
"insert into vtiger_cvcolumnlist values ($cvid,4,'vtiger_contactdetails:email:email:Contacts_Email:V')",
"insert into vtiger_cvcolumnlist values ($cvid,5,'vtiger_contactdetails:phone:phone:Contacts_Office_Phone:V')",
"insert into vtiger_cvcolumnlist values ($cvid,6,'vtiger_crmentity:smownerid:assigned_user_id:Contacts_Assigned_To:V')"
@@ -1313,7 +1319,7 @@
$insert_query_array10 = Array(
"insert into vtiger_cvcolumnlist values ($cvid,0,'vtiger_potential:potentialname:potentialname:Potentials_Potential_Name:V')",
- "insert into vtiger_cvcolumnlist values ($cvid,1,'vtiger_potential:accountid:account_id:Potentials_Account_Name:V')",
+ "insert into vtiger_cvcolumnlist values ($cvid,1,'vtiger_account:accountname:accountname:Potentials_Account_Name:V')",
"insert into vtiger_cvcolumnlist values ($cvid,2,'vtiger_potential:amount:amount:Potentials_Amount:N')",
"insert into vtiger_cvcolumnlist values ($cvid,3,'vtiger_potential:closingdate:closingdate:Potentials_Expected_Close_Date:D')",
"insert into vtiger_cvcolumnlist values ($cvid,4,'vtiger_crmentity:smownerid:assigned_user_id:Potentials_Assigned_To:V')"
@@ -1348,7 +1354,7 @@
"insert into vtiger_cvcolumnlist values ($cvid,1,'vtiger_quotes:subject:subject:Quotes_Subject:V')",
"insert into vtiger_cvcolumnlist values ($cvid,2,'vtiger_quotes:quotestage:quotestage:Quotes_Quote_Stage:V')",
"insert into vtiger_cvcolumnlist values ($cvid,3,'vtiger_quotes:potentialid:potential_id:Quotes_Potential_Name:I')",
- "insert into vtiger_cvcolumnlist values ($cvid,4,'vtiger_quotes:accountid:account_id:Quotes_Account_Name:I')",
+ "insert into vtiger_cvcolumnlist values ($cvid,4,'vtiger_account:accountname:accountname:Quotes_Account_Name:V')",
"insert into vtiger_cvcolumnlist values ($cvid,5,'vtiger_quotes:total:hdnGrandTotal:Quotes_Total:I')",
"insert into vtiger_cvcolumnlist values ($cvid,6,'vtiger_crmentity:smownerid:assigned_user_id:Quotes_Assigned_To:V')"
);
@@ -1471,7 +1477,7 @@
$insert_query_array20 = Array(
"insert into vtiger_cvcolumnlist values ($cvid,0,'vtiger_crmentity:crmid::SalesOrder_Order_Id:I')",
"insert into vtiger_cvcolumnlist values ($cvid,1,'vtiger_salesorder:subject:subject:SalesOrder_Subject:V')",
- "insert into vtiger_cvcolumnlist values ($cvid,2,'vtiger_account:accountid:account_id:SalesOrder_Account_Name:V')",
+ "insert into vtiger_cvcolumnlist values ($cvid,2,'vtiger_account:accountname:accountname:SalesOrder_Account_Name:V')",
"insert into vtiger_cvcolumnlist values ($cvid,3,'vtiger_quotes:quoteid:quote_id:SalesOrder_Quote_Name:I')",
"insert into vtiger_cvcolumnlist values ($cvid,4,'vtiger_salesorder:total:hdnGrandTotal:SalesOrder_Total:V')",
"insert into vtiger_cvcolumnlist values ($cvid,5,'vtiger_crmentity:smownerid:assigned_user_id:SalesOrder_Assigned_To:V')"
@@ -3680,7 +3686,7 @@
$inventory_tables = Array(
'vtiger_poproductrel'=>'purchaseorderid',
'vtiger_soproductrel'=>'salesorderid',
- 'vtiger_quotesproductrel'=>'quotesid',
+ 'vtiger_quotesproductrel'=>'quoteid',
'vtiger_invoiceproductrel'=>'invoiceid'
);
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 Thu May 10 15:19:21 2007
@@ -125,7 +125,8 @@
$profileresult = $adb->query("select * from vtiger_profile");
$countprofiles = $adb->num_rows($profileresult);
-$res = $adb->query("select * from vtiger_field where generatedtype=1 and displaytype=3 and tabid!=29");
+$res = $adb->query("select * from vtiger_field where fieldid not in (select fieldid from vtiger_profile2field) and generatedtype=1 and displaytype=3 and tabid!=29");
+//$res = $adb->query("select * from vtiger_field where generatedtype=1 and displaytype=3 and tabid!=29");
$num_fields = $adb->num_rows($res);
for($i=0;$i<$num_fields;$i++)
{
@@ -205,7 +206,39 @@
ExecuteQuery("UPDATE vtiger_".$picklistname." SET PRESENCE=0 WHERE $picklistname='".$value."'");
}
-
+//Assigned To value is shown as empty in Accounts, Emails and PO listviews because of uitype 52
+ExecuteQuery("update vtiger_field set uitype=53 where fieldname='assigned_user_id' and tabid in (6,10,21)");
+
+//AccountName is shown as empty in SO/Quotes/Invoice listview because of account details in vtiger_cvcolumnlist.columnname
+$modules_array = Array("SalesOrder","Quotes","Invoice","Contacts","Potentials");
+foreach($modules_array as $module)
+{
+ ExecuteQuery("update vtiger_cvcolumnlist inner join vtiger_customview on vtiger_customview.cvid=vtiger_cvcolumnlist.cvid set columnname='vtiger_account:accountname:accountname:".$module."_Account_Name:V' where columnname like '%:accountid:account_id:%' and vtiger_customview.entitytype='".$module."'");
+}
+
+/*
+$res = $adb->query("select vtiger_cvcolumnlist.*, vtiger_customview.viewname from vtiger_cvcolumnlist inner join vtiger_customview on vtiger_customview.cvid=vtiger_cvcolumnlist.cvid where columnname like '%:accountid:account_id:%' and vtiger_customview.entitytype='SalesOrder'");
+for($i=0;$i<$adb->num_rows($res);$i++)
+{
+ $cvid = $adb->query_result($res,$i,'cvid');
+ $columnindex = $adb->query_result($res,$i,'columnindex');
+ ExecuteQuery("update vtiger_cvcolumnlist set columnname='vtiger_account:accountname:accountname:SalesOrder_Account_Name:V' where cvid=$cvid and columnindex=$columnindex");
+}
+*/
+
+//ContactName in Calendar listview is a link but record id is empty in link so when we click the link fatal error comes
+ExecuteQuery("update vtiger_cvcolumnlist inner join vtiger_customview on vtiger_customview.cvid=vtiger_cvcolumnlist.cvid set columnname = 'vtiger_cntactivityrel:contactid:contact_id:Calendar_Contact_Name:V' where columnname = 'vtiger_contactdetails:lastname:lastname:Calendar_Contact_Name:V' and vtiger_customview.entitytype='Calendar'");
+
+//Related To is not displayed in Calendar Listview
+ExecuteQuery("update vtiger_cvcolumnlist inner join vtiger_customview on vtiger_customview.cvid=vtiger_cvcolumnlist.cvid set columnname = 'vtiger_seactivityrel:crmid:parent_id:Calendar_Related_to:V' where columnname = 'vtiger_seactivityrel:crmid:parent_id:Calendar_Related_To:V' and vtiger_customview.entitytype='Calendar'");
+
+//In 4.2.3 we have assigned to group option only for Leads, HelpDesk and Activies and default None can be assigned. Now we will assign the unassigned entities to current user
+ExecuteQuery("update vtiger_crmentity set smownerid=1 where smownerid=0 and setype not in ('Leads','HelpDesk','Calendar')");
+
+
+
+
+ExecuteQuery("CREATE TABLE vtiger_version (id int(11) NOT NULL auto_increment, old_version varchar(30) default NULL, current_version varchar(30) default NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1");
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 Thu May 10 15:19:21 2007
@@ -101,7 +101,11 @@
global $conn, $query_count, $success_query_count, $failure_query_count, $success_query_array, $failure_query_array;
global $migrationlog;
- $status = $adb->query($query);
+ //For third option migration we have to use the $conn object because the queries should be executed in 4.2.3 db
+ if($_REQUEST['migration_option'] == 'alter_db_details')
+ $status = $conn->query($query);
+ else
+ $status = $adb->query($query);
$query_count++;
if(is_object($status))
More information about the vtigercrm-commits
mailing list