if ($_REQUEST['order_by'] != '') {
    $order_by = $adb->sql_escape_string($_REQUEST['order_by']);
} elseif ($_SESSION['user_orderby'] != '') {
    $order_by = $adb->sql_escape_string($_SESSION['user_orderby']);
} else {
    $order_by = 'last_name';
}
$_SESSION['user_orderby'] = $orderby;
$list_query .= ' ORDER BY ' . $order_by . ' ' . $sorder;
$list_result = $adb->query($list_query);
//Retreive the Navigation array
$navigation_array = getNavigationValues($start, $adb->num_rows($list_result), $no_of_users['user']);
$navigationOutput = getTableHeaderNavigation($navigation_array, $url_string, "Administration", "index", '');
$smarty->assign("MOD", return_module_language($current_language, 'Settings'));
$smarty->assign("CMOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("CURRENT_USERID", $current_user->id);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("CATEGORY", $category);
$smarty->assign("LIST_HEADER", getListViewHeader($focus, "Users", $url_string, $sorder, $order_by, "", ""));
$smarty->assign("LIST_ENTRIES", getListViewEntries($focus, "Users", $list_result, $navigation_array, "", "", "EditView", "Delete", ""));
$smarty->assign("USER_COUNT", $no_of_users);
$smarty->assign("RECORD_COUNTS", $record_string);
$smarty->assign("NAVIGATION", $navigationOutput);
$smarty->assign("USER_IMAGES", getUserImageNames());
if ($_REQUEST['ajax'] != '') {
    $smarty->display("UserListViewContents.tpl");
} else {
    $smarty->display("UserListView.tpl");
}
        $smarty->assign("WORDTEMPLATEOPTIONS", "<td>" . $app_strings['LBL_SELECT_TEMPLATE_TO_MAIL_MERGE'] . "</td><td style=\"padding-left:5px;padding-right:5px\"><select class=\"small\" name=\"mergefile\">" . $optionString . "</select></td>");
        $smarty->assign("MERGEBUTTON", "<td><input title=\"{$app_strings['LBL_MERGE_BUTTON_TITLE']}\" accessKey=\"{$app_strings['LBL_MERGE_BUTTON_KEY']}\" class=\"crmbutton small create\" onclick=\"return massMerge('Contacts')\" type=\"submit\" name=\"Merge\" value=\" {$app_strings['LBL_MERGE_BUTTON_LABEL']}\"></td>");
    } else {
        global $current_user;
        require "user_privileges/user_privileges_" . $current_user->id . ".php";
        if ($is_admin == true) {
            $smarty->assign("MERGEBUTTON", "<td><a href=index.php?module=Settings&action=upload&tempModule=" . $currentModule . "&parenttab=Settings>" . $app_strings['LBL_CREATE_MERGE_TEMPLATE'] . "</td>");
        }
    }
}
//mass merge for word templates
//Retreive the List View Table Header
if (!empty($viewid)) {
    $url_string .= "&viewname=" . $viewid;
}
$listview_header = getListViewHeader($focus, "Contacts", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search = getSearchListHeaderValues($focus, "Contacts", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$listview_entries = getListViewEntries($focus, "Contacts", $list_result, $navigation_array, "", "", "EditView", "Delete", $oCustomView);
$smarty->assign("LISTENTITY", $listview_entries);
$smarty->assign("SELECT_SCRIPT", $view_script);
$smarty->assign("AVALABLE_FIELDS", getMergeFields($currentModule, "available_fields"));
$smarty->assign("FIELDS_TO_MERGE", getMergeFields($currentModule, "fileds_to_merge"));
//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, "Contacts", "index", $viewid);
$alphabetical = AlphabeticalSearch($currentModule, 'index', 'lastname', 'true', 'basic', "", "", "", "", $viewid);
$fieldnames = getAdvSearchfields($currentModule);
$queryMode = isset($_REQUEST['query']) && $_REQUEST['query'] == 'true';
$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode);
$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);
Example #4
0
$queryMode = isset($_REQUEST['query']) && $_REQUEST['query'] == 'true';
$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode);
$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);
$smarty->assign("CUSTOMVIEW_OPTION", $customview_html);
// Navigation
$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string, $currentModule, 'index', $viewid);
$smarty->assign("NAVIGATION", $navigationOutput);
$listview_header = getListViewHeader($focus, $currentModule, $url_string, $sorder, $order_by, '', $customView);
$listview_entries = getListViewEntries($focus, $currentModule, $list_result, $navigation_array, '', '', 'EditView', 'Delete', $customView);
$listview_header_search = getSearchListHeaderValues($focus, $currentModule, $url_string, $sorder, $order_by, '', $customView);
$smarty->assign('LISTHEADER', $listview_header);
$smarty->assign('LISTENTITY', $listview_entries);
$smarty->assign('SEARCHLISTHEADER', $listview_header_search);
// Module Search
$alphabetical = AlphabeticalSearch($currentModule, 'index', $focus->def_basicsearch_col, 'true', 'basic', '', '', '', '', $viewid);
$fieldnames = getAdvSearchfields($currentModule);
$criteria = getcriteria_options();
$smarty->assign("ALPHABETICAL", $alphabetical);
$smarty->assign("FIELDNAMES", $fieldnames);
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("AVALABLE_FIELDS", getMergeFields($currentModule, "available_fields"));
$smarty->assign("FIELDS_TO_MERGE", getMergeFields($currentModule, "fileds_to_merge"));
$_SESSION[$currentModule . '_listquery'] = $list_query;
} else {
    $noofrows = null;
}
$queryMode = isset($_REQUEST['query']) && $_REQUEST['query'] == 'true';
$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode);
$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
$listview_header = getListViewHeader($focus, "PriceBooks", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search = getSearchListHeaderValues($focus, "PriceBooks", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$listview_entries = getListViewEntries($focus, "PriceBooks", $list_result, $navigation_array, '', '&return_module=PriceBooks&return_action=index', 'EditView', 'Delete', $oCustomView);
$smarty->assign("LISTENTITY", $listview_entries);
//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, "PriceBooks", "index", $viewid);
$alphabetical = AlphabeticalSearch($currentModule, 'index', 'bookname', 'true', 'basic', "", "", "", "", $viewid);
$fieldnames = getAdvSearchfields($module);
$criteria = getcriteria_options();
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("FIELDNAMES", $fieldnames);
Example #6
0
/** Function to get related list entries in detailed array format
 * @param $module -- modulename:: Type string
 * @param $relatedmodule -- relatedmodule:: Type string
 * @param $focus -- focus:: Type object
 * @param $query -- query:: Type string
 * @param $button -- buttons:: Type string
 * @param $returnset -- returnset:: Type string
 * @param $id -- id:: Type string
 * @param $edit_val -- edit value:: Type string
 * @param $del_val -- delete value:: Type string
 * @returns $related_entries -- related entires:: Type string array
 */
function GetRelatedListBase($module, $relatedmodule, $focus, $query, $button, $returnset, $id = '', $edit_val = '', $del_val = '', $skipActions = false)
{
    $log = LoggerManager::getLogger('account_list');
    $log->debug("Entering GetRelatedList(" . $module . "," . $relatedmodule . "," . get_class($focus) . "," . $query . "," . $button . "," . $returnset . "," . $edit_val . "," . $del_val . ") method ...");
    require_once 'Smarty_setup.php';
    require_once "data/Tracker.php";
    require_once 'include/database/PearDatabase.php';
    global $adb, $app_strings, $current_language;
    $current_module_strings = return_module_language($current_language, $module);
    global $list_max_entries_per_page, $urlPrefix, $currentModule, $theme, $theme_path, $theme_path, $mod_strings;
    $smarty = new vtigerCRM_Smarty();
    if (!isset($where)) {
        $where = "";
    }
    $button = '<table cellspacing=0 cellpadding=2><tr><td>' . $button . '</td></tr></table>';
    // Added to have Purchase Order as form Title
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $smarty->assign("MOD", $mod_strings);
    $smarty->assign("APP", $app_strings);
    $smarty->assign("THEME", $theme);
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("MODULE", $relatedmodule);
    // We do not have RelatedListView in Detail View mode of Calendar module. So need to skip it.
    if ($module != 'Calendar') {
        $focus->initSortByField($relatedmodule);
    }
    //Retreive the list from Database
    //Appending the security parameter Security fix by Don
    if ($relatedmodule != 'Faq' && $relatedmodule != 'PriceBook' && $relatedmodule != 'Vendors' && $relatedmodule != 'Users') {
        global $current_user;
        $secQuery = getNonAdminAccessControlQuery($relatedmodule, $current_user);
        if (strlen($secQuery) > 1) {
            $query = appendFromClauseToQuery($query, $secQuery);
        }
    }
    if ($relatedmodule == 'Leads') {
        $query .= " AND vtiger_leaddetails.converted = 0";
    }
    if (isset($where) && $where != '') {
        $query .= ' and ' . $where;
    }
    if (!$_SESSION['rlvs'][$module][$relatedmodule]) {
        $modObj = new ListViewSession();
        $modObj->sortby = $focus->default_order_by;
        $modObj->sorder = $focus->default_sort_order;
        $_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
    }
    if (!empty($_REQUEST['order_by'])) {
        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;
    }
    //Added by Don for AssignedTo ordering issue in Related Lists
    $query_order_by = $order_by;
    if ($order_by == 'smownerid') {
        $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
        $query_order_by = "case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end ";
    } elseif ($order_by != 'crmid' && !empty($order_by)) {
        $tabname = getTableNameForField($relatedmodule, $order_by);
        if ($tabname !== '' and $tabname != NULL) {
            $query_order_by = $tabname . "." . $query_order_by;
        }
    }
    if (!empty($query_order_by)) {
        $query .= ' ORDER BY ' . $query_order_by . ' ' . $sorder;
    }
    if ($relatedmodule == 'Calendar') {
        $mod_listquery = "activity_listquery";
    } else {
        $mod_listquery = strtolower($relatedmodule) . "_listquery";
    }
    $_SESSION[$mod_listquery] = $query;
    $url_qry = "&order_by=" . $order_by . "&sorder=" . $sorder;
    $computeCount = isset($_REQUEST['withCount']) ? $_REQUEST['withCount'] : '';
    if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
        //Retreiving the no of rows
        if ($relatedmodule == "Calendar") {
            //for calendar related list, count will increase when we have multiple contacts
            //relationship for single activity
            $count_query = mkCountQuery($query);
            $count_result = $adb->query($count_query);
            $noofrows = $adb->query_result($count_result, 0, "count");
        } else {
            $count_query = mkCountQuery($query);
            $count_result = $adb->query($count_query);
            if ($adb->num_rows($count_result) > 0) {
                $noofrows = $adb->query_result($count_result, 0, "count");
            } else {
                $noofrows = $adb->num_rows($count_result);
            }
        }
    } else {
        $noofrows = null;
    }
    //Setting Listview session object while sorting/pagination
    if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
        $relmodule = vtlib_purify($_REQUEST['relmodule']);
        if ($_SESSION['rlvs'][$module][$relmodule]) {
            setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
        }
    }
    global $relationId;
    $start = RelatedListViewSession::getRequestCurrentPage($relationId, $query);
    $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
    $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
    $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
    /* Save the related list in session for when we click in a register
     * from this list we will can navigate with the arrows left and right, to move only in this related list
     */
    $relcv = new CustomView();
    $relviewId = $relcv->getViewId($relatedmodule);
    ListViewSession::setSessionQuery($relatedmodule, $query, $relviewId);
    $_SESSION['lvs'][$relatedmodule][$relviewId]['start'] = $start;
    //Retreive the List View Table Header
    $id = vtlib_purify($_REQUEST['record']);
    $listview_header = getListViewHeader($focus, $relatedmodule, '', $sorder, $order_by, $id, '', $module, $skipActions);
    //"Accounts");
    if ($noofrows > 15) {
        $smarty->assign('SCROLLSTART', '<div style="overflow:auto;height:315px;width:100%;">');
        $smarty->assign('SCROLLSTOP', '</div>');
    }
    $smarty->assign("LISTHEADER", $listview_header);
    if ($module == 'PriceBook' && $relatedmodule == 'Products') {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
    }
    if ($module == 'Products' && $relatedmodule == 'PriceBooks') {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'EditListPrice', 'DeletePriceBookProductRel', '', '', '', '', $skipActions);
    } elseif ($relatedmodule == 'SalesOrder') {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'SalesOrderEditView', 'DeleteSalesOrder', '', '', '', '', $skipActions);
    } else {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
    }
    $navigationOutput = array();
    $navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
    if (empty($id) && !empty($_REQUEST['record'])) {
        $id = vtlib_purify($_REQUEST['record']);
    }
    $navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry, $module, $relatedmodule, $id);
    $related_entries = array('header' => $listview_header, 'entries' => $listview_entries, 'navigation' => $navigationOutput);
    $log->debug("Exiting GetRelatedList method ...");
    return $related_entries;
}
function getTopInvoice($maxval, $calCnt)
{
    require_once "data/Tracker.php";
    require_once 'modules/Invoice/Invoice.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    require_once 'include/utils/utils.php';
    require_once 'modules/CustomView/CustomView.php';
    global $app_strings, $current_language, $current_user, $adb, $list_max_entries_per_page, $theme;
    $current_module_strings = return_module_language($current_language, 'Invoice');
    $log = LoggerManager::getLogger('invoice_list');
    $url_string = '';
    $sorder = '';
    $oCustomView = new CustomView("Invoice");
    $customviewcombo_html = $oCustomView->getCustomViewCombo();
    if (isset($_REQUEST['viewname']) == false || $_REQUEST['viewname'] == '') {
        if ($oCustomView->setdefaultviewid != "") {
            $viewid = $oCustomView->setdefaultviewid;
        } else {
            $viewid = "0";
        }
    }
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    //Retreive the list from Database
    //<<<<<<<<<customview>>>>>>>>>
    $date_var = date('Y-m-d');
    //Changed for Patch 2 by Don
    $where = ' and vtiger_crmentity.smownerid=' . $current_user->id . ' and  vtiger_invoice.invoicestatus != \'Paid\'';
    $query = getListQuery("Invoice", $where);
    $query .= " ORDER BY total DESC";
    //<<<<<<<<customview>>>>>>>>>
    $query .= " LIMIT " . $adb->sql_escape_string($maxval);
    if ($calCnt == 'calculateCnt') {
        $list_result_rows = $adb->query(mkCountQuery($query));
        return $adb->query_result($list_result_rows, 0, 'count');
    }
    $list_result = $adb->query($query);
    //Retreiving the no of rows
    $noofrows = $adb->num_rows($list_result);
    //Retreiving the start value from request
    if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
        $start = vtlib_purify($_REQUEST['start']);
    } else {
        $start = 1;
    }
    //Retreive the Navigation array
    $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
    if ($navigation_array['start'] == 1) {
        if ($noofrows != 0) {
            $start_rec = $navigation_array['start'];
        } else {
            $start_rec = 0;
        }
        if ($noofrows > $list_max_entries_per_page) {
            $end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
        } else {
            $end_rec = $noofrows;
        }
    } else {
        if ($navigation_array['next'] > $list_max_entries_per_page) {
            $start_rec = $navigation_array['next'] - $list_max_entries_per_page;
            $end_rec = $navigation_array['next'] - 1;
        } else {
            $start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
            $end_rec = $noofrows;
        }
    }
    $focus = new Invoice();
    $title = array('myTopInvoices.gif', $current_module_strings['LBL_MY_TOP_INVOICE'], 'home_mytopinv');
    //Retreive the List View Table Header
    $listview_header = getListViewHeader($focus, "Invoice", $url_string, $sorder, $order_by, "HomePage", $oCustomView);
    $header = array($listview_header[1], $listview_header[2]);
    $listview_entries = getListViewEntries($focus, "Invoice", $list_result, $navigation_array, "HomePage", "", "EditView", "Delete", $oCustomView);
    foreach ($listview_entries as $crmid => $valuearray) {
        $entries[$crmid] = array($valuearray[1], $valuearray[2]);
    }
    $search_qry = "&query=true&Fields0=vtiger_invoice.invoicestatus&Condition0=isn&Srch_value0=Paid&Fields1=vtiger_crmentity.smownerid&Condition1=is&Srch_value1=" . $current_user->column_fields['user_name'] . "&searchtype=advance&search_cnt=2&matchtype=all";
    $values = array('ModuleName' => 'Invoice', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
    if ($display_empty_home_blocks && $noofrows == 0 || $noofrows > 0) {
        return $values;
    }
}
Example #8
0
            $smarty->assign("SINGLE_MOD", $module_name);
            $smarty->assign("SHOW_MASS_SELECT", 'false');
            //Retreiving the start value from request
            if ($module_name == $_REQUEST['nav_module'] && isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
                $start = vtlib_purify($_REQUEST['start']);
            } else {
                $start = 1;
            }
            $info_message = '&recordcount=' . vtlib_purify($_REQUEST['recordcount']) . '&noofrows=' . vtlib_purify($_REQUEST['noofrows']) . '&message=' . vtlib_purify($_REQUEST['message']) . '&skipped_record_count=' . vtlib_purify($_REQUEST['skipped_record_count']);
            $url_string = '&modulename=' . vtlib_purify($_REQUEST['modulename']) . '&nav_module=' . $module_name . $info_message;
            $viewid = '';
            //Retreive the Navigation array
            $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
            $navigationOutput = getTableHeaderNavigation($navigation_array, $url_string, "Import", "ImportSteplast", $viewid);
            //Retreive the List View Header and Entries
            $listview_header = getListViewHeader($object, $module_name);
            $listview_entries = getListViewEntries($object, $module_name, $list_result, $navigation_array, "", "", "EditView", "Delete", "");
            //commented to remove navigation buttons from import list view
            //$smarty->assign("NAVIGATION", $navigationOutput);
            $smarty->assign("HIDE_CUSTOM_LINKS", 1);
            //Added to hide the CustomView links in imported records ListView
            // Remove all the links for the list view header as they do not work in this page.
            for ($i = 0; $i < count($listview_header); $i++) {
                $listview_header[$i] = strip_tags($listview_header[$i]);
            }
            $smarty->assign("LISTHEADER", $listview_header);
            $smarty->assign("LISTENTITY", $listview_entries);
            $smarty->display("ListViewEntries.tpl");
        }
    }
}
Example #9
0
/**	function used to get the top 5 notes from the ListView query
 *	@return array $values - array with the title, header and entries like  Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
 */
