mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-09 15:00:07 +01:00
Part two of two - implement filter by first char of last name, fullname, or company (for now)
This commit is contained in:
parent
314fa566c6
commit
03a1333c4f
@ -308,7 +308,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* send this the range, query, sort, order and whatever fields you want to see */
|
/* send this the range, query, sort, order and whatever fields you want to see */
|
||||||
function read($start=0,$limit=0,$fields='',$query='',$filter='',$sort='',$order='')
|
function read($start=0,$limit=0,$fields='',$query='',$filter='',$sort='',$order='',$cquery='')
|
||||||
{
|
{
|
||||||
if(!$start)
|
if(!$start)
|
||||||
{
|
{
|
||||||
@ -406,7 +406,16 @@
|
|||||||
$ldap_fields = array();
|
$ldap_fields = array();
|
||||||
$myfilter = '';
|
$myfilter = '';
|
||||||
|
|
||||||
if($query)
|
if($cquery)
|
||||||
|
{
|
||||||
|
$cfields = array(
|
||||||
|
'fn' => 'cn',
|
||||||
|
'n_family' => 'sn',
|
||||||
|
'org_name' => 'o'
|
||||||
|
);
|
||||||
|
$myfilter = $this->makefilter($filterfields,$cfields,$cquery,$DEBUG,True);
|
||||||
|
}
|
||||||
|
elseif($query)
|
||||||
{
|
{
|
||||||
reset($this->stock_contact_fields);
|
reset($this->stock_contact_fields);
|
||||||
$myfilter = $this->makefilter($filterfields,$this->stock_contact_fields,$query,$DEBUG);
|
$myfilter = $this->makefilter($filterfields,$this->stock_contact_fields,$query,$DEBUG);
|
||||||
@ -498,7 +507,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Used by read() above to build the ldap filter string */
|
/* Used by read() above to build the ldap filter string */
|
||||||
function makefilter($qarray,$extra='',$query='', $DEBUG=False)
|
function makefilter($qarray,$extra='',$query='', $DEBUG=False,$first=False)
|
||||||
{
|
{
|
||||||
if(!is_array($qarray))
|
if(!is_array($qarray))
|
||||||
{
|
{
|
||||||
@ -546,8 +555,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if($first)
|
||||||
|
{
|
||||||
|
$oquery .= '(' . $x . '=' . $y . '*)';
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$oquery .= '(' . $x . '=*' . $y . '*)';
|
$oquery .= '(' . $x . '=*' . $y . '*)';
|
||||||
|
}
|
||||||
$hasor = True;
|
$hasor = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* send this the range, query, sort, order and whatever fields you want to see */
|
/* send this the range, query, sort, order and whatever fields you want to see */
|
||||||
function read($start=0,$limit=0,$fields='',$query='',$filter='',$sort='',$order='')
|
function read($start=0,$limit=0,$fields='',$query='',$filter='',$sort='',$order='',$cquery='')
|
||||||
{
|
{
|
||||||
if(!$start) { $start = 0; }
|
if(!$start) { $start = 0; }
|
||||||
if(!$limit) { $limit = 0; }
|
if(!$limit) { $limit = 0; }
|
||||||
@ -482,7 +482,21 @@
|
|||||||
|
|
||||||
$filtermethod = '';
|
$filtermethod = '';
|
||||||
|
|
||||||
if($query)
|
if($cquery)
|
||||||
|
{
|
||||||
|
$cfields = array(
|
||||||
|
'fn' => 'cn',
|
||||||
|
'n_family' => 'sn',
|
||||||
|
'org_name' => 'o'
|
||||||
|
);
|
||||||
|
while(list($f,$x) = each($cfields))
|
||||||
|
{
|
||||||
|
$sql .= " $f LIKE '$cquery%' OR ";
|
||||||
|
}
|
||||||
|
$sql = substr($sql,0,-3) . ') ' . $fand . $filtermethod . $ordermethod;
|
||||||
|
unset($f); unset($x);
|
||||||
|
}
|
||||||
|
elseif($query)
|
||||||
{
|
{
|
||||||
$query = ereg_replace("'",'',$query);
|
$query = ereg_replace("'",'',$query);
|
||||||
$query = ereg_replace('"','',$query);
|
$query = ereg_replace('"','',$query);
|
||||||
|
Loading…
Reference in New Issue
Block a user