fix for bug 1308

This commit is contained in:
ceb 2002-10-15 00:12:39 +00:00
parent 5490271c27
commit df62f9d644

View File

@ -56,6 +56,7 @@
$this->account_id = $account_id;
$this->app_name = $app_name;
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
$this->grants = $GLOBALS['phpgw']->acl->get_grants($app_name);
}
@ -195,6 +196,9 @@
$sql = "SELECT * from phpgw_categories WHERE (cat_appname='" . $this->app_name . "' AND" . $grant_cats . $global_cats . ")"
. $parent_filter . $querymethod . $filter;
$this->db2->query($sql,__LINE__,__FILE__);
$this->total_records = $this->db2->num_rows();
if ($limit)
{
$this->db->limit_query($sql . $ordermethod,$start,__LINE__,__FILE__);
@ -204,8 +208,6 @@
$this->db->query($sql . $ordermethod,__LINE__,__FILE__);
}
$this->total_records = $this->db->num_rows();
return $this->db2cats();
}
@ -269,6 +271,9 @@
$sql = "SELECT * from phpgw_categories WHERE (cat_appname='" . $this->app_name . "' AND" . $grant_cats . $global_cats . ")"
. $querymethod;
$this->db2->query($sql . $parent_select,__LINE__,__FILE__);
$total_mains = $this->db2->num_rows();
if ($limit)
{
$this->db->limit_query($sql . $parent_select . $ordermethod,$start,__LINE__,__FILE__);
@ -285,6 +290,9 @@
{
$sub_select = " AND cat_parent='" . $cats[$i]['cat_id'] . "' AND cat_level='" . ($cats[$i]['level']+1) . "'";
$this->db2->query($sql . $sub_select,__LINE__,__FILE__);
$total_subs += $this->db2->num_rows();
if ($limit)
{
$this->db->limit_query($sql . $sub_select . $ordermethod,$start,__LINE__,__FILE__);
@ -316,7 +324,8 @@
$num_cats = count($cats);
}
}
$this->total_records = count($cats);
//$this->total_records = count($cats);
$this->total_records = $total_mains + $total_subs;
return $cats;
}