[Vtigercrm-commits] [vtiger-commits] r7704 - in /vtigercrm/trunk: include/utils/ modules/Accounts/ modules/Activities/ modules/Campaigns/ modules/Contacts/ modules/Faq/ modules/HelpDesk/ modules/Invoice/ modules/Leads/ modules/Notes/ modules/Potentials/ modules/PriceBooks/ modules/Products/ modules/PurchaseOrder/ modules/Quotes/ modules/SalesOrder/ modules/Vendors/

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri Jun 30 08:56:03 EDT 2006


Author: richie
Date: Fri Jun 30 06:55:39 2006
New Revision: 7704

Log:
Added limit values of all listview query in listview

Modified:
    vtigercrm/trunk/include/utils/ListViewUtils.php
    vtigercrm/trunk/modules/Accounts/ListView.php
    vtigercrm/trunk/modules/Activities/ListView.php
    vtigercrm/trunk/modules/Campaigns/ListView.php
    vtigercrm/trunk/modules/Contacts/ListView.php
    vtigercrm/trunk/modules/Faq/ListView.php
    vtigercrm/trunk/modules/HelpDesk/ListView.php
    vtigercrm/trunk/modules/Invoice/ListView.php
    vtigercrm/trunk/modules/Leads/ListView.php
    vtigercrm/trunk/modules/Notes/ListView.php
    vtigercrm/trunk/modules/Potentials/ListView.php
    vtigercrm/trunk/modules/PriceBooks/ListView.php
    vtigercrm/trunk/modules/Products/ListView.php
    vtigercrm/trunk/modules/PurchaseOrder/ListView.php
    vtigercrm/trunk/modules/Quotes/ListView.php
    vtigercrm/trunk/modules/SalesOrder/ListView.php
    vtigercrm/trunk/modules/Vendors/ListView.php

Modified: vtigercrm/trunk/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/ListViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/ListViewUtils.php Fri Jun 30 06:55:39 2006
@@ -516,7 +516,8 @@
 	}
 	//end
 	if($navigation_array['start'] !=0)
-	for ($i=$navigation_array['start']; $i<=$navigation_array['end_val']; $i++)
+	for ($i=1; $i<=$noofrows; $i++)
+	//for ($i=$navigation_array['start']; $i<=$navigation_array['end_val']; $i++)
 	{
 		$list_header =Array();
 		//Getting the entityid
@@ -1463,7 +1464,6 @@
 					if($module == "Contacts")
 					{
 						$query="SELECT vtiger_contactdetails.imagename FROM vtiger_contactdetails WHERE lastname='".$temp_val."'";
-						//echo $query;
 						$result = $adb->query($query);
 						$imagename=$adb->query_result($result,0,'imagename');
 						if($imagename != '')

Modified: vtigercrm/trunk/modules/Accounts/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Accounts/ListView.php (original)
+++ vtigercrm/trunk/modules/Accounts/ListView.php Fri Jun 30 06:55:39 2006
@@ -76,6 +76,7 @@
 $viewid = $oCustomView->getViewId($currentModule);
 $customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
+$groupid = $oCustomView->getGroupId($currentModule);
 //<<<<<customview>>>>>
 $smarty->assign("CHANGE_OWNER",getUserslist());
 if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
@@ -170,10 +171,11 @@
                 $query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
         }
 }
