[ 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 ("modules/Dashboard/Entity_charts.php"); 12 global $tmp_dir; 13 global $mod_strings,$app_strings; 14 global $current_user; 15 16 $period=($_REQUEST['period'])?$_REQUEST['period']:"tmon"; // Period >> lmon- Last Month, tmon- This Month, lweek-LastWeek, tweek-ThisWeek; lday- Last Day 17 $type=($_REQUEST['type'])?$_REQUEST['type']:"leadsource"; 18 $dates_values=start_end_dates($period); //To get the stating and End dates for a given period 19 $date_start=$dates_values[0]; //Starting date 20 $end_date=$dates_values[1]; // Ending Date 21 $period_type=$dates_values[2]; //Period type as MONTH,WEEK,LDAY 22 $width=$dates_values[3]; 23 $height=$dates_values[4]; 24 25 //It gives all the dates in between the starting and ending dates and also gives the number of days,declared in utils.php 26 $no_days_dates=get_days_n_dates($date_start,$end_date); 27 $days=$no_days_dates[0]; 28 $date_array=$no_days_dates[1]; //Array containig all the dates 29 $user_id=$current_user->id; 30 31 // Query for Leads 32 $leads_query="select vtiger_crmentity.crmid,vtiger_crmentity.createdtime, vtiger_leaddetails.*, vtiger_crmentity.smownerid, vtiger_leadscf.* from vtiger_leaddetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_leaddetails.leadid inner join vtiger_leadsubdetails on vtiger_leadsubdetails.leadsubscriptionid=vtiger_leaddetails.leadid inner join vtiger_leadaddress on vtiger_leadaddress.leadaddressid=vtiger_leadsubdetails.leadsubscriptionid inner join vtiger_leadscf on vtiger_leaddetails.leadid = vtiger_leadscf.leadid left join vtiger_leadgrouprelation on vtiger_leadscf.leadid=vtiger_leadgrouprelation.leadid left join vtiger_groups on vtiger_groups.groupname=vtiger_leadgrouprelation.groupname where vtiger_crmentity.deleted=0 and vtiger_leaddetails.converted=0 "; 33 34 35 //Query for Accounts 36 $account_query="select vtiger_crmentity.*, vtiger_account.*, vtiger_accountscf.* from vtiger_account inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_account.accountid inner join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid inner join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid inner join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid left join vtiger_accountgrouprelation on vtiger_accountscf.accountid=vtiger_accountgrouprelation.accountid left join vtiger_groups on vtiger_groups.groupname=vtiger_accountgrouprelation.groupname left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid where vtiger_crmentity.deleted=0 "; 37 38 39 //Query For Products qty in stock 40 $products_query="select distinct(vtiger_crmentity.crmid),vtiger_crmentity.createdtime,vtiger_products.* from vtiger_products inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_products.productid left join vtiger_inventoryproductrel on vtiger_products.productid = vtiger_inventoryproductrel.id where vtiger_crmentity.deleted=0 "; 41 42 //Query for Potential 43 $potential_query= "select vtiger_crmentity.*,vtiger_account.accountname, vtiger_potential.*, vtiger_potentialscf.*, vtiger_potentialgrouprelation.groupname from vtiger_potential inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_potential.potentialid inner join vtiger_account on vtiger_potential.accountid = vtiger_account.accountid inner join vtiger_potentialscf on vtiger_potentialscf.potentialid = vtiger_potential.potentialid left join vtiger_potentialgrouprelation on vtiger_potential.potentialid=vtiger_potentialgrouprelation.potentialid left join vtiger_groups on vtiger_groups.groupname=vtiger_potentialgrouprelation.groupname left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid where vtiger_crmentity.deleted=0 "; 44 45 //Query for Sales Order 46 $so_query="select vtiger_crmentity.*,vtiger_salesorder.*,vtiger_account.accountid,vtiger_quotes.quoteid from vtiger_salesorder inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_salesorder.salesorderid inner join vtiger_sobillads on vtiger_salesorder.salesorderid=vtiger_sobillads.sobilladdressid inner join vtiger_soshipads on vtiger_salesorder.salesorderid=vtiger_soshipads.soshipaddressid left join vtiger_salesordercf on vtiger_salesordercf.salesorderid = vtiger_salesorder.salesorderid left outer join vtiger_quotes on vtiger_quotes.quoteid=vtiger_salesorder.quoteid left outer join vtiger_account on vtiger_account.accountid=vtiger_salesorder.accountid left join vtiger_sogrouprelation on vtiger_salesorder.salesorderid=vtiger_sogrouprelation.salesorderid left join vtiger_groups on vtiger_groups.groupname=vtiger_sogrouprelation.groupname left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid where vtiger_crmentity.deleted=0 "; 47 48 49 //Query for Purchase Order 50 51 $po_query="select vtiger_crmentity.*,vtiger_purchaseorder.* from vtiger_purchaseorder inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_purchaseorder.purchaseorderid left outer join vtiger_vendor on vtiger_purchaseorder.vendorid=vtiger_vendor.vendorid inner join vtiger_pobillads on vtiger_purchaseorder.purchaseorderid=vtiger_pobillads.pobilladdressid inner join vtiger_poshipads on vtiger_purchaseorder.purchaseorderid=vtiger_poshipads.poshipaddressid left join vtiger_purchaseordercf on vtiger_purchaseordercf.purchaseorderid = vtiger_purchaseorder.purchaseorderid left join vtiger_pogrouprelation on vtiger_purchaseorder.purchaseorderid=vtiger_pogrouprelation.purchaseorderid left join vtiger_groups on vtiger_groups.groupname=vtiger_pogrouprelation.groupname left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid where vtiger_crmentity.deleted=0 "; 52 53 // Query for Quotes 54 $quotes_query="select vtiger_crmentity.*,vtiger_quotes.* from vtiger_quotes inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_quotes.quoteid inner join vtiger_quotesbillads on vtiger_quotes.quoteid=vtiger_quotesbillads.quotebilladdressid inner join vtiger_quotesshipads on vtiger_quotes.quoteid=vtiger_quotesshipads.quoteshipaddressid left join vtiger_quotescf on vtiger_quotes.quoteid = vtiger_quotescf.quoteid left outer join vtiger_account on vtiger_account.accountid=vtiger_quotes.accountid left outer join vtiger_potential on vtiger_potential.potentialid=vtiger_quotes.potentialid left join vtiger_quotegrouprelation on vtiger_quotes.quoteid=vtiger_quotegrouprelation.quoteid left join vtiger_groups on vtiger_groups.groupname=vtiger_quotegrouprelation.groupname left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid where vtiger_crmentity.deleted=0 "; 55 56 //Query for Invoice 57 $invoice_query="select vtiger_crmentity.*,vtiger_invoice.* from vtiger_invoice inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_invoice.invoiceid inner join vtiger_invoicebillads on vtiger_invoice.invoiceid=vtiger_invoicebillads.invoicebilladdressid inner join vtiger_invoiceshipads on vtiger_invoice.invoiceid=vtiger_invoiceshipads.invoiceshipaddressid left outer join vtiger_salesorder on vtiger_salesorder.salesorderid=vtiger_invoice.salesorderid inner join vtiger_invoicecf on vtiger_invoice.invoiceid = vtiger_invoicecf.invoiceid left join vtiger_invoicegrouprelation on vtiger_invoice.invoiceid=vtiger_invoicegrouprelation.invoiceid left join vtiger_groups on vtiger_groups.groupname=vtiger_invoicegrouprelation.groupname left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid where vtiger_crmentity.deleted=0 "; 58 59 //Query for tickets 60 $helpdesk_query=" select vtiger_troubletickets.status AS ticketstatus, vtiger_ticketgrouprelation.groupname AS ticketgroupname, vtiger_troubletickets.*,vtiger_crmentity.* from vtiger_troubletickets inner join vtiger_ticketcf on vtiger_ticketcf.ticketid = vtiger_troubletickets.ticketid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_troubletickets.ticketid left join vtiger_ticketgrouprelation on vtiger_troubletickets.ticketid=vtiger_ticketgrouprelation.ticketid left join vtiger_groups on vtiger_groups.groupname=vtiger_ticketgrouprelation.groupname left join vtiger_contactdetails on vtiger_troubletickets.parent_id=vtiger_contactdetails.contactid left join vtiger_account on vtiger_account.accountid=vtiger_troubletickets.parent_id left join vtiger_users on vtiger_crmentity.smownerid=vtiger_users.id and vtiger_troubletickets.ticketid = vtiger_ticketcf.ticketid where vtiger_crmentity.deleted=0"; 61 62 //Query for campaigns 63 $campaign_query=" select vtiger_campaign.*,vtiger_crmentity.* from vtiger_campaign inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_campaign.campaignid inner join vtiger_campaigncontrel where vtiger_campaigncontrel.campaignid=vtiger_campaign.campaignid and vtiger_crmentity.deleted=0"; 64 65 66 //Query for tickets by account 67 $tickets_by_account="select vtiger_troubletickets.*, vtiger_account.* from vtiger_troubletickets inner join vtiger_account on vtiger_account.accountid=vtiger_troubletickets.parent_id"; 68 69 //Query for tickets by contact 70 $tickets_by_contact="select vtiger_troubletickets.*, vtiger_contactdetails.* from vtiger_troubletickets inner join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_troubletickets.parent_id"; 71 72 //Query for product by category 73 74 $product_category = "select vtiger_products.*,vtiger_crmentity.deleted from vtiger_products inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid where vtiger_crmentity.deleted=0"; 75 76 /**This function generates the security parameters for a given module based on the assigned profile 77 *Param $module - module name 78 *Returns an string value 79 */ 80 81 function dashboard_check($module) 82 { 83 global $current_user; 84 $sec_parameter = ''; 85 $tab_id = getTabid($module); 86 require('user_privileges/user_privileges_'.$current_user->id.'.php'); 87 require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); 88 if($is_admin==false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tab_id] == 3) 89 { 90 $sec_parameter=getListViewSecurityParameter($module); 91 } 92 return $sec_parameter; 93 } 94 95 $graph_array = Array( 96 "DashboardHome" => $mod_strings['DashboardHome'], 97 "leadsource" => $mod_strings['leadsource'], 98 "leadstatus" => $mod_strings['leadstatus'], 99 "leadindustry" => $mod_strings['leadindustry'], 100 "salesbyleadsource" => $mod_strings['salesbyleadsource'], 101 "salesbyaccount" => $mod_strings['salesbyaccount'], 102 "salesbyuser" => $mod_strings['salesbyuser'], 103 "salesbyteam" => $mod_strings['salesbyteam'], 104 "accountindustry" => $mod_strings['accountindustry'], 105 "productcategory" => $mod_strings['productcategory'], 106 "productbyqtyinstock" => $mod_strings['productbyqtyinstock'], 107 "productbypo" => $mod_strings['productbypo'], 108 "productbyquotes" => $mod_strings['productbyquotes'], 109 "productbyinvoice" => $mod_strings['productbyinvoice'], 110 "sobyaccounts" => $mod_strings['sobyaccounts'], 111 "sobystatus" => $mod_strings['sobystatus'], 112 "pobystatus" => $mod_strings['pobystatus'], 113 "quotesbyaccounts" => $mod_strings['quotesbyaccounts'], 114 "quotesbystage" => $mod_strings['quotesbystage'], 115 "invoicebyacnts" => $mod_strings['invoicebyacnts'], 116 "invoicebystatus" => $mod_strings['invoicebystatus'], 117 "ticketsbystatus" => $mod_strings['ticketsbystatus'], 118 "ticketsbypriority" => $mod_strings['ticketsbypriority'], 119 "ticketsbycategory" => $mod_strings['ticketsbycategory'], 120 "ticketsbyuser" => $mod_strings['ticketsbyuser'], 121 "ticketsbyteam" => $mod_strings['ticketsbyteam'], 122 "ticketsbyproduct"=> $mod_strings['ticketsbyproduct'], 123 "contactbycampaign"=> $mod_strings['contactbycampaign'], 124 "ticketsbyaccount"=> $mod_strings['ticketsbyaccount'], 125 "ticketsbycontact"=> $mod_strings['ticketsbycontact'], 126 ); 127 128 ?> 129 <table width="100%" border="0" cellspacing="0" cellpadding="0"> 130 <!--char goes here--> 131 <?php 132 //Charts for Lead Source 133 if(($type == "leadsource") && (getFieldVisibilityPermission('Leads',$user_id,'leadsource') == "0")) 134 { 135 $graph_by="leadsource"; 136 $graph_title= $mod_strings['leadsource']; 137 $module="Leads"; 138 $where=""; 139 $query=$leads_query." ".dashboard_check($module); 140 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 141 142 } 143 // To display the charts for Lead status 144 elseif (($type == "leadstatus")&& (getFieldVisibilityPermission('Leads',$user_id,'leadstatus') == "0")) 145 { 146 $graph_by="leadstatus"; 147 $graph_title= $mod_strings['leadstatus']; 148 $module="Leads"; 149 $where=""; 150 $query=$leads_query." ".dashboard_check($module); 151 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 152 } 153 //Charts for Lead Industry 154 elseif (($type == "leadindustry") && (getFieldVisibilityPermission('Leads',$user_id,'industry') == "0")) 155 { 156 $graph_by="industry"; 157 $graph_title=$mod_strings['leadindustry']; 158 $module="Leads"; 159 $where=""; 160 $query=$leads_query." ".dashboard_check($module); 161 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 162 } 163 //Sales by Lead Source 164 elseif (($type == "salesbyleadsource")&& (getFieldVisibilityPermission('Potentials',$user_id,'leadsource') == "0")) 165 { 166 $graph_by="leadsource"; 167 $graph_title=$mod_strings['salesbyleadsource']; 168 $module="Potentials"; 169 $where=" and vtiger_potential.sales_stage like '%Closed Won%' "; 170 $query=$potential_query." ".dashboard_check($module); 171 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 172 } 173 //Sales by Account 174 elseif (($type == "salesbyaccount") && (getFieldVisibilityPermission('Potentials',$user_id,'account_id') == "0")) 175 { 176 $graph_by="accountid"; 177 $graph_title=$mod_strings['salesbyaccount']; 178 $module="Potentials"; 179 $where=" and vtiger_potential.sales_stage like '%Closed Won%' "; 180 $query=$potential_query." ".dashboard_check($module); 181 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 182 } 183 //Sales by User 184 elseif (($type == "salesbyuser") && (getFieldVisibilityPermission('Potentials',$user_id,'smownerid') == "0")) 185 { 186 $graph_by="smownerid"; 187 $graph_title=$mod_strings['salesbyuser']; 188 $module="Potentials"; 189 $where=" and vtiger_potential.sales_stage like '%Closed Won%' and (vtiger_crmentity.smownerid != NULL || vtiger_crmentity.smownerid != ' ')"; 190 $query=$potential_query." ".dashboard_check($module); 191 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 192 } 193 //Sales by team 194 elseif (($type == "salesbyteam") && (getFieldVisibilityPermission('Potentials',$user_id,'groupname') == "0")) 195 { 196 $graph_by="groupname"; 197 $graph_title=$mod_strings['salesbyteam']; 198 $module="Potentials"; 199 $where=" and vtiger_potential.sales_stage like '%Closed Won%' and (vtiger_potentialgrouprelation.groupname != NULL || vtiger_potentialgrouprelation.groupname != '')"; 200 $query=$potential_query." ".dashboard_check($module); 201 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 202 } 203 //Charts for Account by Industry 204 elseif (($type == "accountindustry") && (getFieldVisibilityPermission('Accounts',$user_id,'industry') == "0")) 205 { 206 $graph_by="industry"; 207 $graph_title=$mod_strings['accountindustry']; 208 $module="Accounts"; 209 $where=""; 210 $query=$account_query." ".dashboard_check($module); 211 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 212 } 213 //Charts for Products by Category 214 elseif (($type == "productcategory") && (getFieldVisibilityPermission('Products',$user_id,'productcategory') == "0")) 215 { 216 $graph_by="productcategory"; 217 $graph_title=$mod_strings['productcategory']; 218 $module="Products"; 219 $where=""; 220 $query=$product_category." ".dashboard_check($module); 221 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 222 } 223 //Charts for Products by Quantity in stock 224 elseif (($type == "productbyqtyinstock") && (getFieldVisibilityPermission('Products',$user_id,'qtyinstock') == "0")) 225 { 226 $graph_by="productname"; 227 $graph_title=$mod_strings['productbyqtyinstock']; 228 $module="Products"; 229 $where=""; 230 $query=$products_query." ".dashboard_check($module); 231 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 232 } 233 //Charts for Products by PO 234 elseif (($type == "productbypo") && (getFieldVisibilityPermission('Products',$user_id,'productpurchaseorder') == "0")) 235 { 236 $graph_by="purchaseorderid"; 237 $graph_title=$mod_strings['productbypo']; 238 $module="Products"; 239 $where=""; 240 $query=$products_query." ".dashboard_check($module); 241 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 242 } 243 //Charts for Products by Quotes 244 elseif (($type == "productbyquotes") && (getFieldVisibilityPermission('Products',$user_id,'productquotes') == "0")) 245 { 246 $graph_by="quoteid"; 247 $graph_title=$mod_strings['productbyquotes']; 248 $module="Products"; 249 $where=""; 250 $query=$products_query." ".dashboard_check($module); 251 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 252 } 253 //Charts for Products by Invoice 254 elseif (($type == "productbyinvoice") && (getFieldVisibilityPermission('Products',$user_id,'productinvoice') == "0")) 255 { 256 $graph_by="invoiceid"; 257 $graph_title=$mod_strings['productbyinvoice']; 258 $module="Products"; 259 $where=""; 260 $query=$products_query." ".dashboard_check($module); 261 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 262 } 263 264 // Sales Order by Accounts 265 elseif (($type == "sobyaccounts") && (getFieldVisibilityPermission('SalesOrder',$user_id,'account_id') == "0")) 266 { 267 $graph_by="accountid"; 268 $graph_title=$mod_strings['sobyaccounts']; 269 $module="SalesOrder"; 270 $where=""; 271 $query=$so_query." ".dashboard_check($module); 272 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 273 } 274 //Sales Order by Status 275 elseif (($type == "sobystatus") && (getFieldVisibilityPermission('SalesOrder',$user_id,'sostatus') == "0")) 276 { 277 $graph_by="sostatus"; 278 $graph_title=$mod_strings['sobystatus']; 279 $module="SalesOrder"; 280 $where=""; 281 $query=$so_query." ".dashboard_check($module); 282 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 283 } 284 //Purchase Order by Status 285 elseif (($type == "pobystatus") && (getFieldVisibilityPermission('PurchaseOrder',$user_id,'postatus') == "0")) 286 { 287 $graph_by="postatus"; 288 $graph_title=$mod_strings['pobystatus']; 289 $module="PurchaseOrder"; 290 $where=""; 291 $query=$po_query." ".dashboard_check($module); 292 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 293 } 294 //Quotes by Accounts 295 elseif (($type == "quotesbyaccounts") && (getFieldVisibilityPermission('Quotes',$user_id,'account_id') == "0")) 296 { 297 $graph_by="accountid"; 298 $graph_title= $mod_strings['quotesbyaccounts']; 299 $module="Quotes"; 300 $where=""; 301 $query=$quotes_query." ".dashboard_check($module); 302 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 303 } 304 //Quotes by Stage 305 elseif (($type == "quotesbystage") && (getFieldVisibilityPermission('Quotes',$user_id,'quotestage') == "0")) 306 { 307 $graph_by="quotestage"; 308 $graph_title=$mod_strings['quotesbystage']; 309 $module="Quotes"; 310 $where=""; 311 $query=$quotes_query." ".dashboard_check($module); 312 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 313 } 314 //Invoice by Accounts 315 elseif (($type == "invoicebyacnts") && (getFieldVisibilityPermission('Invoice',$user_id,'account_id') == "0")) 316 { 317 $graph_by="accountid"; 318 $graph_title=$mod_strings['invoicebyacnts']; 319 $module="Invoice"; 320 $where=""; 321 $query=$invoice_query." ".dashboard_check($module); 322 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 323 } 324 //Invoices by status 325 elseif (($type == "invoicebystatus") && (getFieldVisibilityPermission('Invoice',$user_id,'invoicestatus') == "0")) 326 { 327 $graph_by="invoicestatus"; 328 $graph_title=$mod_strings['invoicebystatus']; 329 $module="Invoice"; 330 $where=""; 331 $query=$invoice_query." ".dashboard_check($module); 332 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 333 } 334 //Tickets by Status 335 elseif (($type == "ticketsbystatus") && (getFieldVisibilityPermission('HelpDesk',$user_id,'ticketstatus') == "0")) 336 { 337 $graph_by="ticketstatus"; 338 $graph_title=$mod_strings['ticketsbystatus']; 339 $module="HelpDesk"; 340 $where=""; 341 $query=$helpdesk_query." ".dashboard_check($module); 342 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 343 } 344 //Tickets by Priority 345 elseif (($type == "ticketsbypriority") && (getFieldVisibilityPermission('HelpDesk',$user_id,'ticketpriorities') == "0")) 346 { 347 $graph_by="priority"; 348 $graph_title=$mod_strings['ticketsbypriority']; 349 $module="HelpDesk"; 350 $where=""; 351 $query=$helpdesk_query." ".dashboard_check($module); 352 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 353 } 354 //Tickets by Category 355 elseif (($type == "ticketsbycategory") && (getFieldVisibilityPermission('HelpDesk',$user_id,'ticketcategory') == "0")) 356 { 357 $graph_by="category"; 358 $graph_title=$mod_strings['ticketsbycategory']; 359 $module="HelpDesk"; 360 $where=""; 361 $query=$helpdesk_query." ".dashboard_check($module); 362 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 363 } 364 //Tickets by User 365 elseif (($type == "ticketsbyuser") && (getFieldVisibilityPermission('HelpDesk',$user_id,'ticketuser') == "0")) 366 { 367 $graph_by="smownerid"; 368 $graph_title=$mod_strings['ticketsbyuser']; 369 $module="HelpDesk"; 370 $where=" and (vtiger_crmentity.smownerid != NULL || vtiger_crmentity.smownerid != ' ')"; 371 $query=$helpdesk_query." ".dashboard_check($module); 372 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 373 } 374 //Tickets by Team 375 elseif (($type == "ticketsbyteam") && (getFieldVisibilityPermission('HelpDesk',$user_id,'ticketteam') == "0")) 376 { 377 $graph_by="ticketgroupname"; 378 $graph_title=$mod_strings['ticketsbyteam']; 379 $module="HelpDesk"; 380 $where=" and (vtiger_ticketgrouprelation.groupname != NULL || vtiger_ticketgrouprelation.groupname != ' ')"; 381 $query=$helpdesk_query." ".dashboard_check($module); 382 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 383 } 384 //Tickets by Product 385 elseif (($type == "ticketsbyproduct") && (getFieldVisibilityPermission('HelpDesk',$user_id,'ticketproduct') == "0")) 386 { 387 $graph_by="product_id"; 388 $graph_title=$mod_strings['ticketsbyproduct']; 389 $module="HelpDesk"; 390 $where=""; 391 $query=$helpdesk_query." ".dashboard_check($module); 392 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 393 } 394 //Campaigns by Contact 395 elseif (($type == "contactbycampaign") && (getFieldVisibilityPermission('Campaigns',$user_id,'campaignid') == "0")) 396 { 397 $graph_by="campaignname"; 398 $graph_title=$mod_strings['contactbycampaign']; 399 $module="Campaigns"; 400 $where=""; 401 $query=$campaign_query." ".dashboard_check($module); 402 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 403 } 404 //Tickets by Account 405 elseif (($type == "ticketsbyaccount") && (getFieldVisibilityPermission('HelpDesk',$user_id,'accountid') == "0")) 406 { 407 $graph_by="accountid"; 408 $graph_title=$mod_strings['ticketsbyaccount']; 409 $module="HelpDesk"; 410 $where=""; 411 $query=$tickets_by_account." ".dashboard_check($module); 412 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 413 } 414 //Tickets by Contact 415 elseif (($type == "ticketsbycontact") && (getFieldVisibilityPermission('HelpDesk',$user_id,'contactid') == "0")) 416 { 417 $graph_by="contactid"; 418 $graph_title=$mod_strings['ticketsbycontact']; 419 $module="HelpDesk"; 420 $where=""; 421 $query=$tickets_by_contact." ".dashboard_check($module); 422 echo get_graph_by_type($graph_by,$graph_title,$module,$where,$query); 423 } 424 else 425 { 426 //echo $mod_strings['LBL_NO_PERMISSION_FIELD']; 427 sleep(1); 428 echo '<h3>'.$mod_strings['LBL_NO_PERMISSION_FIELD'].'</h3>'; 429 } 430 431 ?> 432 433 </table> 434 <script id="dash_script"> 435 var gdash_display_type = '<?php echo $_REQUEST['display_view'];?>'; 436 </script>
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 |