Example #1
0
$list_result = $adb->limitQuery2($query, $limit_start_rec, $list_max_entries_per_page, $query_order_by, $sorder);
//Retreive the List View Table Header
$focus->list_mode = "search";
$focus->popup_type = $popuptype;
$url_string .= '&popuptype=' . $popuptype;
if (isset($_REQUEST['select']) && $_REQUEST['select'] == 'enable') {
    $url_string .= '&select=enable';
}
if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != '') {
    $url_string .= '&return_module=' . $_REQUEST['return_module'];
}
$smarty->assign("URLSTRING", $url_string);
if ($viewid != '') {
    $url_string .= "&viewname=" . $viewid;
}
$listview_header_search = getSearchListHeaderValues($focus, $currentModule, $url_string, $sorder, $order_by);
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$smarty->assign("ALPHABETICAL", $alphabetical);
$listview_header = getSearchListViewHeader($focus, $currentModule, $url_string, $sorder, $order_by);
$smarty->assign("LISTHEADER", $listview_header);
$listview_entries = getSearchListViewEntries($focus, $currentModule, $list_result, $navigation_array);
$smarty->assign("LISTENTITY", $listview_entries);
$navigationOutput = getTableHeaderNavigation($navigation_array, $url_string, $currentModule, "Popup", $viewid);
$smarty->assign("NAVIGATION", $navigationOutput);
$smarty->assign("RECORD_COUNTS", $record_string);
$smarty->assign("POPUPTYPE", $popuptype);
if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '') {
    $smarty->display("PopupContents.tpl");
} else {
    $smarty->display("Popup.tpl");
}
$navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
$limit_start_rec = ($start - 1) * $list_max_entries_per_page;
if ($adb->dbType == "pgsql") {
    $list_result = $adb->pquery($list_query . " OFFSET {$limit_start_rec} LIMIT {$list_max_entries_per_page}", array());
} else {
    $list_result = $adb->pquery($list_query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
}
$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec);
$smarty->assign('recordListRange', $recordListRangeMsg);
//Retreive the List View Table Header
if ($viewid != '') {
    $url_string .= "&viewname=" . $viewid;
}
$listview_header = getListViewHeader($focus, "SalesOrder", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search = getSearchListHeaderValues($focus, "SalesOrder", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$listview_entries = getListViewEntries($focus, "SalesOrder", $list_result, $navigation_array, '', '&return_module=SalesOrder&return_action=index', 'EditView', 'Delete', $oCustomView);
$smarty->assign("LISTENTITY", $listview_entries);
$smarty->assign("SELECT_SCRIPT", $view_script);
//Added to select Multiple records in multiple pages
$smarty->assign("SELECTEDIDS", vtlib_purify($_REQUEST['selobjs']));
$smarty->assign("ALLSELECTEDIDS", vtlib_purify($_REQUEST['allselobjs']));
$smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries), ";"));
$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string, "SalesOrder", 'index', $viewid);
$alphabetical = AlphabeticalSearch($currentModule, 'index', 'subject', 'true', 'basic', "", "", "", "", $viewid);
$fieldnames = getAdvSearchfields($module);
$criteria = getcriteria_options();
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("FIELDNAMES", $fieldnames);
$smarty->assign("ALPHABETICAL", $alphabetical);
}
$focus = CRMEntity::getInstance($select_module);
if (count($module_name) > 0) {
    $cur_mod_view = new CustomView($select_module);
    $viewid = $cur_mod_view->getViewId($select_module);
    $list_query = getListQuery($select_module, '');
    $list_query = $cur_mod_view->getModifiedCvListQuery($viewid, $list_query, $select_module);
    $list_query = preg_replace("/vtiger_crmentity.deleted\\s*=\\s*0/i", 'vtiger_crmentity.deleted = 1', $list_query);
    //Search criteria added to the list Query
    if (isset($where) && $where != '') {
        $list_query .= ' AND ' . $where;
    }
    $count_result = $adb->query(mkCountQuery($list_query));
    $noofrows = $adb->query_result($count_result, 0, "count");
    $rb_listview_header = getListViewHeader($focus, $select_module, '', '', '', 'global', $cur_mod_view, '', true);
    $listview_header_search = getSearchListHeaderValues($focus, $select_module, $url_string, $sorder, $order_by, "", $cur_mod_view);
    $smarty->assign("SEARCHLISTHEADER", $listview_header_search);
    if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
        $start = vtlib_purify($_REQUEST['start']);
    } else {
        $start = 1;
    }
    $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
    // Setting the record count string
    //modified by rdhital
    $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;