[Vtigercrm-commits] [vtiger-commits] r6398 - in /vtigercrm/trunk: Smarty/templates/RelatedLists.tpl include/ListView/ListViewSession.php include/RelatedListView.php include/utils/ListViewUtils.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Wed May 24 23:16:29 EDT 2006
Author: saraj
Date: Wed May 24 21:16:21 2006
New Revision: 6398
Log:
pagination issues in related list fixed
Modified:
vtigercrm/trunk/Smarty/templates/RelatedLists.tpl
vtigercrm/trunk/include/ListView/ListViewSession.php
vtigercrm/trunk/include/RelatedListView.php
vtigercrm/trunk/include/utils/ListViewUtils.php
Modified: vtigercrm/trunk/Smarty/templates/RelatedLists.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/RelatedLists.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/RelatedLists.tpl Wed May 24 21:16:21 2006
@@ -13,17 +13,6 @@
-->*}
<script language="JavaScript" type="text/javascript" src="modules/PriceBooks/PriceBook.js"></script>
<script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
-<script>
-function getListViewEntries_js(module,url)
-{ldelim}
- //Var ajaxObj = new Ajax(ajaxSaveResponse);
- var urlstring ="module={$MODULE}&action={$MODULE}Ajax&record={$ID}&file=CallRelatedList&ajax=true&"+url+"&rmodule="+module;
- //alert(urlstring);
- //ajaxObj.process("index.php?",urlstring);
-
-{rdelim}
-
-</script>
{include file='Buttons_List1.tpl'}
<!-- Contents -->
Modified: vtigercrm/trunk/include/ListView/ListViewSession.php
==============================================================================
--- vtigercrm/trunk/include/ListView/ListViewSession.php (original)
+++ vtigercrm/trunk/include/ListView/ListViewSession.php Wed May 24 21:16:21 2006
@@ -16,6 +16,8 @@
var $module = null;
var $viewname = null;
var $start = null;
+ var $sorder = null;
+ var $sortby = null;
var $page_view = null;
/**initializes ListViewSession
@@ -29,6 +31,7 @@
$log->debug("Entering ListViewSession() method ...");
$this->module = $currentModule;
+ $this->sortby = 'ASC';
$this->start =1;
}
Modified: vtigercrm/trunk/include/RelatedListView.php
==============================================================================
--- vtigercrm/trunk/include/RelatedListView.php (original)
+++ vtigercrm/trunk/include/RelatedListView.php Wed May 24 21:16:21 2006
@@ -32,11 +32,7 @@
$smarty = new vtigerCRM_Smarty;
if (!isset($where)) $where = "";
- if(method_exists($focus,getSortOrder))
- $sorder = $focus->getSortOrder();
- if(method_exists($focus,getOrderBy))
- $order_by = $focus->getOrderBy();
-
+
$button = '<table cellspacing=0 cellpadding=2><tr><td>'.$button.'</td></tr></table>';
// Added to have Purchase Order as form Title
@@ -86,18 +82,38 @@
if(!$_SESSION['rlvs'][$module][$relatedmodule])
{
$modObj = new ListViewSession();
- $modObj->sorder = $sorder;
- $modObj->sortby = $order_by;
+ $modObj->sortby = $focus->default_order_by;
+ $modObj->sorder = $focus->default_sort_order;
$_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
}
-
- //$url_qry = getURLstring($focus);
-
- if(isset($order_by) && $order_by != '')
- {
- $query .= ' ORDER BY '.$order_by.' '.$sorder;
- $url_qry .="&order_by=".$order_by;
- }
+ if(isset($_REQUEST['relmodule']) && ($_REQUEST['relmodule'] == $relatedmodule))
+ {
+ if(method_exists($focus,getSortOrder))
+ $sorder = $focus->getSortOrder();
+ if(method_exists($focus,getOrderBy))
+ $order_by = $focus->getOrderBy();
+
+ if(isset($order_by) && $order_by != '')
+ {
+ $_SESSION['rlvs'][$module][$relatedmodule]['sorder'] = $sorder;
+ $_SESSION['rlvs'][$module][$relatedmodule]['sortby'] = $order_by;
+ }
+
+ }
+ elseif($_SESSION['rlvs'][$module][$relatedmodule])
+ {
+ $sorder = $_SESSION['rlvs'][$module][$relatedmodule]['sorder'];
+ $order_by = $_SESSION['rlvs'][$module][$relatedmodule]['sortby'];
+ }
+ else
+ {
+ $order_by = $focus->default_order_by;
+ $sorder = $focus->default_sort_order;
+ }
+
+ $query .= ' ORDER BY '.$order_by.' '.$sorder;
+ $url_qry .="&order_by=".$order_by;
+
$list_result = $adb->query($query);
//Retreiving the no of rows
$noofrows = $adb->num_rows($list_result);
@@ -122,7 +138,8 @@
}
else
{
- $listview_header = getListViewHeader($focus,$relatedmodule,'',$sorder,$order_by,'relatedlist');//"Accounts");
+ $id = $_REQUEST['record'];
+ $listview_header = getListViewHeader($focus,$relatedmodule,'',$sorder,$order_by,$id,'',$module);//"Accounts");
if ($noofrows > 15)
{
$smarty->assign('SCROLLSTART','<div style="overflow:auto;height:315px;width:100%;">');
@@ -151,7 +168,7 @@
$navigationOutput = Array();
$navigationOutput[] = $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
$module_rel = $module.'&relmodule='.$relatedmodule.'&record='.$id;
- $navigationOutput[] = getTableHeaderNavigation($navigation_array, $url_qry,$module_rel);
+ $navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry,$module_rel);
$related_entries = array('header'=>$listview_header,'entries'=>$listview_entries,'navigation'=>$navigationOutput);
$log->debug("Exiting GetRelatedList method ...");
return $related_entries;
Modified: vtigercrm/trunk/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/ListViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/ListViewUtils.php Wed May 24 21:16:21 2006
@@ -34,7 +34,7 @@
*Param $oCv - Custom view object
*Returns the listview header values in an array
*/
-function getListViewHeader($focus, $module,$sort_qry='',$sorder='',$order_by='',$relatedlist='',$oCv='')
+function getListViewHeader($focus, $module,$sort_qry='',$sorder='',$order_by='',$relatedlist='',$oCv='',$relatedmodule='')
{
global $log;
$log->debug("Entering getListViewHeader(".$focus.",". $module.",".$sort_qry.",".$sorder.",".$order_by.",".$relatedlist.",".$oCv.") method ...");
@@ -174,8 +174,10 @@
$curr_symbol = $rate_symbol['symbol'];
$lbl_name .=': (in '.$curr_symbol.')';
}
-
- $name = "<a href='javascript:;' onClick='getListViewEntries_js(\"".$module."\",\"order_by=".$col."&sorder=".$temp_sorder."\");' class='listFormHeaderLinks'>".$lbl_name." ".$arrow."</a>";
+ if($relatedlist !='')
+ $name = "<a href='index.php?module=".$relatedmodule."&action=CallRelatedList&relmodule=".$module."&order_by=".$col."&record=".$relatedlist."&sorder=".$temp_sorder."' class='listFormHeaderLinks'>".$lbl_name." ".$arrow."</a>";
+ else
+ $name = "<a href='javascript:;' onClick='getListViewEntries_js(\"".$module."\",\"order_by=".$col."&sorder=".$temp_sorder."\");' class='listFormHeaderLinks'>".$lbl_name." ".$arrow."</a>";
$arrow = '';
//}
}
@@ -378,7 +380,11 @@
else {
$previous=0;
}
- if ($noofrows != $limit) {
+ if($noofrows < $limit)
+ {
+ $first = '';
+ }
+ elseif ($noofrows != $limit) {
$last = $paging;
$first = 1;
if ($paging > $limitpage_navigation) {
@@ -2502,6 +2508,9 @@
}
$output .= '</td>';
$log->debug("Exiting getTableHeaderNavigation method ...");
+ if($navigation_array['first']=='')
+ return;
+ else
return $output;
}
@@ -2615,6 +2624,9 @@
}
$output .= '</td>';
$log->debug("Exiting getTableHeaderNavigation method ...");
+ if($navigation_array['first']=='')
+ return;
+ else
return $output;
}
More information about the vtigercrm-commits
mailing list