-$list_result = $adb->query($query);
 
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+
+$count_result = $adb->query("select count(*) count ".substr($query, strpos($query,'FROM'),strlen($query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -193,6 +195,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($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))

Modified: vtigercrm/trunk/modules/Activities/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Activities/ListView.php (original)
+++ vtigercrm/trunk/modules/Activities/ListView.php Fri Jun 30 06:55:39 2006
@@ -135,8 +135,6 @@
         $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 }
 
-$list_result = $adb->query($list_query);
-
 //Constructing the list view
 $smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
 $smarty->assign("VIEWID", $viewid);
@@ -151,8 +149,16 @@
 
 
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
-
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = 0;
+if($adb->num_rows($count_result)!=0)
+{
+	for($k=0;$k < $adb->num_rows($count_result);$k++)
+        {
+		$noofrows = $noofrows + $adb->query_result($count_result,$k,"count");
+	}
+}
+										
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
 {
@@ -170,6 +176,13 @@
 $end_rec = $navigation_array['end_val']; 
 //By raju Ends
 
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings['LBL_SHOWING']." " .$start_rec." - ".$end_rec." " .$app_strings['LBL_LIST_OF'] ." ".$noofrows;
 

Modified: vtigercrm/trunk/modules/Campaigns/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Campaigns/ListView.php (original)
+++ vtigercrm/trunk/modules/Campaigns/ListView.php Fri Jun 30 06:55:39 2006
@@ -151,11 +151,11 @@
 	$list_query .= ' order by vtiger_campaign.campaignid DESC';
 }
 
-$list_result = $adb->query($list_query);
 //Constructing the list view
 
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -173,6 +173,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$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))

Modified: vtigercrm/trunk/modules/Contacts/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Contacts/ListView.php (original)
+++ vtigercrm/trunk/modules/Contacts/ListView.php Fri Jun 30 06:55:39 2006
@@ -169,8 +169,6 @@
         }
 }
 
-$list_result = $adb->query($list_query);
-
 //Constructing the list view
 
 $custom = get_form_header($current_module_strings['LBL_LIST_FORM_TITLE'],$other_text, false);
@@ -183,8 +181,8 @@
 $smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
 $smarty->assign("VIEWID", $viewid);
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
-
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
 {
@@ -201,6 +199,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$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))

Modified: vtigercrm/trunk/modules/Faq/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Faq/ListView.php (original)
+++ vtigercrm/trunk/modules/Faq/ListView.php Fri Jun 30 06:55:39 2006
@@ -129,11 +129,7 @@
         $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 }
 
-$list_result = $adb->query($list_query);
-
 //Constructing the list view 
-
-
 
 $smarty->assign("MOD", $mod_strings);
 $smarty->assign("APP", $app_strings);
@@ -143,7 +139,9 @@
 $smarty->assign("CATEGORY",$category);
 $smarty->assign("SINGLE_MOD",'Note');
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+//Retreiving the no of rows
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 if($viewnamedesc['viewname'] == 'All')
 {
@@ -166,6 +164,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 // Raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 

Modified: vtigercrm/trunk/modules/HelpDesk/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/HelpDesk/ListView.php (original)
+++ vtigercrm/trunk/modules/HelpDesk/ListView.php Fri Jun 30 06:55:39 2006
@@ -142,13 +142,11 @@
 	$list_query .= ' order by vtiger_troubletickets.ticketid DESC';
 }
 
-
-$list_result = $adb->query($list_query);
-
 //Constructing the list view
 
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -166,6 +164,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$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))

Modified: vtigercrm/trunk/modules/Invoice/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Invoice/ListView.php (original)
+++ vtigercrm/trunk/modules/Invoice/ListView.php Fri Jun 30 06:55:39 2006
@@ -140,10 +140,10 @@
         }
 }
 
