[Moved code inseide RatingTables class Adrian Georgescu **20081213175308] hunk ./library/rating.php 967 - function RatingTables ($readonly=false) { - global $CDRTool; - global $RatingEngine; - - $this->table = $_REQUEST['table']; - $this->readonly=$readonly; - - $this->settings=$RatingEngine; - - $this->CDRTool = $CDRTool; - - $this->db = new DB_cdrtool; - $this->db1 = new DB_cdrtool; - - $this->db->Halt_On_Error="no"; - $this->db1->Halt_On_Error="no"; - - if ($this->settings['csv_delimiter']) { - $this->delimiter=$this->settings['csv_delimiter']; - } - - $this->tables=array( + var $tables=array( hunk ./library/rating.php 1296 + + function RatingTables ($readonly=false) { + global $CDRTool; + global $RatingEngine; + + $this->settings = $RatingEngine; + $this->CDRTool = $CDRTool; + + $this->table = $_REQUEST['table']; + if (!$this->table || !in_array($this->table,array_keys($this->tables))) $this->table="destinations"; + + $this->readonly=$readonly; + + $this->db = new DB_cdrtool; + $this->db1 = new DB_cdrtool; + + $this->db->Halt_On_Error="no"; + $this->db1->Halt_On_Error="no"; + + if ($this->settings['csv_delimiter']) { + $this->delimiter=$this->settings['csv_delimiter']; + } + hunk ./library/rating.php 3739 - if (!$table) $table="destinations"; - if ($table == 'prepaid_cards') { + if ($this->table == 'prepaid_cards') { hunk ./library/rating.php 3745 - if (!is_array($this->tables[$table]['exceptions'])) $this->tables[$table]['exceptions']=array(); - if (!is_array($this->tables[$table]['keys'])) $this->tables[$table]['keys']=array(); - if (!is_array($this->tables[$table]['fields'])) $this->tables[$table]['fields']=array(); + if (!is_array($this->tables[$this->table]['exceptions'])) $this->tables[$this->table]['exceptions']=array(); + if (!is_array($this->tables[$this->table]['keys'])) $this->tables[$this->table]['keys']=array(); + if (!is_array($this->tables[$this->table]['fields'])) $this->tables[$this->table]['fields']=array(); hunk ./library/rating.php 3749 - if ($table=='prepaid' && strlen($_REQUEST['search_session_counter'])) { + if ($this->table=='prepaid' && strlen($_REQUEST['search_session_counter'])) { hunk ./library/rating.php 3754 - $this->tables[$table]['readonly']=1; + $this->tables[$this->table]['readonly']=1; hunk ./library/rating.php 3757 - $metadata = $this->db->metadata($table="$table"); + $metadata = $this->db->metadata($this->table); hunk ./library/rating.php 3768 - $query="select count(*) as c from $table where $this->whereDomainFilter"; + $query="select count(*) as c from $this->table where $this->whereDomainFilter"; hunk ./library/rating.php 3775 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { hunk ./library/rating.php 3823 - print " | Reload rating tables"; + print " | table>Reload rating tables"; hunk ./library/rating.php 3867 - if (!$order && $this->tables[$table]['order']) { - $order=sprintf(" order by %s ",$this->tables[$table]['order']); + if (!$order && $this->tables[$this->table]['order']) { + $order=sprintf(" order by %s ",$this->tables[$this->table]['order']); hunk ./library/rating.php 3872 - $table, + $this->table, hunk ./library/rating.php 3894 - if (!in_array($th,$this->tables[$table]['exceptions']) ) { - if ($this->tables[$table]['fields'][$th]['name']) { - $th=$this->tables[$table]['fields'][$th]['name']; + if (!in_array($th,$this->tables[$this->table]['exceptions']) ) { + if ($this->tables[$this->table]['fields'][$th]['name']) { + $th=$this->tables[$this->table]['fields'][$th]['name']; hunk ./library/rating.php 3946 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { hunk ./library/rating.php 3954 - if ($this->tables[$table]['fields'][$Fname]['size']) { - $field_size=$this->tables[$table]['fields'][$Fname]['size']; + if ($this->tables[$this->table]['fields'][$Fname]['size']) { + $field_size=$this->tables[$this->table]['fields'][$Fname]['size']; hunk ./library/rating.php 3960 - if (!in_array($Fname,$this->tables[$table]['keys']) ) { + if (!in_array($Fname,$this->tables[$this->table]['keys']) ) { hunk ./library/rating.php 3998 - $selected_table[$table]="selected"; + $selected_table[$this->table]="selected"; hunk ./library/rating.php 4014 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { hunk ./library/rating.php 4023 - if ($table!=='prepaid_cards' ) { - print " - - - "; + if ($this->table!=='prepaid_cards' ) { + printf (" + + + ",$this->table,$this->table_to_csv_name[$this->table]); hunk ./library/rating.php 4041 - if ($selection_made && !$this->tables[$table]['readonly']) { + if ($selection_made && !$this->tables[$this->table]['readonly']) { hunk ./library/rating.php 4061 - if ($this->tables[$table]['fields'][$Fname]['size']) { - $field_size=$this->tables[$table]['fields'][$Fname]['size']; + if ($this->tables[$this->table]['fields'][$Fname]['size']) { + $field_size=$this->tables[$this->table]['fields'][$Fname]['size']; hunk ./library/rating.php 4068 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { - if (!in_array($Fname,$this->tables[$table]['keys']) ) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['keys']) ) { hunk ./library/rating.php 4095 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { hunk ./library/rating.php 4109 - } else if (!$this->tables[$table]['readonly']){ + } else if (!$this->tables[$this->table]['readonly']){ hunk ./library/rating.php 4111 - if ($table == "billing_rates" && strlen($_REQUEST['search_name'])) { + if ($this->table == "billing_rates" && strlen($_REQUEST['search_name'])) { hunk ./library/rating.php 4166 - + table> hunk ./library/rating.php 4173 - } else if (!$this->tables[$table]['readonly']){ + } else if (!$this->tables[$this->table]['readonly']){ hunk ./library/rating.php 4188 - if ($this->tables[$table]['fields'][$Fname]['size']) { - $field_size=$this->tables[$table]['fields'][$Fname]['size']; + if ($this->tables[$this->table]['fields'][$Fname]['size']) { + $field_size=$this->tables[$this->table]['fields'][$Fname]['size']; hunk ./library/rating.php 4194 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { - if (!in_array($Fname,$this->tables[$table]['keys']) ) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['keys']) ) { hunk ./library/rating.php 4220 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { hunk ./library/rating.php 4231 - + table\"> hunk ./library/rating.php 4263 - if ($table == 'prepaid') { + if ($this->table == 'prepaid') { hunk ./library/rating.php 4311 - $table,$next,$_session,$search_text + $this->table,$next,$_session,$search_text hunk ./library/rating.php 4327 - if ($this->tables[$table]['fields'][$Fname]['size']) { - $field_size=$this->tables[$table]['fields'][$Fname]['size']; + if ($this->tables[$this->table]['fields'][$Fname]['size']) { + $field_size=$this->tables[$this->table]['fields'][$Fname]['size']; hunk ./library/rating.php 4333 - if ($this->tables[$table]['fields'][$Fname]['readonly']=="1") { + if ($this->tables[$this->table]['fields'][$Fname]['readonly']=="1") { hunk ./library/rating.php 4339 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { hunk ./library/rating.php 4341 - if (!in_array($Fname,$this->tables[$table]['keys']) && !$this->readonly) { + if (!in_array($Fname,$this->tables[$this->table]['keys']) && !$this->readonly) { hunk ./library/rating.php 4353 - if ($table == 'prepaid' && $Fname == 'session_counter' && $value) { + if ($this->table == 'prepaid' && $Fname == 'session_counter' && $value) { hunk ./library/rating.php 4371 - if ($table == 'prepaid' && $Fname == 'session_counter' && $value) { + if ($this->table == 'prepaid' && $Fname == 'session_counter' && $value) { hunk ./library/rating.php 4403 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { hunk ./library/rating.php 4419 - if (!$this->tables[$table]['readonly']) { + if (!$this->tables[$this->table]['readonly']) { hunk ./library/rating.php 4434 - + table> hunk ./library/rating.php 4446 - if ($table=='prepaid') { + if ($this->table=='prepaid') { hunk ./library/rating.php 4484 - + table> hunk ./library/rating.php 4493 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { hunk ./library/rating.php 4519 - + table> hunk ./library/rating.php 4527 - if (!in_array($Fname,$this->tables[$table]['exceptions'])) { + if (!in_array($Fname,$this->tables[$this->table]['exceptions'])) { hunk ./rating_tables.phtml 34 -$tables=$RatingTables->tables;