[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * 10 ********************************************************************************/ 11 require_once ('include/database/PearDatabase.php'); 12 require_once ('Smarty_setup.php'); 13 require_once ('modules/PriceBooks/PriceBooks.php'); 14 require_once ('include/ListView/ListView.php'); 15 require_once ('include/utils/utils.php'); 16 require_once ('modules/CustomView/CustomView.php'); 17 require_once ('include/database/Postgres8.php'); 18 require_once ('include/DatabaseUtil.php'); 19 20 global $app_strings,$mod_strings,$list_max_entries_per_page,$currentModule,$theme; 21 22 $theme_path="themes/".$theme."/"; 23 $image_path=$theme_path."images/"; 24 require_once ($theme_path.'layout_utils.php'); 25 26 $smarty = new vtigerCRM_Smarty; 27 $smarty->assign("MOD", $mod_strings); 28 $smarty->assign("APP", $app_strings); 29 $smarty->assign("IMAGE_PATH",$image_path); 30 $smarty->assign("MODULE",$currentModule); 31 $smarty->assign("SINGLE_MOD",'PriceBook'); 32 33 $category = getParentTab(); 34 $smarty->assign("CATEGORY",$category); 35 36 $focus = new PriceBooks(); 37 $other_text=Array(); 38 39 if(!$_SESSION['lvs'][$currentModule]) 40 { 41 unset($_SESSION['lvs']); 42 $modObj = new ListViewSession(); 43 $modObj->sorder = $sorder; 44 $modObj->sortby = $order_by; 45 $_SESSION['lvs'][$currentModule] = get_object_vars($modObj); 46 } 47 48 if($_REQUEST['errormsg'] != '') 49 { 50 $errormsg = $_REQUEST['errormsg']; 51 $smarty->assign("ERROR","The User does not have permission to delete ".$errormsg." ".$currentModule); 52 }else 53 { 54 $smarty->assign("ERROR",""); 55 } 56 if (!isset($where)) $where = ""; 57 58 //<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>> 59 $sorder = $focus->getSortOrder(); 60 $order_by = $focus->getOrderBy(); 61 62 $_SESSION['PRICEBOOK_ORDER_BY'] = $order_by; 63 $_SESSION['PRICEBOOK_SORT_ORDER'] = $sorder; 64 //<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>> 65 66 if(isset($_REQUEST['query']) && $_REQUEST['query'] != '' && $_REQUEST['query'] == 'true') 67 { 68 list($where, $ustring) = split("#@@#",getWhereCondition($currentModule)); 69 // we have a query 70 $url_string .="&query=true".$ustring; 71 $log->info("Here is the where clause for the list view: $where"); 72 $smarty->assign("SEARCH_URL",$url_string); 73 74 } 75 76 //<<<<cutomview>>>>>>> 77 $oCustomView = new CustomView("PriceBooks"); 78 $viewid = $oCustomView->getViewId($currentModule); 79 $customviewcombo_html = $oCustomView->getCustomViewCombo($viewid); 80 $viewnamedesc = $oCustomView->getCustomViewByCvid($viewid); 81 //<<<<<customview>>>>> 82 if(isPermitted('PriceBooks','DeletePriceBook','') == 'yes') 83 $other_text['del'] = $app_strings[LBL_MASS_DELETE]; 84 if($viewnamedesc['viewname'] == 'All') 85 { 86 $smarty->assign("ALL", 'All'); 87 } 88 89 //Retreive the list from Database 90 //<<<<<<<<<customview>>>>>>>>> 91 if($viewid != "0") 92 { 93 $listquery = getListQuery("PriceBooks"); 94 $list_query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"PriceBooks"); 95 }else 96 { 97 $list_query = getListQuery("PriceBooks"); 98 } 99 //<<<<<<<<customview>>>>>>>>> 100 101 102 if(isset($where) && $where != '') 103 { 104 $list_query .= ' and '.$where; 105 } 106 107 if(isset($order_by) && $order_by != '') 108 { 109 $tablename = getTableNameForField('PriceBooks',$order_by); 110 $tablename = (($tablename != '')?($tablename."."):''); 111 if( $adb->dbType == "pgsql") 112 $list_query .= ' GROUP BY '.$tablename.$order_by; 113 $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder; 114 } 115 116 117 //Retreiving the no of rows 118 $count_result = $adb->query( mkCountQuery( $list_query)); 119 $noofrows = $adb->query_result($count_result,0,"count"); 120 121 //Storing Listview session object 122 if($_SESSION['lvs'][$currentModule]) 123 { 124 setSessionVar($_SESSION['lvs'][$currentModule],$noofrows,$list_max_entries_per_page); 125 } 126 127 $start = $_SESSION['lvs'][$currentModule]['start']; 128 129 //Retreive the Navigation array 130 $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page); 131 //Postgres 8 fixes 132 if( $adb->dbType == "pgsql") 133 $list_query = fixPostgresQuery( $list_query, $log, 0); 134 135 136 137 // Setting the record count string 138 //modified by rdhital 139 $start_rec = $navigation_array['start']; 140 $end_rec = $navigation_array['end_val']; 141 //By Raju Ends 142 143 //limiting the query 144 if ($start_rec ==0) 145 $limit_start_rec = 0; 146 else 147 $limit_start_rec = $start_rec -1; 148 149 if( $adb->dbType == "pgsql") 150 $list_result = $adb->query($list_query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page); 151 else 152 $list_result = $adb->query($list_query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page); 153 154 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows; 155 156 //Retreive the List View Table Header 157 158 $listview_header = getListViewHeader($focus,"PriceBooks",$url_string,$sorder,$order_by,"",$oCustomView); 159 $smarty->assign("LISTHEADER", $listview_header); 160 161 $listview_header_search = getSearchListHeaderValues($focus,"PriceBooks",$url_string,$sorder,$order_by,"",$oCustomView); 162 $smarty->assign("SEARCHLISTHEADER",$listview_header_search); 163 164 $listview_entries = getListViewEntries($focus,"PriceBooks",$list_result,$navigation_array,'','&return_module=PriceBooks&return_action=index','EditView','Delete',$oCustomView); 165 $smarty->assign("LISTENTITY", $listview_entries); 166 $navigationOutput = getTableHeaderNavigation($navigation_array, $url_string,"PriceBooks","index",$viewid); 167 $alphabetical = AlphabeticalSearch($currentModule,'index','bookname','true','basic',"","","","",$viewid); 168 $fieldnames = getAdvSearchfields($module); 169 $criteria = getcriteria_options(); 170 $smarty->assign("CRITERIA", $criteria); 171 $smarty->assign("FIELDNAMES", $fieldnames); 172 $smarty->assign("ALPHABETICAL", $alphabetical); 173 $smarty->assign("NAVIGATION", $navigationOutput); 174 $smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html); 175 $smarty->assign("VIEWID", $viewid); 176 $smarty->assign("RECORD_COUNTS", $record_string); 177 $smarty->assign("SELECT_SCRIPT", $view_script); 178 $smarty->assign("BUTTONS", $other_text); 179 180 $check_button = Button_Check($module); 181 $smarty->assign("CHECK", $check_button); 182 183 if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '') 184 $smarty->display("ListViewEntries.tpl"); 185 else 186 $smarty->display("ListView.tpl"); 187 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |