mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +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 */
|
||||
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)
|
||||
{
|
||||
@ -406,7 +406,16 @@
|
||||
$ldap_fields = array();
|
||||
$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);
|
||||
$myfilter = $this->makefilter($filterfields,$this->stock_contact_fields,$query,$DEBUG);
|
||||
@ -498,7 +507,7 @@
|
||||
}
|
||||
|
||||
/* 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))
|
||||
{
|
||||
@ -547,7 +556,14 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$oquery .= '(' . $x . '=*' . $y . '*)';
|
||||
if($first)
|
||||
{
|
||||
$oquery .= '(' . $x . '=' . $y . '*)';
|
||||
}
|
||||
else
|
||||
{
|
||||
$oquery .= '(' . $x . '=*' . $y . '*)';
|
||||
}
|
||||
$hasor = True;
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,7 @@
|
||||
}
|
||||
|
||||
/* 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(!$limit) { $limit = 0; }
|
||||
@ -482,7 +482,21 @@
|
||||
|
||||
$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);
|
||||
|
Loading…
Reference in New Issue
Block a user