From e13cdddda80fcb22e02c56d229d6bfbae9184deb Mon Sep 17 00:00:00 2001 From: jengo Date: Sat, 6 Oct 2001 04:36:48 +0000 Subject: [PATCH] Added way to only return records with a certain history_status --- phpgwapi/inc/class.historylog.inc.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/class.historylog.inc.php b/phpgwapi/inc/class.historylog.inc.php index 883a219a57..c9b8d25dfd 100644 --- a/phpgwapi/inc/class.historylog.inc.php +++ b/phpgwapi/inc/class.historylog.inc.php @@ -55,7 +55,7 @@ } // array $filter_out - function return_array($filter_out,$orderby = '',$sort = '', $record_id = 0) + function return_array($filter_out,$only_show,$orderby = '',$sort = '', $record_id = 0) { while (is_array($filter_out) && list(,$_filter) = each($filter_out)) { @@ -67,13 +67,23 @@ $filter = ' and ' . implode(' and ',$filtered); } + while (is_array($only_show) && list(,$_filter) = each($only_show)) + { + $_only_show[] = "history_status='$_filter'"; + } + + if (is_array($_only_show)) + { + $only_show_filter = ' and ' . implode(' and ',$_only_show); + } + if ($record_id) { $record_filter = " and history_record_id='$record_id' "; } $this->db->query("select * from phpgw_history_log where history_appname='" - . $this->appname . "' $filter $record_filter order by history_timestamp,history_id",__LINE__,__FILE__); + . $this->appname . "' $filter $record_filter $only_show_filter order by history_timestamp,history_id",__LINE__,__FILE__); while ($this->db->next_record()) { $return_values[] = array( @@ -111,7 +121,7 @@ $this->template->set_var('sort_status',lang('Status')); $this->template->set_var('sort_new_value',lang('New value')); - $values = $this->return_array($filter_out,$orderby,$sort,$record_id); + $values = $this->return_array($filter_out,array(),$orderby,$sort,$record_id); if (! is_array($values)) {