- Fixed return_html() not working when no history is present

- Fixed return_array() not working when using the show_only paramter
This commit is contained in:
jengo 2001-10-17 01:10:23 +00:00
parent e4f41e8ec1
commit aa8339f99c

View File

@ -55,8 +55,18 @@
} }
// array $filter_out // 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)) while (is_array($filter_out) && list(,$_filter) = each($filter_out))
{ {
$filtered[] = "history_status != '$_filter'"; $filtered[] = "history_status != '$_filter'";
@ -74,7 +84,7 @@
if (is_array($_only_show)) if (is_array($_only_show))
{ {
$only_show_filter = ' and ' . implode(' and ',$_only_show); $only_show_filter = ' and ' . implode(' or ',$_only_show);
} }
if ($record_id) if ($record_id)
@ -83,7 +93,7 @@
} }
$this->db->query("select * from phpgw_history_log where history_appname='" $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()) while ($this->db->next_record())
{ {
$return_values[] = array( $return_values[] = array(
@ -125,6 +135,7 @@
if (! is_array($values)) 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->set_var('lang_no_history',lang('No history for this record'));
$this->template->fp('rows','row_no_history'); $this->template->fp('rows','row_no_history');
return $this->template->fp('out','list'); return $this->template->fp('out','list');