[Vtigercrm-commits] [vtiger-commits] r5889 - in /vtigercrm/branches/5.0_postgresql_integration: data/ include/ include/Ajax/ include/freetag/ include/utils/ install/ modules/Activities/ modules/Calendar/ modules/Dashboard/ modules/Notes/ modules/Reports/ modules/Settings/ modules/Users/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Thu May 11 17:23:42 EDT 2006
Author: allanbush
Date: Thu May 11 15:23:26 2006
New Revision: 5889
Log:
All the ListViews working. Refs #752.
Modified:
vtigercrm/branches/5.0_postgresql_integration/data/CRMEntity.php
vtigercrm/branches/5.0_postgresql_integration/include/Ajax/CommonAjax.php
vtigercrm/branches/5.0_postgresql_integration/include/FormValidationUtil.php
vtigercrm/branches/5.0_postgresql_integration/include/freetag/freetag.class.php
vtigercrm/branches/5.0_postgresql_integration/include/utils/UserInfoUtil.php
vtigercrm/branches/5.0_postgresql_integration/install/5createTables.inc.php
vtigercrm/branches/5.0_postgresql_integration/modules/Activities/Activity.php
vtigercrm/branches/5.0_postgresql_integration/modules/Activities/ListView.php
vtigercrm/branches/5.0_postgresql_integration/modules/Activities/RenderRelatedListUI.php
vtigercrm/branches/5.0_postgresql_integration/modules/Calendar/calendarLayout.php
vtigercrm/branches/5.0_postgresql_integration/modules/Dashboard/display_charts.php
vtigercrm/branches/5.0_postgresql_integration/modules/Notes/ListView.php
vtigercrm/branches/5.0_postgresql_integration/modules/Reports/ReportRun.php
vtigercrm/branches/5.0_postgresql_integration/modules/Settings/PickList.php
vtigercrm/branches/5.0_postgresql_integration/modules/Users/DetailView.php
Modified: vtigercrm/branches/5.0_postgresql_integration/data/CRMEntity.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/data/CRMEntity.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/data/CRMEntity.php Thu May 11 15:23:26 2006
@@ -791,7 +791,7 @@
{
if($table_name == 'activity')
{
- updateActivityGroupRelation($this->id,'');
+ updateActivityGroupRelation($this->id,$groupname);
}
}
@@ -977,7 +977,7 @@
{
$activity_id=$this->id;
- $sql='select min(recurringdate) min_date,max(recurringdate) max_date,recurringtype from recurringevents where activityid='. $activity_id.' group by activityid';
+ $sql='select min(recurringdate) AS min_date,max(recurringdate) AS max_date, recurringtype, activityid from recurringevents where activityid='. $activity_id.' group by activityid, recurringtype';
$result = $adb->query($sql);
$noofrows = $adb->num_rows($result);
@@ -1046,7 +1046,7 @@
$tdate=$date_array[$k];
if($tdate <= $end_date)
{
- $max_recurid_qry = 'select max(recurringid) recurid from recurringevents;';
+ $max_recurid_qry = 'select max(recurringid) AS recurid from recurringevents;';
$result = $adb->query($max_recurid_qry);
$noofrows = $adb->num_rows($result);
for($i=0; $i<$noofrows; $i++)
@@ -1054,7 +1054,7 @@
$recur_id = $adb->query_result($result,$i,"recurid");
}
$current_id =$recur_id+1;
- $recurring_insert = 'insert into recurringevents values ("'.$current_id.'","'.$this->id.'","'.$tdate.'","'.$type.'")';
+ $recurring_insert = "insert into recurringevents values ('".$current_id."','".$this->id."','".$tdate."','".$type."')";
$adb->query($recurring_insert);
if($_REQUEST['set_reminder'] == 'Yes')
{
Modified: vtigercrm/branches/5.0_postgresql_integration/include/Ajax/CommonAjax.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/include/Ajax/CommonAjax.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/include/Ajax/CommonAjax.php Thu May 11 15:23:26 2006
@@ -34,7 +34,7 @@
$module = $_REQUEST["module"];
$useid = $current_user->id;
global $adb;
- $query='select * from freetagged_objects where module = "'.$module .'"';
+ $query="select * from freetagged_objects where module = '".$module ."'";
$result=$adb->query($query);
if($adb->num_rows($result) > 0)
{
Modified: vtigercrm/branches/5.0_postgresql_integration/include/FormValidationUtil.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/include/FormValidationUtil.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/include/FormValidationUtil.php Thu May 11 15:23:26 2006
@@ -17,7 +17,7 @@
function getDBValidationData($tablearray,$tabid='')
{
global $log;
- $log->debug("Entering getDBValidationData(".$tablearray.",".$tabid=''.") method ...");
+ $log->debug("Entering getDBValidationData(".$tablearray.",".$tabid."='') method ...");
$sql = '';
$tab_con = "";
$numValues = count($tablearray);
Modified: vtigercrm/branches/5.0_postgresql_integration/include/freetag/freetag.class.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/include/freetag/freetag.class.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/include/freetag/freetag.class.php Thu May 11 15:23:26 2006
@@ -378,7 +378,7 @@
}
$prefix = $this->_table_prefix;
- $sql = "SELECT DISTINCT tag, raw_tag, tagger_id
+ $sql = "SELECT DISTINCT tag, raw_tag, tagger_id, id
FROM ${prefix}freetagged_objects INNER JOIN ${prefix}freetags ON (tag_id = id)
WHERE object_id = $object_id
$tagger_sql
@@ -437,7 +437,7 @@
}
$sql = "SELECT COUNT(*) as count
FROM ${prefix}freetagged_objects INNER JOIN ${prefix}freetags ON (tag_id = id)
- WHERE 1
+ WHERE 1=1
$tagger_sql
AND object_id = $object_id
AND tag = $normalized_tag
@@ -964,14 +964,12 @@
$sql = "SELECT tag, COUNT(object_id) AS quantity
FROM ${prefix}freetags INNER JOIN ${prefix}freetagged_objects
ON (${prefix}freetags.id = tag_id)
- WHERE 1
+ WHERE 1=1
$tagger_sql
GROUP BY tag
- ORDER BY quantity DESC
- LIMIT 0, $max
- ";
+ ORDER BY quantity DESC";
//echo $sql;
- $rs = $adb->query($sql) or die("Syntax Error: $sql");
+ $rs = $adb->limitQuery($sql, 0, $max) or die("Syntax Error: $sql");
while(!$rs->EOF) {
$retarr[$rs->fields['tag']] = $rs->fields['quantity'];
$rs->MoveNext();
Modified: vtigercrm/branches/5.0_postgresql_integration/include/utils/UserInfoUtil.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/include/utils/UserInfoUtil.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/include/utils/UserInfoUtil.php Thu May 11 15:23:26 2006
@@ -1219,9 +1219,11 @@
$log->debug("Entering updateActivityGroupRelation(".$activityid.",".$groupname.") method ...");
global $adb;
$sqldelete = "delete from activitygrouprelation where activityid=".$activityid;
- $adb->query($sqldelete);
- $sql = "insert into activitygrouprelation values (".$activityid .",'" .$groupname ."')";
- $adb->query($sql);
+ if($groupname != '' && $groupname != 'null') {
+ $adb->query($sqldelete);
+ $sql = "insert into activitygrouprelation values (".$activityid .",'" .$groupname ."')";
+ $adb->query($sql);
+ }
$log->debug("Exiting updateActivityGroupRelation method ...");
}
Modified: vtigercrm/branches/5.0_postgresql_integration/install/5createTables.inc.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/install/5createTables.inc.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/install/5createTables.inc.php Thu May 11 15:23:26 2006
@@ -217,6 +217,7 @@
// creation occurs within a transaction we get problems
$db->getUniqueID("crmentity");
$db->getUniqueID("seactivityrel");
+$db->getUniqueID("freetags");
// populate the db with seed data
if ($db_populate) {
Modified: vtigercrm/branches/5.0_postgresql_integration/modules/Activities/Activity.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/modules/Activities/Activity.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/modules/Activities/Activity.php Thu May 11 15:23:26 2006
@@ -201,7 +201,7 @@
$noofrows_recur = $adb->num_rows($recur_result);
if($noofrows_recur==0)
{
- $recur_dates_qry='select activity.date_start,recurringevents.* from activity left outer join recurringevents on activity.activityid=recurringevents.activityid where recurringevents.activityid is NULL and activity.activityid='.$activity_id .' group by activity.activityid';
+ $recur_dates_qry="select activity.date_start,recurringevents.* from activity left outer join recurringevents on activity.activityid=recurringevents.activityid where recurringevents.activityid is NULL and activity.activityid=".$activity_id;
$recur_result=$adb->query($recur_dates_qry);
$noofrows_recur = $adb->num_rows($recur_result);
@@ -251,7 +251,7 @@
$activity_start_time=time_to_number($act_time_start);
$activity_end_time=get_duration($act_time_start,$act_hour_dur,$act_mins_dur);
- $activity_owner_qry='select users.user_name,users.id userid from users,crmentity where users.id=crmentity.smownerid and crmentity.crmid='.$id;
+ $activity_owner_qry='select users.user_name,users.id AS userid from users,crmentity where users.id=crmentity.smownerid and crmentity.crmid='.$id;
$result_owner=$adb->query($activity_owner_qry);
while($row_owner = $adb->fetch_array($result_owner))
Modified: vtigercrm/branches/5.0_postgresql_integration/modules/Activities/ListView.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/modules/Activities/ListView.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/modules/Activities/ListView.php Thu May 11 15:23:26 2006
@@ -110,8 +110,6 @@
$list_query .= " AND " .$where;
}
-$list_query .= ' GROUP BY crmentity.crmid'; //Appeding for the recurring event by jaguar
-
if(isset($order_by) && $order_by != '')
{
$tablename = getTableNameForField('Activities',$order_by);
Modified: vtigercrm/branches/5.0_postgresql_integration/modules/Activities/RenderRelatedListUI.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/modules/Activities/RenderRelatedListUI.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/modules/Activities/RenderRelatedListUI.php Thu May 11 15:23:26 2006
@@ -68,7 +68,7 @@
}
else
{
- $usr_query="select activityid,activity.date_start,activity.due_date, activity.time_start,activity.duration_hours,activity.duration_minutes,crmentity.smownerid from activity,crmentity where crmentity.crmid=activity.activityid and ('".$avail_date."' like date_start) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0 group by crmid;";
+ $usr_query="select activityid,activity.date_start,activity.due_date, activity.time_start,activity.duration_hours,activity.duration_minutes,crmentity.smownerid from activity,crmentity where crmentity.crmid=activity.activityid and ('".$avail_date."' like date_start) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0";
}
$result_cal=$adb->query($usr_query);
$noofrows_cal = $adb->num_rows($result_cal);
@@ -98,7 +98,7 @@
}
if($avail_flag!="true")
{
- $recur_query="SELECT activity.activityid, activity.time_start, activity.duration_hours, activity.duration_minutes , crmentity.smownerid, recurringevents.recurringid, recurringevents.recurringdate as date_start from activity inner join crmentity on activity.activityid = crmentity.crmid inner join recurringevents on activity.activityid=recurringevents.activityid where ('".$avail_date."' like recurringevents.recurringdate) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0 group by crmid";
+ $recur_query="SELECT activity.activityid, activity.time_start, activity.duration_hours, activity.duration_minutes , crmentity.smownerid, recurringevents.recurringid, recurringevents.recurringdate as date_start from activity inner join crmentity on activity.activityid = crmentity.crmid inner join recurringevents on activity.activityid=recurringevents.activityid where ('".$avail_date."' like recurringevents.recurringdate) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0";
$result_cal=$adb->query($recur_query);
$noofrows_cal = $adb->num_rows($result_cal);
Modified: vtigercrm/branches/5.0_postgresql_integration/modules/Calendar/calendarLayout.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/modules/Calendar/calendarLayout.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/modules/Calendar/calendarLayout.php Thu May 11 15:23:26 2006
@@ -504,14 +504,29 @@
$Entries = Array();
global $adb,$current_user;
- $query = "select groups.groupname ,users.user_name,activity.activitytype,activity.subject,crmentity.smownerid,seactivityrel.crmid,cntactivityrel.contactid ,crmentity.crmid,activity.* from activity inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid= cntactivityrel.contactid left join seactivityrel on seactivityrel.activityid = activity.activityid left join activitygrouprelation on activitygrouprelation.activityid=crmentity.crmid left join groups on groups.groupname=activitygrouprelation.groupname left join users on users.id=crmentity.smownerid left outer join account on account.accountid = contactdetails.accountid left outer join recurringevents on recurringevents.activityid=activity.activityid WHERE crmentity.deleted=0 and (activity.activitytype = 'Meeting' or activity.activitytype='Call' or activity.activitytype='Task') and (activity.activitytype != 'Task') and (activity.date_start between '".$start_date."' and '".$end_date."' or activity.due_date between '".$start_date."' and '".$end_date."' or recurringevents.recurringdate between '".$start_date."' and '".$end_date."')";
+ $query = "SELECT cntactivityrel.contactid, activity.*
+ FROM activity
+ INNER JOIN crmentity
+ ON crmentity.crmid = activity.activityid
+ LEFT JOIN cntactivityrel
+ ON cntactivityrel.activityid = activity.activityid
+ LEFT OUTER JOIN recurringevents
+ ON recurringevents.activityid = activity.activityid
+ WHERE crmentity.deleted = 0
+ AND (activity.activitytype = 'Meeting' OR activity.activitytype = 'Call')
+ AND (activity.date_start BETWEEN '".$start_date."' AND '".$end_date."'
+ OR activity.due_date BETWEEN '".$start_date."' AND '".$end_date."'
+ OR recurringevents.recurringdate BETWEEN '".$start_date."' AND '".$end_date."')";
if($info != '')
{
- $pending_query = $query." and (activity.eventstatus = 'Planned') and crmentity.smownerid = ".$current_user->id." GROUP BY crmentity.crmid ORDER BY activity.date_start,activity.time_start ASC";
+ $pending_query = $query." AND (activity.eventstatus = 'Planned')
+ AND crmentity.smownerid = ".$current_user->id."
+ ORDER BY activity.date_start,activity.time_start ASC";
$res = $adb->query($pending_query);
$pending_rows = $adb->num_rows($res);
}
- $query .= " and crmentity.smownerid = ".$current_user->id." GROUP BY crmentity.crmid ORDER BY activity.date_start,activity.time_start ASC";
+ $query .= " AND crmentity.smownerid = ".$current_user->id."
+ ORDER BY activity.date_start,activity.time_start ASC";
$result = $adb->query($query);
$rows = $adb->num_rows($result);
if($info != '')
Modified: vtigercrm/branches/5.0_postgresql_integration/modules/Dashboard/display_charts.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/modules/Dashboard/display_charts.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/modules/Dashboard/display_charts.php Thu May 11 15:23:26 2006
@@ -63,7 +63,7 @@
$invoice_query="select crmentity.*,invoice.* from invoice inner join crmentity on crmentity.crmid=invoice.invoiceid inner join invoicebillads on invoice.invoiceid=invoicebillads.invoicebilladdressid inner join invoiceshipads on invoice.invoiceid=invoiceshipads.invoiceshipaddressid left outer join salesorder on salesorder.salesorderid=invoice.salesorderid inner join invoicecf on invoice.invoiceid = invoicecf.invoiceid left join invoicegrouprelation on invoice.invoiceid=invoicegrouprelation.invoiceid left join groups on groups.groupname=invoicegrouprelation.groupname left join users on users.id=crmentity.smownerid where crmentity.deleted=0 ";
//Query for tickets
-$helpdesk_query=" select troubletickets.status ticketstatus, troubletickets.*,crmentity.* from troubletickets inner join ticketcf on ticketcf.ticketid = troubletickets.ticketid inner join crmentity on crmentity.crmid=troubletickets.ticketid left join ticketgrouprelation on troubletickets.ticketid=ticketgrouprelation.ticketid left join groups on groups.groupname=ticketgrouprelation.groupname left join contactdetails on troubletickets.parent_id=contactdetails.contactid left join account on account.accountid=troubletickets.parent_id left join users on crmentity.smownerid=users.id and troubletickets.ticketid = ticketcf.ticketid where crmentity.deleted=0";
+$helpdesk_query=" select troubletickets.status AS ticketstatus, troubletickets.*,crmentity.* from troubletickets inner join ticketcf on ticketcf.ticketid = troubletickets.ticketid inner join crmentity on crmentity.crmid=troubletickets.ticketid left join ticketgrouprelation on troubletickets.ticketid=ticketgrouprelation.ticketid left join groups on groups.groupname=ticketgrouprelation.groupname left join contactdetails on troubletickets.parent_id=contactdetails.contactid left join account on account.accountid=troubletickets.parent_id left join users on crmentity.smownerid=users.id and troubletickets.ticketid = ticketcf.ticketid where crmentity.deleted=0";
/** This function returns the values for the graph, for any type of graph needed
* Portions created by vtiger are Copyright (C) vtiger.
Modified: vtigercrm/branches/5.0_postgresql_integration/modules/Notes/ListView.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/modules/Notes/ListView.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/modules/Notes/ListView.php Thu May 11 15:23:26 2006
@@ -130,8 +130,6 @@
$query .= ' and '.$where;
}
-$query .= ' group by notes.notesid';
-
if(isset($order_by) && $order_by != '')
{
$tablename = getTableNameForField('Notes',$order_by);
Modified: vtigercrm/branches/5.0_postgresql_integration/modules/Reports/ReportRun.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/modules/Reports/ReportRun.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/modules/Reports/ReportRun.php Thu May 11 15:23:26 2006
@@ -65,7 +65,7 @@
$querycolumns = $this->getEscapedColumns($selectedfields);
if($querycolumns == "")
{
- $columnslist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." '".$selectedfields[2]."'";
+ $columnslist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1].' AS "'.$selectedfields[2].'"';
}else
{
$columnslist[$fieldcolname] = $querycolumns;
Modified: vtigercrm/branches/5.0_postgresql_integration/modules/Settings/PickList.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/modules/Settings/PickList.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/modules/Settings/PickList.php Thu May 11 15:23:26 2006
@@ -48,7 +48,7 @@
global $adb;
$user_fld = Array();
$tabid = getTabid($fldmodule);
- $query = "select fieldlabel,generatedtype,columnname,fieldname from field where displaytype = 1 and (tabid = ".getTabid($fld_module)." && uitype IN (15,16)) || (tabid = ".getTabid($fld_module)." && fieldname='salutationtype')";
+ $query = "select fieldlabel,generatedtype,columnname,fieldname from field where displaytype = 1 and (tabid = ".getTabid($fld_module)." AND uitype IN (15,16)) OR (tabid = ".getTabid($fld_module)." AND fieldname='salutationtype')";
$result = $adb->query($query);
$noofrows = $adb->num_rows($result);
if($noofrows > 0)
Modified: vtigercrm/branches/5.0_postgresql_integration/modules/Users/DetailView.php
==============================================================================
--- vtigercrm/branches/5.0_postgresql_integration/modules/Users/DetailView.php (original)
+++ vtigercrm/branches/5.0_postgresql_integration/modules/Users/DetailView.php Thu May 11 15:23:26 2006
@@ -207,9 +207,14 @@
$smarty->assign("CURRENCY_NAME",$currency);
//Getting the Group Lists
-$query ="select groupid,groupname from groups where groupid in (".fetchUserGroupids($focus->id).")";
-$result = $adb->query($query);
-$num_rows = $adb->num_rows($result);
+$groupids = fetchUserGroupids($focus->id);
+if($groupids) {
+ $query ="select groupid,groupname from groups where groupid in (".$groupids.")";
+ $result = $adb->query($query);
+ $num_rows = $adb->num_rows($result);
+} else {
+ $num_rows = 0;
+}
More information about the vtigercrm-commits
mailing list