From aa8339f99c13f74cfcacc8ac2077f7764c5d26d4 Mon Sep 17 00:00:00 2001 From: jengo Date: Wed, 17 Oct 2001 01:10:23 +0000 Subject: [PATCH] - Fixed return_html() not working when no history is present - Fixed return_array() not working when using the show_only paramter --- phpgwapi/inc/class.historylog.inc.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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 + }