function getMyNotes()
{
    require_once "data/Tracker.php";
    require_once 'modules/Notes/Notes.php';
    require_once 'include/logging.php';
    require_once 'include/ListView/ListView.php';
    require_once 'include/database/PearDatabase.php';
    require_once 'include/ComboUtil.php';
    require_once 'include/utils/utils.php';
    require_once 'modules/CustomView/CustomView.php';
    global $app_strings, $current_language, $current_user;
    $current_module_strings = return_module_language($current_language, 'Notes');
    global $list_max_entries_per_page, $adb, $theme, $mod_strings;
    $log = LoggerManager::getLogger('note_list');
    $url_string = '';
    $sorder = '';
    $oCustomView = "";
    $focus = new Notes();
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    //Retreive the list from Database
    //<<<<<<<<<customview>>>>>>>>>
    $date_var = date('Y-m-d');
    $where = ' and smownerid=' . $current_user->id;
    $query = getListQuery("Notes", $where);
    $query .= " ORDER BY modifiedtime DESC";
    //<<<<<<<<customview>>>>>>>>>
    $list_result = $adb->limitQuery($query, 0, 5);
    //Retreiving the no of rows
    $noofrows = $adb->num_rows($list_result);
    //Retreiving the start value from request
    if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
        $start = $_REQUEST['start'];
    } else {
        $start = 1;
    }
    //Retreive the Navigation array
    $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
    if ($navigation_array['start'] == 1) {
        if ($noofrows != 0) {
            $start_rec = $navigation_array['start'];
        } else {
            $start_rec = 0;
        }
        if ($noofrows > $list_max_entries_per_page) {
            $end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
        } else {
            $end_rec = $noofrows;
        }
    } else {
        if ($navigation_array['next'] > $list_max_entries_per_page) {
            $start_rec = $navigation_array['next'] - $list_max_entries_per_page;
            $end_rec = $navigation_array['next'] - 1;
        } else {
            $start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
            $end_rec = $noofrows;
        }
    }
    $title = array('TopOpenNotes.gif', $current_module_strings['LBL_MY_TOP_NOTE'], 'home_mytopnote');
    //Retreive the List View Table Header
    $listview_header = getListViewHeader($focus, "Notes", $url_string, $sorder, $order_by, "HomePage", $oCustomView);
    $listview_entries = getListViewEntries($focus, "Notes", $list_result, $navigation_array, "HomePage", "", "EditView", "Delete", $oCustomView);
    $values = array('Title' => $title, 'Header' => $listview_header, 'Entries' => $listview_entries);
    //if ( ($display_empty_home_blocks && $noofrows == 0 ) || ($noofrows>0) )
    return $values;
}
Example #10
0
/** Function to get related list entries in detailed array format
 * @param $module -- modulename:: Type string
 * @param $relatedmodule -- relatedmodule:: Type string
 * @param $focus -- focus:: Type object
 * @param $query -- query:: Type string
 * @param $button -- buttons:: Type string
 * @param $returnset -- returnset:: Type string
 * @param $id -- id:: Type string
 * @param $edit_val -- edit value:: Type string
 * @param $del_val -- delete value:: Type string
 * @returns $related_entries -- related entires:: Type string array
 *
 */
