[Vtigercrm-commits] [vtiger-commits] r10852 - in /vtigercrm/branches/5.0.3/modules: Accounts/Merge.php Contacts/Merge.php HelpDesk/Merge.php Leads/Merge.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Thu May 10 20:09:26 EDT 2007
Author: jerrydgeorge
Date: Thu May 10 18:09:07 2007
New Revision: 10852
Log:
Group Names made to merge with the assigned to Field
Modified:
vtigercrm/branches/5.0.3/modules/Accounts/Merge.php
vtigercrm/branches/5.0.3/modules/Contacts/Merge.php
vtigercrm/branches/5.0.3/modules/HelpDesk/Merge.php
vtigercrm/branches/5.0.3/modules/Leads/Merge.php
Modified: vtigercrm/branches/5.0.3/modules/Accounts/Merge.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Accounts/Merge.php (original)
+++ vtigercrm/branches/5.0.3/modules/Accounts/Merge.php Thu May 10 18:09:07 2007
@@ -114,29 +114,29 @@
for ($x=0; $x<$y; $x++)
{
- $tablename = $adb->query_result($result,$x,"tablename");
- $columnname = $adb->query_result($result,$x,"columnname");
- $modulename = $adb->query_result($result,$x,"name");
-
- if($tablename == "crmentity")
- {
- if($modulename == "Contacts")
- {
- $tablename = "vtiger_crmentityContacts";
- }
- }
- $querycolumns[$x] = $tablename.".".$columnname;
+ $tablename = $adb->query_result($result,$x,"tablename");
+ $columnname = $adb->query_result($result,$x,"columnname");
+ $modulename = $adb->query_result($result,$x,"name");
+
+ if($tablename == "crmentity")
+ {
+ if($modulename == "Contacts")
+ {
+ $tablename = "vtiger_crmentityContacts";
+ }
+ }
+ $querycolumns[$x] = $tablename.".".$columnname;
if($columnname == "smownerid")
- {
- if($modulename == "Accounts")
- {
- $querycolumns[$x] = "concat(vtiger_users.last_name,' ',vtiger_users.first_name) as userjoinname,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
- }
- if($modulename == "Contacts")
- {
- $querycolumns[$x] = "concat(vtiger_usersContacts.last_name,' ',vtiger_usersContacts.first_name) as userjoincname";
- }
- }
+ {
+ if($modulename == "Accounts")
+ {
+ $querycolumns[$x] = "case when (vtiger_users.user_name not like '') then concat(vtiger_users.last_name,' ',vtiger_users.first_name) else vtiger_groups.groupname end as userjoinname,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
+ }
+ if($modulename == "Contacts")
+ {
+ $querycolumns[$x] = "case when (usersContacts.user_name not like '') then concat(usersContacts.last_name,' ',usersContacts.first_name) else groupsContacts.groupname end as userjoincname";
+ }
+ }
if($columnname == "parentid")
{
$querycolumns[$x] = "vtiger_accountAccount.accountname";
@@ -151,19 +151,19 @@
}
if($modulename == "Accounts")
- {
- $field_label[$x] = "ACCOUNT_".strtoupper(str_replace(" ","",$adb->query_result($result,$x,"fieldlabel")));
- if($columnname == "smownerid")
- {
- $field_label[$x] = $field_label[$x].",USER_FIRSTNAME,USER_LASTNAME,USER_USERNAME,USER_YAHOOID,USER_TITLE,USER_OFFICEPHONE,USER_DEPARTMENT,USER_MOBILE,USER_OTHERPHONE,USER_FAX,USER_EMAIL,USER_HOMEPHONE,USER_OTHEREMAIL,USER_PRIMARYADDRESS,USER_CITY,USER_STATE,USER_POSTALCODE,USER_COUNTRY";
- }
- }
-
+ {
+ $field_label[$x] = "ACCOUNT_".strtoupper(str_replace(" ","",$adb->query_result($result,$x,"fieldlabel")));
+ if($columnname == "smownerid")
+ {
+ $field_label[$x] = $field_label[$x].",USER_FIRSTNAME,USER_LASTNAME,USER_USERNAME,USER_YAHOOID,USER_TITLE,USER_OFFICEPHONE,USER_DEPARTMENT,USER_MOBILE,USER_OTHERPHONE,USER_FAX,USER_EMAIL,USER_HOMEPHONE,USER_OTHEREMAIL,USER_PRIMARYADDRESS,USER_CITY,USER_STATE,USER_POSTALCODE,USER_COUNTRY";
+ }
+ }
+
if($modulename == "Contacts")
- {
- $field_label[$x] = "CONTACT_".strtoupper(str_replace(" ","",$adb->query_result($result,$x,"fieldlabel")));
- }
-
+ {
+ $field_label[$x] = "CONTACT_".strtoupper(str_replace(" ","",$adb->query_result($result,$x,"fieldlabel")));
+ }
+
}
$csvheader = implode(",",$field_label);
@@ -180,6 +180,10 @@
inner join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
left join vtiger_account as vtiger_accountAccount on vtiger_accountAccount.accountid = vtiger_account.parentid
left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid
+ LEFT JOIN vtiger_accountgrouprelation
+ ON vtiger_accountscf.accountid = vtiger_accountgrouprelation.accountid
+ LEFT JOIN vtiger_groups
+ ON vtiger_groups.groupname = vtiger_accountgrouprelation.groupname
left join vtiger_contactdetails on vtiger_contactdetails.accountid=vtiger_account.accountid
left join vtiger_crmentity as vtiger_crmentityContacts on vtiger_crmentityContacts.crmid = vtiger_contactdetails.contactid
left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
@@ -188,7 +192,11 @@
left join vtiger_customerdetails on vtiger_contactdetails.contactid = vtiger_customerdetails.customerid
left join vtiger_contactdetails as vtiger_contactdetailsContacts on vtiger_contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
left join vtiger_account as vtiger_accountContacts on vtiger_accountContacts.accountid = vtiger_contactdetails.accountid
- left join vtiger_users as vtiger_usersContacts on vtiger_usersContacts.id = vtiger_crmentityContacts.smownerid
+ left join vtiger_users as usersContacts on usersContacts.id = vtiger_crmentityContacts.smownerid
+ LEFT JOIN vtiger_contactgrouprelation
+ ON vtiger_contactscf.contactid = vtiger_contactgrouprelation.contactid
+ LEFT JOIN vtiger_groups as groupsContacts
+ ON groupsContacts.groupname = vtiger_contactgrouprelation.groupname
where vtiger_crmentity.deleted=0 and (vtiger_crmentityContacts.deleted=0 || vtiger_crmentityContacts.deleted is null) and vtiger_account.accountid in(".$mass_merge.")";
//echo $query;
//die;
Modified: vtigercrm/branches/5.0.3/modules/Contacts/Merge.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Contacts/Merge.php (original)
+++ vtigercrm/branches/5.0.3/modules/Contacts/Merge.php Thu May 10 18:09:07 2007
@@ -114,11 +114,11 @@
{
if($modulename == "Accounts")
{
- $querycolumns[$x]="concat(usersAccounts.last_name,' ',usersAccounts.first_name) as username";
+ $querycolumns[$x]="case when (usersAccounts.user_name not like '') then concat(usersAccounts.last_name,' ',usersAccounts.first_name) else groupsAccounts.groupname end as username";
}
if($modulename == "Contacts")
{
- $querycolumns[$x]="concat(vtiger_users.last_name,' ',vtiger_users.first_name) as usercname,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
+ $querycolumns[$x]="case when (vtiger_users.user_name not like '') then concat(vtiger_users.last_name,' ',vtiger_users.first_name) else vtiger_groups.groupname end as usercname,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
}
}
if($columnname == "parentid")
@@ -169,6 +169,10 @@
left join vtiger_contactdetails as contactdetailsContacts on contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
left join vtiger_account as accountContacts on accountContacts.accountid = vtiger_contactdetails.accountid
left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid
+ LEFT JOIN vtiger_contactgrouprelation
+ ON vtiger_contactscf.contactid = vtiger_contactgrouprelation.contactid
+ LEFT JOIN vtiger_groups
+ ON vtiger_groups.groupname = vtiger_contactgrouprelation.groupname
left join vtiger_account on vtiger_account.accountid = vtiger_contactdetails.accountid
left join vtiger_crmentity as crmentityAccounts on crmentityAccounts.crmid=vtiger_account.accountid
left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
@@ -176,6 +180,10 @@
left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
left join vtiger_account as accountAccounts on accountAccounts.accountid = vtiger_account.parentid
left join vtiger_users as usersAccounts on usersAccounts.id = crmentityAccounts.smownerid
+ LEFT JOIN vtiger_accountgrouprelation
+ ON vtiger_accountscf.accountid = vtiger_accountgrouprelation.accountid
+ LEFT JOIN vtiger_groups as groupsAccounts
+ ON groupsAccounts.groupname = vtiger_accountgrouprelation.groupname
where vtiger_crmentity.deleted=0 and (crmentityAccounts.deleted is NULL or crmentityAccounts.deleted <> 1) and vtiger_contactdetails.contactid in(".$mass_merge.")";
Modified: vtigercrm/branches/5.0.3/modules/HelpDesk/Merge.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/HelpDesk/Merge.php (original)
+++ vtigercrm/branches/5.0.3/modules/HelpDesk/Merge.php Thu May 10 18:09:07 2007
@@ -125,15 +125,15 @@
{
if($modulename == "Accounts")
{
- $column_name = "concat(usersAccounts.last_name,' ',usersAccounts.first_name) as username";
+ $column_name = "case when (usersAccounts.user_name not like '') then concat(usersAccounts.last_name,' ',usersAccounts.first_name) else groupsAccounts.groupname end as username";
}
if($modulename == "Contacts")
{
- $column_name = "concat(usersContacts.last_name,' ',usersContacts.first_name) as usercname";
+ $column_name = "case when (usersContacts.user_name not like '') then concat(usersContacts.last_name,' ',usersContacts.first_name) else groupsContacts.groupname end as username";
}
if($modulename == "HelpDesk")
{
- $column_name = "concat(vtiger_users.last_name,' ',vtiger_users.first_name) as userhelpname,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
+ $column_name = "case when (vtiger_users.user_name not like '') then concat(vtiger_users.last_name,' ',vtiger_users.first_name) else vtiger_groups.groupname end as userhelpname,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
}
}
if($columnname == "parentid")
@@ -184,6 +184,10 @@
left join vtiger_contactdetails as contactdetailsRelHelpDesk on contactdetailsRelHelpDesk.contactid= crmentityRelHelpDesk.crmid
left join vtiger_products as productsRel on productsRel.productid = vtiger_troubletickets.product_id
left join vtiger_users on vtiger_crmentity.smownerid=vtiger_users.id
+ LEFT JOIN vtiger_ticketgrouprelation
+ ON vtiger_troubletickets.ticketid = vtiger_ticketgrouprelation.ticketid
+ LEFT JOIN vtiger_groups
+ ON vtiger_groups.groupname = vtiger_ticketgrouprelation.groupname
left join vtiger_account on vtiger_account.accountid = vtiger_troubletickets.parent_id
left join vtiger_crmentity as crmentityAccounts on crmentityAccounts.crmid = vtiger_account.accountid
left join vtiger_accountbillads on vtiger_accountbillads.accountaddressid = vtiger_account.accountid
@@ -191,6 +195,10 @@
left join vtiger_accountscf on vtiger_accountbillads.accountaddressid = vtiger_accountscf.accountid
left join vtiger_account as accountAccount on accountAccount.accountid = vtiger_troubletickets.parent_id
left join vtiger_users as usersAccounts on usersAccounts.id = crmentityAccounts.smownerid
+ LEFT JOIN vtiger_accountgrouprelation
+ ON vtiger_accountscf.accountid = vtiger_accountgrouprelation.accountid
+ LEFT JOIN vtiger_groups as groupsAccounts
+ ON groupsAccounts.groupname = vtiger_accountgrouprelation.groupname
left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_troubletickets.parent_id
left join vtiger_crmentity as crmentityContacts on crmentityContacts.crmid = vtiger_contactdetails.contactid
left join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
@@ -200,6 +208,10 @@
left join vtiger_contactdetails as contactdetailsContacts on contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
left join vtiger_account as accountContacts on accountContacts.accountid = vtiger_contactdetails.accountid
left join vtiger_users as usersContacts on usersContacts.id = crmentityContacts.smownerid
+ LEFT JOIN vtiger_contactgrouprelation
+ ON vtiger_contactscf.contactid = vtiger_contactgrouprelation.contactid
+ LEFT JOIN vtiger_groups as groupsContacts
+ ON groupsContacts.groupname = vtiger_contactgrouprelation.groupname
where vtiger_crmentity.deleted=0 and ((crmentityContacts.deleted=0 || crmentityContacts.deleted is null)||(crmentityAccounts.deleted=0 || crmentityAccounts.deleted is null))
and vtiger_troubletickets.ticketid in (".$mass_merge.")";
Modified: vtigercrm/branches/5.0.3/modules/Leads/Merge.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Leads/Merge.php (original)
+++ vtigercrm/branches/5.0.3/modules/Leads/Merge.php Thu May 10 18:09:07 2007
@@ -101,7 +101,7 @@
$querycolumns[$x] = $tablename.".".$columnname;
if($columnname == "smownerid")
{
- $querycolumns[$x] = "concat(vtiger_users.last_name,' ',vtiger_users.first_name) as username,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
+ $querycolumns[$x] = "case when (vtiger_users.user_name not like '') then concat(vtiger_users.last_name,' ',vtiger_users.first_name) else vtiger_groups.groupname end as username,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
}
$field_label[$x] = "LEAD_".strtoupper(str_replace(" ","",$adb->query_result($result,$x,"fieldlabel")));
if($columnname == "smownerid")
@@ -121,6 +121,10 @@
inner join vtiger_leadsubdetails on vtiger_leadsubdetails.leadsubscriptionid=vtiger_leaddetails.leadid
inner join vtiger_leadaddress on vtiger_leadaddress.leadaddressid=vtiger_leadsubdetails.leadsubscriptionid
inner join vtiger_leadscf on vtiger_leaddetails.leadid = vtiger_leadscf.leadid
+ LEFT JOIN vtiger_leadgrouprelation
+ ON vtiger_leaddetails.leadid = vtiger_leadgrouprelation.leadid
+ LEFT JOIN vtiger_groups
+ ON vtiger_groups.groupname = vtiger_leadgrouprelation.groupname
left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid
where vtiger_crmentity.deleted=0 and vtiger_leaddetails.leadid in (".$mass_merge.")";
More information about the vtigercrm-commits
mailing list