diff --git a/phpgwapi/inc/class.historylog.inc.php b/phpgwapi/inc/class.historylog.inc.php index c9b8d25dfd..e2547337d9 100644 --- a/phpgwapi/inc/class.historylog.inc.php +++ b/phpgwapi/inc/class.historylog.inc.php @@ -55,8 +55,18 @@ } // array $filter_out - function return_array($filter_out,$only_show,$orderby = '',$sort = '', $record_id = 0) + function return_array($filter_out,$only_show,$_orderby = '',$sort = '', $record_id = 0) { + + if (! $sort || ! $_orderby) + { + $orderby = 'order by history_timestamp,history_id'; + } + else + { + $orderby = "order by $_orderby $sort"; + } + while (is_array($filter_out) && list(,$_filter) = each($filter_out)) { $filtered[] = "history_status != '$_filter'"; @@ -74,7 +84,7 @@ if (is_array($_only_show)) { - $only_show_filter = ' and ' . implode(' and ',$_only_show); + $only_show_filter = ' and ' . implode(' or ',$_only_show); } if ($record_id) @@ -83,7 +93,7 @@ } $this->db->query("select * from phpgw_history_log where history_appname='" - . $this->appname . "' $filter $record_filter $only_show_filter order by history_timestamp,history_id",__LINE__,__FILE__); + . $this->appname . "' $filter $record_filter $only_show_filter $orderby",__LINE__,__FILE__); while ($this->db->next_record()) { $return_values[] = array( @@ -125,6 +135,7 @@ if (! is_array($values)) { + $this->template->set_var('tr_color',$GLOBALS['phpgw_info']['theme']['row_off']); $this->template->set_var('lang_no_history',lang('No history for this record')); $this->template->fp('rows','row_no_history'); return $this->template->fp('out','list'); @@ -144,4 +155,4 @@ return $this->template->fp('out','list'); } - } \ No newline at end of file + }