function GetRelatedList($module, $relatedmodule, $focus, $query, $button, $returnset, $id = '', $edit_val = '', $del_val = '')
{
    global $log;
    //changed by dingjianting on 2007-11-05 for php5.2.x
    $log->debug("Entering GetRelatedList() method ...");
    require_once 'include/CRMSmarty.php';
    require_once 'include/DatabaseUtil.php';
    global $adb;
    global $app_strings;
    global $current_language;
    $current_module_strings = return_module_language($current_language, $module);
    global $list_max_entries_per_page;
    global $urlPrefix;
    global $currentModule;
    global $theme;
    global $theme_path;
    global $mod_strings;
    $list_max_entries_per_page = 10000;
    // focus_list is the means of passing data to a ListView.
    global $focus_list;
    $smarty = new CRMSmarty();
    if (!isset($where)) {
        $where = "";
    }
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $smarty->assign("MOD", $mod_strings);
    $smarty->assign("APP", $app_strings);
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("MODULE", $relatedmodule);
    if (isset($where) && $where != '') {
        $query .= ' and ' . $where;
    }
    /*
    if(!isset($_SESSION['rlvs'][$module][$relatedmodule]) || !$_SESSION['rlvs'][$module][$relatedmodule])
    {
    	$modObj = new ListViewSession();
    	$modObj->sortby = $focus->default_order_by;
    	$modObj->sorder = $focus->default_sort_order;
    	$_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
    }
    */
    if (empty($order_by)) {
        $order_by = $focus->entity_table . "." . $focus->default_order_by;
    }
    if (empty($sorder)) {
        $sorder = $focus->default_sort_order;
    }
    $url_qry = "&order_by=" . $order_by;
    $count_query = mkCountQuery($query);
    $count_result = $adb->query($count_query);
    $noofrows = $adb->query_result($count_result, 0, "count");
    //Setting Listview session object while sorting/pagination
    if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
        if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
            $start = $_REQUEST['start'];
        } else {
            $start = 1;
        }
    } else {
        $start = 1;
    }
    $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
    $start_rec = $navigation_array['start'];
    $end_rec = $navigation_array['end_val'];
    //limiting the query
    if ($start_rec <= 0) {
        $limit_start_rec = 0;
    } else {
        $limit_start_rec = $start_rec - 1;
    }
    //$list_result = $adb->limitQuery2($query,$limit_start_rec,$list_max_entries_per_page,$order_by,$sorder);
    $list_result = $adb->limitQuery($query, $limit_start_rec, $list_max_entries_per_page, $order_by, $sorder);
    //Retreive the List View Table Header
    if ($noofrows == 0) {
        $smarty->assign('NOENTRIES', $app_strings['LBL_NONE_SCHEDULED']);
    } else {
        setRelmodFieldList($relatedmodule, $focus);
        //set more module field
        $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%;">');
            $smarty->assign('SCROLLSTOP', '</div>');
        }
        $smarty->assign("LISTHEADER", $listview_header);
        if ($relatedmodule != 'SalesOrder') {
            $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset);
        } else {
            $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'SalesOrderEditView', 'DeleteSalesOrder');
        }
        $navigationOutput = array();
        //$navigationOutput[] = $app_strings['LBL_SHOWING']." " .$start_rec." - ".$end_rec." " .$app_strings['LBL_LIST_OF'] ." ".$noofrows;
        $navigationOutput[] = $app_strings['LBL_SHOWING'] . " " . $start_rec . " - " . $noofrows;
        $module_rel = $module . '&relmodule=' . $relatedmodule . '&record=' . $id;
        //$navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry,$module_rel);
        //changed by dfar2008 on 2012-04-15 for relatedlist
        $related_entries = array('header' => $listview_header, 'entries' => $listview_entries, 'navigation' => $navigationOutput);
        $log->debug("Exiting GetRelatedList method ...");
        return $related_entries;
    }
}
Example #11
0
     $start = 1;
 }
 $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
 $limitStartRecord = ($navigation_array['start'] - 1) * $list_max_entries_per_page;
 if ($adb->dbType == "pgsql") {
     $listquery = $listquery . " OFFSET {$limitStartRecord} LIMIT {$list_max_entries_per_page}";
 } else {
     $listquery = $listquery . " LIMIT {$limitStartRecord}, {$list_max_entries_per_page}";
 }
 $list_result = $adb->query($listquery);
 $moduleRecordCount[$module]['recordListRangeMessage'] = getRecordRangeMessage($list_result, $limitStartRecord, $noofrows);
 $info_message = '&recordcount=' . $_REQUEST['recordcount'] . '&noofrows=' . $_REQUEST['noofrows'] . '&message=' . $_REQUEST['message'] . '&skipped_record_count=' . $_REQUEST['skipped_record_count'];
 $url_string = '&modulename=' . $_REQUEST['modulename'] . '&nav_module=' . $module_name . $info_message;
 $viewid = '';
 $navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string, $module, "UnifiedSearch", $viewid);
 $listview_header = getListViewHeader($focus, $module, "", "", "", "global", $oCustomView);
 $listview_entries = getListViewEntries($focus, $module, $list_result, $navigation_array, "", "", "", "", $oCustomView);
 //Do not display the Header if there are no entires in listview_entries
 if (count($listview_entries) > 0) {
     $display_header = 1;
     if (vtlib_isModuleActive('ListViewColors') && count($listview_entries) == 2) {
         $listview_entries_for1 = $listview_entries;
     } elseif (!vtlib_isModuleActive('ListViewColors') && count($listview_entries) == 1) {
         $listview_entries_for1 = $listview_entries;
     }
 } else {
     $display_header = 0;
 }
 $smarty->assign("NAVIGATION", $navigationOutput);
 $smarty->assign("LISTHEADER", $listview_header);
 $smarty->assign("LISTENTITY", $listview_entries);
