forked from extern/egroupware
Make add() match sql class for input; BUG# 897792 - Fix filtering in read() to not
error when adding elements to string vs. array value for phpgwcontactowner;
This commit is contained in:
parent
bab57d221a
commit
b7ae8accc8
@ -243,8 +243,8 @@
|
||||
|
||||
if(count($stock_fieldnames))
|
||||
{
|
||||
$t_fields = "," . implode(",",$stock_fieldnames);
|
||||
if ($t_fields == ",")
|
||||
$t_fields = ',' . implode(',',$stock_fieldnames);
|
||||
if($t_fields == ',')
|
||||
{
|
||||
unset($t_fields);
|
||||
}
|
||||
@ -365,15 +365,14 @@
|
||||
|
||||
if(@is_array($this->grants))
|
||||
{
|
||||
$filterfields['phpgwcontactowner'] = array();
|
||||
/* this was not listing private entries when show all was selected */
|
||||
/* $filterfields += array('phpgwcontactaccess' => 'public'); */
|
||||
$grants = $this->grants;
|
||||
if($DEBUG) { echo '<br>DEBUG - My user id is: ' . $this->account_id; }
|
||||
while (list($user) = each($grants))
|
||||
foreach($this->grants as $user => $right)
|
||||
{
|
||||
if($DEBUG) { echo '<br>DEBUG - Grant from owner: ' . $user; }
|
||||
/* I know this looks silly... */
|
||||
@$filterfields['phpgwcontactowner'][] = array('phpgwcontactowner' => $user);
|
||||
$filterfields['phpgwcontactowner'][] = array('phpgwcontactowner' => $user);
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -381,17 +380,13 @@
|
||||
{
|
||||
while(list($name,$value) = each($filterfields))
|
||||
{
|
||||
echo "<br>DEBUG - Filter strings: #".$name.",".$value."#";
|
||||
echo '<br>DEBUG - Filter strings: #' . $name . ',' . $value . '#';
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (!$sort) { $sort = 'ASC'; }
|
||||
|
||||
if (!$order)
|
||||
{
|
||||
$order = 'n_family';
|
||||
}
|
||||
$sort = $sort ? $sort : 'ASC';
|
||||
$order = $order ? $order : 'n_family';
|
||||
|
||||
if($DEBUG && $order)
|
||||
{
|
||||
@ -623,13 +618,19 @@
|
||||
return $fquery;
|
||||
}
|
||||
|
||||
function add($owner,$fields,$access='private',$cat_id='0',$tid='n')
|
||||
function add($owner,$fields,$access=NULL,$cat_id=NULL,$tid=NULL)
|
||||
{
|
||||
$tid = $fields['tid'] ? trim($fields['tid']) : $tid;
|
||||
unset($fields['tid']);
|
||||
if(empty($tid))
|
||||
// access, cat_id and tid can be in $fields now or as extra params
|
||||
foreach(array('access','cat_id','tid') as $extra)
|
||||
{
|
||||
$tid = 'n';
|
||||
if(!is_null($$extra))
|
||||
{
|
||||
$fields[$extra] = $$extra;
|
||||
}
|
||||
}
|
||||
if(empty($fields['tid']))
|
||||
{
|
||||
$fields['tid'] = 'n';
|
||||
}
|
||||
|
||||
if(!$GLOBALS['phpgw_info']['server']['ldap_contact_context'])
|
||||
@ -673,11 +674,14 @@
|
||||
$ldap_fields['uid'] = time().$time['usec'].':'.$ldap_fields['givenname'];
|
||||
|
||||
$dn = 'uid=' . $ldap_fields['uid'].',' . $GLOBALS['phpgw_info']['server']['ldap_contact_context'];
|
||||
$ldap_fields['phpgwcontacttypeid'] = $tid;
|
||||
$ldap_fields['phpgwcontacttypeid'] = $fields['tid'];
|
||||
$ldap_fields['phpgwcontactowner'] = $owner;
|
||||
if (!isset($access)) { $access = 'private'; }
|
||||
$ldap_fields['phpgwcontactaccess'] = $access;
|
||||
$ldap_fields['phpgwcontactcatid'] = $cat_id ? $cat_id : '0';
|
||||
if(!isset($fields['access']))
|
||||
{
|
||||
$fields['access'] = 'private';
|
||||
}
|
||||
$ldap_fields['phpgwcontactaccess'] = $fields['access'];
|
||||
$ldap_fields['phpgwcontactcatid'] = $fields['cat_id'] ? $fields['cat_id'] : '0';
|
||||
$ldap_fields['uidnumber'] = $this->nextid;
|
||||
/* $ldap_fields['objectclass'][0] = 'person'; */
|
||||
$ldap_fields['objectclass'][0] = 'organizationalPerson';
|
||||
|
Loading…
Reference in New Issue
Block a user