diff --git a/plugins/gofon/fonreports/class_fonreport.inc b/plugins/gofon/fonreports/class_fonreport.inc
index 893112c574b0cfd326d3ed06d16a7606552ae428..5b810f60b6be0d3d04e86f5e74f96cf9d27bfba9 100644 (file)
/* Call parent execute */
plugin::execute();
- /* Get template engine */
+ /* GVet template engine */
$smarty= get_smarty();
+ foreach($this->fields as $field){
+ if(chkacl($this->acl,$field)==""){
+ $smarty->assign($field."ACL","");
+ }else{
+ $smarty->assign($field."ACL"," disabled ");
+ }
+ }
+
$months= array();
$months[1]= _("January"); $months[2]= _("February"); $months[3]= _("March"); $months[4]= _("April");
$months[5]= _("May"); $months[6]= _("June"); $months[7]= _("July"); $months[8]= _("August");
$this->userfilter= preg_replace("/OR $/", "", $this->userfilter);
}
- /* Perform SQL query */
-##### FIXME ACL, FILTER ######
-# if ($this->userfilter){
+ $fields_str = "calldate, ";
+
+ foreach($this->fields as $field){
+ if($field == "calldate") continue;
+ if(chkacl($this->acl,$field)==""){
+ $fields_str .= $field.", ";
+ }
+ }
+
+ $fields_str = preg_replace("/, $/","",$fields_str);
+
if ($this->sort_direction == "down"){
$desc= "DESC";
} else {
}
$start= date ("YmdHis", mktime(0,0,0,$this->month,1,$this->year));
$end= date ("YmdHis", mktime(23,59,59,$this->month+1,0,$this->year));
- $query = "SELECT calldate, channel, src, clid, lastapp, lastdata, dst, ".
- "disposition, duration FROM cdr ".
+ $query = "SELECT ".$fields_str." FROM cdr ".
"WHERE calldate <= $end AND ".
"calldate >= $start ORDER BY ".$this->fields[$this->sort]." $desc;";
}
$report_list= array();
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
+ $append_str = "";
$hour= substr($line["calldate"], 11, 2);
$minute=substr($line["calldate"], 14, 2);
$format= _("Y-M-D");
$date= preg_replace("/Y/", substr($line["calldate"], 0, 4), $format);
$date= preg_replace("/M/", substr($line["calldate"], 5, 2), $date);
$date= preg_replace("/D/", substr($line["calldate"], 8, 2), $date);
-
- $report_list[]= "<td>$date $hour:$minute</td>".
- "<td>".$line["src"]."</td>".
- "<td>".$line["dst"]."</td>".
- "<td>".$line["channel"]."</td>".
- "<td>".$line["lastapp"]."</td>".
- "<td>".$line["disposition"]."</td>".
- "<td>".$this->gen_duration($line["duration"])."</td>";
+ $append_str .= "<td>$date $hour:$minute</td>";
+ foreach(array("src","dst","channel","lastapp","disposition") as $atr){
+ if(isset($line[$atr])){
+ $append_str .= "<td>".$line[$atr]."</td>";
+ }
+ }
+ if(isset($line['duration'])){
+ $append_str .= "<td>".$this->gen_duration($line["duration"])."</td>";
+ }
+ $report_list[] = $append_str;
}
$this->report_list= $report_list;