mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-09 07:28:43 +01:00
Modify read to optionally handle queries
This commit is contained in:
parent
1804a9213c
commit
91316c0538
@ -97,7 +97,7 @@
|
|||||||
return $return_fields;
|
return $return_fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
function read($start,$offset,$access,$filters,$fields)
|
function read($start,$offset,$access,$filters,$fields,$query="")
|
||||||
{
|
{
|
||||||
list($ab_fields,$ab_fieldnames,$extra_fields) = $this->split_ab_and_extras($fields);
|
list($ab_fields,$ab_fieldnames,$extra_fields) = $this->split_ab_and_extras($fields);
|
||||||
if (count($ab_fieldnames)) {
|
if (count($ab_fieldnames)) {
|
||||||
@ -107,15 +107,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->query("select ab_id,ab_owner,ab_access $t_fields from addressbook "
|
|
||||||
. $filters,__LINE__,__FILE__);
|
|
||||||
$this->total_records = $this->db->num_rows();
|
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$this->db2 = $this->db; // Create new result object before our query
|
$this->db3 = $this->db2 = $this->db; // Create new result objects before our queries
|
||||||
|
|
||||||
$this->db->query("select ab_id,ab_owner,ab_access $t_fields from addressbook "
|
if ($query) {
|
||||||
|
$this->db3->query("SELECT * from addressbook $filters AND (ab_lastname like '"
|
||||||
|
. "%$query%' OR ab_firstname like '%$query%' OR ab_email like '%$query%' OR "
|
||||||
|
. "ab_street like '%$query%' OR ab_city like '%$query%' OR ab_state "
|
||||||
|
. "like '%$query%' OR ab_zip like '%$query%' OR ab_notes like "
|
||||||
|
. "'%$query%' OR ab_company like '%$query%')",__LINE__,__FILE__);
|
||||||
|
$this->total_records = $this->db3->num_rows();
|
||||||
|
|
||||||
|
$this->db->query("SELECT * from addressbook $filters AND (ab_lastname like '"
|
||||||
|
. "%$query%' OR ab_firstname like '%$query%' OR ab_email like '%$query%' OR "
|
||||||
|
. "ab_street like '%$query%' OR ab_city like '%$query%' OR ab_state "
|
||||||
|
. "like '%$query%' OR ab_zip like '%$query%' OR ab_notes like "
|
||||||
|
. "'%$query%' OR ab_company like '%$query%') " . $order . " "
|
||||||
|
. $this->db->limit($start,$offset),__LINE__,__FILE__);
|
||||||
|
} else {
|
||||||
|
$this->db3->query("select ab_id,ab_owner,ab_access $t_fields from addressbook "
|
||||||
|
. $filters,__LINE__,__FILE__);
|
||||||
|
$this->total_records = $this->db3->num_rows();
|
||||||
|
|
||||||
|
$this->db->query("select ab_id,ab_owner,ab_access $t_fields from addressbook "
|
||||||
. $filters . $this->db->limit($start,$offset),__LINE__,__FILE__);
|
. $filters . $this->db->limit($start,$offset),__LINE__,__FILE__);
|
||||||
|
}
|
||||||
|
|
||||||
while ($this->db->next_record()) {
|
while ($this->db->next_record()) {
|
||||||
$return_fields[$i]["id"] = $this->db->f("ab_id");
|
$return_fields[$i]["id"] = $this->db->f("ab_id");
|
||||||
$return_fields[$i]["owner"] = $this->db->f("ab_owner");
|
$return_fields[$i]["owner"] = $this->db->f("ab_owner");
|
||||||
|
Loading…
Reference in New Issue
Block a user