[Vtigercrm-commits] [vtiger-commits] r10933 - in /vtigercrm/branches/5.0.3: include/utils/ modules/Calendar/ modules/CustomView/ modules/Invoice/ modules/Notes/ modules/PurchaseOrder/ modules/Quotes/ modules/SalesOrder/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Tue May 15 10:28:13 EDT 2007
Author: saraj
Date: Tue May 15 08:27:51 2007
New Revision: 10933
Log:
Contact Name sorting in Notes Module. Fixes #3801
Modified:
vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
vtigercrm/branches/5.0.3/modules/Calendar/Activity.php
vtigercrm/branches/5.0.3/modules/Calendar/ListView.php
vtigercrm/branches/5.0.3/modules/CustomView/CustomView.php
vtigercrm/branches/5.0.3/modules/CustomView/PopulateCustomView.php
vtigercrm/branches/5.0.3/modules/Invoice/Invoice.php
vtigercrm/branches/5.0.3/modules/Notes/Notes.php
vtigercrm/branches/5.0.3/modules/PurchaseOrder/PurchaseOrder.php
vtigercrm/branches/5.0.3/modules/Quotes/Quotes.php
vtigercrm/branches/5.0.3/modules/SalesOrder/SalesOrder.php
Modified: vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php (original)
+++ vtigercrm/branches/5.0.3/include/utils/ListViewUtils.php Tue May 15 08:27:51 2007
@@ -79,6 +79,10 @@
{
$fieldname = 'account_id';
}
+ if($fieldname == 'lastname' && ($module == 'Notes' || $module == 'SalesOrder'|| $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes'||$module == 'Calendar' ) )
+ {
+ $fieldname = 'contact_id';
+ }
if($j != 0)
{
$field_list .= ', ';
@@ -133,6 +137,11 @@
{
$fieldname = 'account_id';
}
+ if($fieldname == 'lastname' &&($module == 'Notes' ||$module == 'SalesOrder'|| $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes'||$module == 'Calendar' ) )
+ {
+ $fieldname = 'contact_id';
+ }
+
}else
{
@@ -523,6 +532,8 @@
{
$fieldname = 'account_id';
}
+ if($fieldname == 'lastname' &&($module == 'Notes' ||$module == 'SalesOrder'|| $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes'||$module == 'Calendar' ) )
+ $fieldname = 'contact_id';
if($j != 0)
{
@@ -638,6 +649,9 @@
{
$fieldname = 'account_id';
}
+ if($fieldname == 'lastname' &&($module == 'Notes' ||$module == 'SalesOrder'|| $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes'||$module == 'Calendar' ) )
+ $fieldname = 'contact_id';
+
}
}
if($is_admin==true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] ==0 || in_array($fieldname,$field) || $fieldname == '')
@@ -726,6 +740,27 @@
{
$value=getRelatedTo($module,$list_result,$i-1);
}
+ //added for sorting by Contact Name ---------STARTS------------------
+ elseif($name=='Contact Name' &&($module == 'Notes' || $module =='SalesOrder' || $module == 'Quotes' || $module == 'PurchaseOrder'))
+ {
+ if($name == 'Contact Name')
+ {
+ $first_name = $adb->query_result($list_result,$i-1,"firstname");
+ $last_name = $adb->query_result($list_result,$i-1,"lastname");
+ $contact_id = $adb->query_result($list_result,$i-1,"contactid");
+ $contact_name = "";
+ $value="";
+ if($last_name != 'NULL')
+ $contact_name .= $last_name;
+ if($first_name != 'NULL')
+ $contact_name .= " ".$first_name;
+
+ if(($contact_name != "") && ($contact_id !='NULL'))
+ $value ="<a href='index.php?module=Contacts&action=DetailView&parenttab=".$tabname."&record=".$contact_id."' style='".$P_FONT_COLOR."'>".$contact_name."</a>";
+ }
+
+ }
+ //----------------------ENDS----------------------
elseif($name=='Account Name')
{
Modified: vtigercrm/branches/5.0.3/modules/Calendar/Activity.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/Activity.php (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/Activity.php Tue May 15 08:27:51 2007
@@ -36,7 +36,7 @@
var $tab_name_index = Array('vtiger_crmentity'=>'crmid','vtiger_activity'=>'activityid','vtiger_seactivityrel'=>'activityid','vtiger_cntactivityrel'=>'activityid','vtiger_salesmanactivityrel'=>'activityid','vtiger_activity_reminder'=>'activity_id','vtiger_recurringevents'=>'activityid');
var $column_fields = Array();
- var $sortby_fields = Array('subject','due_date','date_start','smownerid','activitytype'); //Sorting is added for due date and start date
+ var $sortby_fields = Array('subject','due_date','date_start','smownerid','activitytype','lastname'); //Sorting is added for due date and start date
// This is used to retrieve related vtiger_fields from form posts.
var $additional_column_fields = Array('assigned_user_name', 'assigned_user_id', 'contactname', 'contact_phone', 'contact_email', 'parent_name');
@@ -52,7 +52,8 @@
'End Date'=>Array('activity'=>'due_date'),
'End Time'=>Array('activity','time_end'),
'Recurring Type'=>Array('recurringevents'=>'recurringtype'),
- 'Assigned To'=>Array('crmentity'=>'smownerid')
+ 'Assigned To'=>Array('crmentity'=>'smownerid'),
+ 'Contact Name'=>Array('contactdetails'=>'lastname')
);
var $range_fields = Array(
Modified: vtigercrm/branches/5.0.3/modules/Calendar/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/ListView.php (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/ListView.php Tue May 15 08:27:51 2007
@@ -149,8 +149,10 @@
{
$tablename = getTableNameForField('Calendar',$order_by);
$tablename = (($tablename != '')?($tablename."."):'');
-
- $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
+ if($order_by == 'lastname')
+ $list_query .= ' ORDER BY vtiger_contactdetails.lastname '.$sorder;
+ else
+ $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
}
}
//Constructing the list view
Modified: vtigercrm/branches/5.0.3/modules/CustomView/CustomView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/CustomView/CustomView.php (original)
+++ vtigercrm/branches/5.0.3/modules/CustomView/CustomView.php Tue May 15 08:27:51 2007
@@ -264,6 +264,8 @@
$fieldlabel1 = str_replace(" ","_",$fieldlabel);
if($fieldname == 'account_id' && $fieldtablename != 'vtiger_account')//Potential,Contacts,Invoice,SalesOrder & Quotes records sort by Account Name . But for account member of we have to avoid this
$optionvalue = "vtiger_account:accountname:accountname:".$module."_".$fieldlabel1.":".$fieldtypeofdata;
+ else if($fieldname == 'contact_id')//Calendar,Notes,PurchaseOrder,SalesOrder,Quotes,and Invoice records sort by Contact Name
+ $optionvalue = "vtiger_contactdetails:lastname:lastname:".$module."_".$fieldlabel1.":".$fieldtypeofdata;
else
$optionvalue = $fieldtablename.":".$fieldcolname.":".$fieldname.":".$module."_".$fieldlabel1.":".$fieldtypeofdata;
//added to escape attachments fields in customview as we have multiple attachments
@@ -793,7 +795,8 @@
{
$sqllist_column = "case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name";
}
-
+ if($list[0] == "vtiger_contactdetails" && $list[1] == "lastname")
+ $sqllist_column = "vtiger_contactdetails.lastname,vtiger_contactdetails.firstname";
$sqllist[] = $sqllist_column;
//Ends
Modified: vtigercrm/branches/5.0.3/modules/CustomView/PopulateCustomView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/CustomView/PopulateCustomView.php (original)
+++ vtigercrm/branches/5.0.3/modules/CustomView/PopulateCustomView.php Tue May 15 08:27:51 2007
@@ -304,7 +304,7 @@
'vtiger_crmentity:smownerid:assigned_user_id:Invoice_Assigned_To:V'),
Array('vtiger_notes:title:notes_title:Notes_Title:V',
- 'vtiger_notes:contact_id:contact_id:Notes_Contact_Name:I',
+ 'vtiger_contactdetails:lastname:lastname:Notes_Contact_Name:V',
'vtiger_senotesrel:crmid:parent_id:Notes_Related_to:I',
'vtiger_notes:filename:filename:Notes_File:V',
'vtiger_crmentity:modifiedtime:modifiedtime:Notes_Modified_Time:V'),
Modified: vtigercrm/branches/5.0.3/modules/Invoice/Invoice.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Invoice/Invoice.php (original)
+++ vtigercrm/branches/5.0.3/modules/Invoice/Invoice.php Tue May 15 08:27:51 2007
@@ -41,7 +41,7 @@
var $column_fields = Array();
- var $sortby_fields = Array('subject','invoice_no','invoicestatus','smownerid','accountname');
+ var $sortby_fields = Array('subject','invoice_no','invoicestatus','smownerid','accountname','lastname');
// This is used to retrieve related vtiger_fields from form posts.
var $additional_column_fields = Array('assigned_user_name', 'smownerid', 'opportunity_id', 'case_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id', 'parent_name', 'member_id' );
Modified: vtigercrm/branches/5.0.3/modules/Notes/Notes.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Notes/Notes.php (original)
+++ vtigercrm/branches/5.0.3/modules/Notes/Notes.php Tue May 15 08:27:51 2007
@@ -40,7 +40,7 @@
var $column_fields = Array();
- var $sortby_fields = Array('title','modifiedtime','contact_id','filename','createdtime');
+ var $sortby_fields = Array('title','modifiedtime','contact_id','filename','createdtime','lastname');
// This is used to retrieve related vtiger_fields from form posts.
var $additional_column_fields = Array('', '', '', '');
Modified: vtigercrm/branches/5.0.3/modules/PurchaseOrder/PurchaseOrder.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/PurchaseOrder/PurchaseOrder.php (original)
+++ vtigercrm/branches/5.0.3/modules/PurchaseOrder/PurchaseOrder.php Tue May 15 08:27:51 2007
@@ -46,7 +46,7 @@
var $column_fields = Array();
- var $sortby_fields = Array('subject','tracking_no','smownerid');
+ var $sortby_fields = Array('subject','tracking_no','smownerid','lastname');
// This is used to retrieve related vtiger_fields from form posts.
var $additional_column_fields = Array('assigned_user_name', 'smownerid', 'opportunity_id', 'case_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id', 'parent_name', 'member_id' );
Modified: vtigercrm/branches/5.0.3/modules/Quotes/Quotes.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Quotes/Quotes.php (original)
+++ vtigercrm/branches/5.0.3/modules/Quotes/Quotes.php Tue May 15 08:27:51 2007
@@ -51,7 +51,7 @@
var $column_fields = Array();
- var $sortby_fields = Array('subject','crmid','smownerid','accountname');
+ var $sortby_fields = Array('subject','crmid','smownerid','accountname','lastname');
// This is used to retrieve related vtiger_fields from form posts.
var $additional_column_fields = Array('assigned_user_name', 'smownerid', 'opportunity_id', 'case_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id', 'parent_name', 'member_id' );
Modified: vtigercrm/branches/5.0.3/modules/SalesOrder/SalesOrder.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/SalesOrder/SalesOrder.php (original)
+++ vtigercrm/branches/5.0.3/modules/SalesOrder/SalesOrder.php Tue May 15 08:27:51 2007
@@ -50,7 +50,7 @@
var $column_fields = Array();
- var $sortby_fields = Array('subject','smownerid','accountname');
+ var $sortby_fields = Array('subject','smownerid','accountname','lastname');
// This is used to retrieve related vtiger_fields from form posts.
var $additional_column_fields = Array('assigned_user_name', 'smownerid', 'opportunity_id', 'case_id', 'contact_id', 'task_id', 'note_id', 'meeting_id', 'call_id', 'email_id', 'parent_name', 'member_id' );
More information about the vtigercrm-commits
mailing list