-$list_result = $adb->query($query);
 
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($query, strpos($query,'FROM'),strlen($query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -162,6 +162,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 

Modified: vtigercrm/trunk/modules/Leads/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Leads/ListView.php (original)
+++ vtigercrm/trunk/modules/Leads/ListView.php Fri Jun 30 06:55:39 2006
@@ -171,9 +171,9 @@
         $query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 }
 
-$list_result = $adb->query($query);
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($query, strpos($query,'FROM'),strlen($query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -185,6 +185,14 @@
 
 //Retreive the Navigation array
 $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 
 //mass merge for word templates -- *Raj*17/11
@@ -217,6 +225,14 @@
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
 
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
+
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 
 //Retreive the List View Table Header

Modified: vtigercrm/trunk/modules/Notes/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Notes/ListView.php (original)
+++ vtigercrm/trunk/modules/Notes/ListView.php Fri Jun 30 06:55:39 2006
@@ -149,10 +149,10 @@
         $query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 }
 
-$list_result = $adb->query($query);
 
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($query, strpos($query,'FROM'),strlen($query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -170,6 +170,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 //By raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;

Modified: vtigercrm/trunk/modules/Potentials/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Potentials/ListView.php (original)
+++ vtigercrm/trunk/modules/Potentials/ListView.php Fri Jun 30 06:55:39 2006
@@ -153,8 +153,6 @@
 
 }
 
-$list_result = $adb->query($list_query);
-
 //Constructing the list view
 
 $smarty->assign("MOD", $mod_strings);
@@ -169,7 +167,8 @@
 
 
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -188,6 +187,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 

Modified: vtigercrm/trunk/modules/PriceBooks/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/PriceBooks/ListView.php (original)
+++ vtigercrm/trunk/modules/PriceBooks/ListView.php Fri Jun 30 06:55:39 2006
@@ -110,10 +110,10 @@
         $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 }
 
-$list_result = $adb->query($list_query);
 
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -131,6 +131,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 

Modified: vtigercrm/trunk/modules/Products/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Products/ListView.php (original)
+++ vtigercrm/trunk/modules/Products/ListView.php Fri Jun 30 06:55:39 2006
@@ -121,11 +121,9 @@
         $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 }
 
-$list_result = $adb->query($list_query);
-
-
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -143,6 +141,13 @@
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
 
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 

Modified: vtigercrm/trunk/modules/PurchaseOrder/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/PurchaseOrder/ListView.php (original)
+++ vtigercrm/trunk/modules/PurchaseOrder/ListView.php Fri Jun 30 06:55:39 2006
@@ -138,10 +138,9 @@
         }
 }
 
-$list_result = $adb->query($query);
-
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($query, strpos($query,'FROM'),strlen($query)));
+$noofrows = $adb->query_result($count_result,0,"count");
         
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -160,6 +159,13 @@
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
 
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 

Modified: vtigercrm/trunk/modules/Quotes/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Quotes/ListView.php (original)
+++ vtigercrm/trunk/modules/Quotes/ListView.php Fri Jun 30 06:55:39 2006
@@ -138,10 +138,9 @@
         }
 }
 
-$list_result = $adb->query($query);
-
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($query, strpos($query,'FROM'),strlen($query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -161,6 +160,13 @@
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
 
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 

Modified: vtigercrm/trunk/modules/SalesOrder/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/SalesOrder/ListView.php (original)
+++ vtigercrm/trunk/modules/SalesOrder/ListView.php Fri Jun 30 06:55:39 2006
@@ -125,11 +125,10 @@
         }
 }
 
-$list_result = $adb->query($list_query);
-
 
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -148,6 +147,13 @@
 $end_rec = $navigation_array['end_val']; 
 //By Raju Ends
 
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 

Modified: vtigercrm/trunk/modules/Vendors/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Vendors/ListView.php (original)
+++ vtigercrm/trunk/modules/Vendors/ListView.php Fri Jun 30 06:55:39 2006
@@ -120,10 +120,9 @@
         $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 }
 
-$list_result = $adb->query($list_query);
-
 //Retreiving the no of rows
-$noofrows = $adb->num_rows($list_result);
+$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$noofrows = $adb->query_result($count_result,0,"count");
 
 //Storing Listview session object
 if($_SESSION['lvs'][$currentModule])
@@ -140,6 +139,14 @@
 $start_rec = $navigation_array['start'];
 $end_rec = $navigation_array['end_val']; 
 //By raju Ends
+
+//limiting the query
+if ($start_rec ==0) 
+	$limit_start_rec = 0;
+else
+	$limit_start_rec = $start_rec -1;
+	
+$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 





More information about the vtigercrm-commits mailing list