[Vtigercrm-commits] [vtiger-commits] r9165 - /vtigercrm/trunk/modules/HelpDesk/ListView.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Aug 28 15:34:08 EDT 2006


Author: richie
Date: Mon Aug 28 13:34:02 2006
New Revision: 9165

Log:
Support for PostGres DB done

Modified:
    vtigercrm/trunk/modules/HelpDesk/ListView.php

Modified: vtigercrm/trunk/modules/HelpDesk/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/HelpDesk/ListView.php (original)
+++ vtigercrm/trunk/modules/HelpDesk/ListView.php Mon Aug 28 13:34:02 2006
@@ -23,6 +23,9 @@
 require_once('themes/'.$theme.'/layout_utils.php');
 require_once('include/utils/utils.php');
 require_once('modules/CustomView/CustomView.php');
+require_once('include/database/Postgres8.php');
+require_once('include/DatabaseUtil.php');
+
 
 global $app_strings;
 global $mod_strings;
@@ -127,25 +130,31 @@
 {
 	if($order_by == 'smownerid')
 	{
+		if( $adb->dbType == "pgsql")
+ 		    $list_query .= ' GROUP BY vtiger_users.user_name';
 		$list_query .= ' ORDER BY vtiger_users.user_name '.$sorder;
 	}
 	else
 	{
 		$tablename = getTableNameForField('HelpDesk',$order_by);
 		$tablename = (($tablename != '')?($tablename."."):'');
-
+		if( $adb->dbType == "pgsql")
+ 		    $list_query .= ' GROUP BY '.$tablename.$order_by;
+		
 	        $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 	}
 }
 else
 {
-	$list_query .= ' order by vtiger_troubletickets.ticketid DESC';
+	if( $adb->dbType == "pgsql")
+ 	    $list_query .= ' GROUP BY vtiger_troubletickets.ticketid';
+ 	$list_query .= ' ORDER BY vtiger_troubletickets.ticketid DESC';	
 }
 
 //Constructing the list view
 
 //Retreiving the no of rows
-$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$count_result = $adb->query( mkCountQuery( $list_query));
 $noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
@@ -158,6 +167,11 @@
 
 //Retreive the Navigation array
 $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
+ //Postgres 8 fixes
+ if( $adb->dbType == "pgsql")
+     $list_query = fixPostgresQuery( $list_query, $log, 0);
+
+
 
 // Setting the record count string
 //modified by rdhital
@@ -171,7 +185,10 @@
 else
 	$limit_start_rec = $start_rec -1;
 	
-$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
+if( $adb->dbType == "pgsql")
+     $list_result = $adb->query($list_query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
+else
+     $list_result = $adb->query($list_query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);
 
 //mass merge for word templates -- *Raj*17/11
 while($row = $adb->fetch_array($list_result))





More information about the vtigercrm-commits mailing list