Example #12
0
$queryMode = isset($_REQUEST['query']) && $_REQUEST['query'] == 'true';
$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode);
$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, "Potentials", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search = getSearchListHeaderValues($focus, "Potentials", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$listview_entries = getListViewEntries($focus, "Potentials", $list_result, $navigation_array, "", "", "EditView", "Delete", $oCustomView);
$smarty->assign("LISTHEADER", $listview_header);
$smarty->assign("LISTENTITY", $listview_entries);
$smarty->assign("AVALABLE_FIELDS", getMergeFields($currentModule, "available_fields"));
$smarty->assign("FIELDS_TO_MERGE", getMergeFields($currentModule, "fileds_to_merge"));
//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, "Potentials", "index", $viewid);
$alphabetical = AlphabeticalSearch($currentModule, 'index', 'potentialname', 'true', 'basic', "", "", "", "", $viewid);
$fieldnames = getAdvSearchfields($currentModule);
Example #13
0
    } else {
        $query_order_by = $focus->entity_table . "." . $order_by;
    }
}
if ($start_rec == 0) {
    $limit_start_rec = 0;
} else {
    $limit_start_rec = $start_rec - 1;
}
$list_result = $adb->limitQuery2($query, $limit_start_rec, $list_max_entries_per_page, $query_order_by, $sorder);
$record_string = $app_strings["LBL_SHOWING"] . " " . $start_rec . " - " . $end_rec . " " . $app_strings["LBL_LIST_OF"] . " " . $noofrows;
//Retreive the List View Table Header
if ($viewid != '') {
    $url_string .= "&viewname=" . $viewid;
}
$listview_header = getListViewHeader($focus, "Maillisttmps", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search = getSearchListHeaderValues($focus, "Maillisttmps", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$listview_entries = getListViewEntries($focus, "Maillisttmps", $list_result, $navigation_array, "", "", "EditView", "Delete", $oCustomView);
$smarty->assign("LISTENTITY", $listview_entries);
$navigationOutput = getTableHeaderNavigation($navigation_array, $url_string, "Maillisttmps", "index", $viewid);
$fieldnames = getAdvSearchfields($module);
$criteria = getcriteria_options();
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("FIELDNAMES", $fieldnames);
$smarty->assign("NAVIGATION", $navigationOutput);
$smarty->assign("RECORD_COUNTS", $record_string);
if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '') {
    $smarty->display("Maillisttmps/ListViewEntries.tpl");
} else {
Example #14
0
    $smarty->assign("SEARCH_URL", $url_string);
}
$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) {
/** Function to get related list entries in detailed array format
 * @param $module -- modulename:: Type string
 * @param $relatedmodule -- relatedmodule:: Type string
 * @param $focus -- focus:: Type object
 * @param $query -- query:: Type string
 * @param $button -- buttons:: Type string
 * @param $returnset -- returnset:: Type string
 * @param $id -- id:: Type string
 * @param $edit_val -- edit value:: Type string
 * @param $del_val -- delete value:: Type string
 * @returns $related_entries -- related entires:: Type string array
 *
 */
function GetRelatedList($module, $relatedmodule, $focus, $query, $button, $returnset, $id = '', $edit_val = '', $del_val = '')
{
    $log = LoggerManager::getLogger('account_list');
    $log->debug("Entering GetRelatedList(" . $module . "," . $relatedmodule . "," . get_class($focus) . "," . $query . "," . $button . "," . $returnset . "," . $edit_val . "," . $del_val . ") method ...");
    require_once 'Smarty_setup.php';
    require_once "data/Tracker.php";
    require_once 'include/database/PearDatabase.php';
    global $adb;
    global $app_strings;
    global $current_language;
    $current_module_strings = return_module_language($current_language, $module);
    global $list_max_entries_per_page;
    global $urlPrefix;
    global $currentModule;
    global $theme;
    global $theme_path;
    global $theme_path;
    global $mod_strings;
    // focus_list is the means of passing data to a ListView.
    global $focus_list;
    $smarty = new vtigerCRM_Smarty();
    if (!isset($where)) {
        $where = "";
    }
    $button = '<table cellspacing=0 cellpadding=2><tr><td>' . $button . '</td></tr></table>';
    // Added to have Purchase Order as form Title
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $smarty->assign("MOD", $mod_strings);
    $smarty->assign("APP", $app_strings);
    $smarty->assign("THEME", $theme);
    $smarty->assign("IMAGE_PATH", $image_path);
    $smarty->assign("MODULE", $relatedmodule);
    // We do not have RelatedListView in Detail View mode of Calendar module. So need to skip it.
    if ($module != 'Calendar') {
        $focus->initSortByField($relatedmodule);
    }
    //Retreive the list from Database
    //Appending the security parameter
    if ($relatedmodule != 'Products' && $relatedmodule != 'Faq' && $relatedmodule != 'PriceBook' && $relatedmodule != 'Vendors') {
        global $current_user;
        require 'user_privileges/user_privileges_' . $current_user->id . '.php';
        require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
        $tab_id = getTabid($relatedmodule);
        if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3) {
            $sec_parameter = getListViewSecurityParameter($relatedmodule);
            $query .= ' ' . $sec_parameter;
        }
    }
    if ($relatedmodule == 'Leads') {
        $query .= " AND vtiger_leaddetails.converted = 0";
    }
    if (isset($where) && $where != '') {
        $query .= ' and ' . $where;
    }
    if (!$_SESSION['rlvs'][$module][$relatedmodule]) {
        $modObj = new ListViewSession();
        $modObj->sortby = $focus->default_order_by;
        $modObj->sorder = $focus->default_sort_order;
        $_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
    }
    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;
    }
    //Added by Don for AssignedTo ordering issue in Related Lists
    $query_order_by = $order_by;
    if ($order_by == 'smownerid') {
        $query_order_by = "case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end ";
    } elseif ($order_by != 'crmid' && !empty($order_by)) {
        $tabname = getTableNameForField($relatedmodule, $order_by);
        if ($tabname !== '' and $tabname != NULL) {
            $query_order_by = $tabname . "." . $query_order_by;
        }
    }
    if (!empty($query_order_by)) {
        $query .= ' ORDER BY ' . $query_order_by . ' ' . $sorder;
    }
    if ($relatedmodule == 'Calendar') {
        $mod_listquery = "activity_listquery";
    } else {
        $mod_listquery = strtolower($relatedmodule) . "_listquery";
    }
    $_SESSION[$mod_listquery] = $query;
    $url_qry .= "&order_by=" . $order_by . "&sorder=" . $sorder;
    //Retreiving the no of rows
    if ($relatedmodule == "Calendar") {
        //$count_query = "select count(*) as count, vtiger_activity.activitytype ".substr($query, stripos($query,'from'),strlen($query));
        $count_query = mkCountQuery($query);
        $count_result = $adb->query($count_query);
        $noofrows = $adb->query_result($count_result, 0, "count");
    } else {
        $count_query = mkCountQuery($query);
        $count_result = $adb->query($count_query);
        if ($adb->num_rows($count_result) > 0) {
            $noofrows = $adb->query_result($count_result, 0, "count");
        } else {
            $noofrows = $adb->num_rows($count_result);
        }
    }
    //Setting Listview session object while sorting/pagination
    if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
        $relmodule = vtlib_purify($_REQUEST['relmodule']);
        if ($_SESSION['rlvs'][$module][$relmodule]) {
            setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
        }
    }
    $start = $_SESSION['rlvs'][$module][$relatedmodule]['start'];
    $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
    $start_rec = $navigation_array['start'];
    $end_rec = $navigation_array['end_val'];
    //limiting the query
    if ($start_rec == 0) {
        $limit_start_rec = 0;
    } else {
        $limit_start_rec = $start_rec - 1;
    }
    if ($adb->dbType == "pgsql") {
        $list_result = $adb->pquery($query . " OFFSET {$limit_start_rec} LIMIT {$list_max_entries_per_page}", array());
    } else {
        $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
    }
    //Retreive the List View Table Header
    if ($noofrows == 0) {
        $smarty->assign('NOENTRIES', $app_strings['LBL_NONE_SCHEDULED']);
    } else {
        $id = vtlib_purify($_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%;">');
            $smarty->assign('SCROLLSTOP', '</div>');
        }
        $smarty->assign("LISTHEADER", $listview_header);
        if ($module == 'PriceBook' && $relatedmodule == 'Products') {
            $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val);
        }
        if ($module == 'Products' && $relatedmodule == 'PriceBook') {
            $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'EditListPrice', 'DeletePriceBookProductRel');
        } elseif ($relatedmodule == 'SalesOrder') {
            $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'SalesOrderEditView', 'DeleteSalesOrder');
        } else {
            $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset);
        }
        $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[] = 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;
    }
}
Example #16
0
        $smarty->assign("WORDTEMPLATEOPTIONS", "<td>" . $app_strings['LBL_SELECT_TEMPLATE_TO_MAIL_MERGE'] . "</td><td style=\"padding-left:5px;padding-right:5px\"><select class=\"small\" name=\"mergefile\">" . $optionString . "</select></td>");
        $smarty->assign("MERGEBUTTON", "<td><input title=\"{$app_strings['LBL_MERGE_BUTTON_TITLE']}\" accessKey=\"{$app_strings['LBL_MERGE_BUTTON_KEY']}\" class=\"crmbutton small create\" onclick=\"return massMerge('HelpDesk')\" type=\"submit\" name=\"Merge\" value=\" {$app_strings['LBL_MERGE_BUTTON_LABEL']}\"></td>");
    } else {
        global $current_user;
        require "user_privileges/user_privileges_" . $current_user->id . ".php";
        if ($is_admin == true) {
            $smarty->assign("MERGEBUTTON", '<td><a href=index.php?module=Settings&action=upload&tempModule=' . $currentModule . '&parenttab=Settings>' . $app_strings["LBL_CREATE_MERGE_TEMPLATE"] . '</td>');
        }
    }
}
//mass merge for word templates
//Retreive the List View Table Header
if ($viewid != '') {
    $url_string .= "&viewname=" . $viewid;
}
$listview_header = getListViewHeader($focus, "HelpDesk", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search = getSearchListHeaderValues($focus, "HelpDesk", $url_string, $sorder, $order_by, "", $oCustomView);
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$listview_entries = getListViewEntries($focus, "HelpDesk", $list_result, $navigation_array, "", "", "EditView", "Delete", $oCustomView);
$smarty->assign("LISTENTITY", $listview_entries);
$smarty->assign("SELECT_SCRIPT", $view_script);
$smarty->assign("AVALABLE_FIELDS", getMergeFields($currentModule, "available_fields"));
$smarty->assign("FIELDS_TO_MERGE", getMergeFields($currentModule, "fileds_to_merge"));
//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, "HelpDesk", "index", $viewid);
$alphabetical = AlphabeticalSearch($currentModule, 'index', 'ticket_title', 'true', 'basic', "", "", "", "", $viewid);
$fieldnames = getAdvSearchfields($currentModule);