* Addressbook/LDAP|SQL->LDAP: fixed error during creation of new contacts, SQL->LDAP now also displays LDAP errors

This commit is contained in:
Ralf Becker 2012-04-29 15:41:38 +00:00
parent 774bcf0037
commit 9a8dcc6eb4
2 changed files with 7 additions and 6 deletions

View File

@ -502,7 +502,7 @@ class addressbook_ldap
if (!@ldap_modify($this->ds, $dn, $ldapContact))
{
//echo "<p>ldap_modify($this->ds,'$dn',".print_r($ldapContact,true).")</p>\n";
//echo "<p>ldap_modify($this->ds,'$dn',".print_r($ldapContact,true).') failed errorcode: '. ldap_errno($this->ds) .' ('. ldap_error($this->ds) .")</p>\n";
error_log('class.so_ldap.inc.php ('. __LINE__ .') update of '. $dn .' failed errorcode: '. ldap_errno($this->ds) .' ('. ldap_error($this->ds) .')');
error_log(print_r($ldapContact,true));
return $this->_error(__LINE__);
@ -511,12 +511,13 @@ class addressbook_ldap
else
{
$dn = 'uid='. ldap::quote($ldapContact['uid']) .','. $baseDN;
unset($ldapContact['entryuuid']); // trying to write it, gives an error
if (!@ldap_add($this->ds, $dn, $ldapContact))
{
//echo "<p>ldap_add($this->ds,'$dn',".print_r($ldapContact,true).")</p>\n";
//echo "<p>ldap_add($this->ds,'$dn',".array2string($ldapContact).") failed errorcode: ".ldap_errno($this->ds) .' ('. ldap_error($this->ds) .")</p>\n";
error_log('class.so_ldap.inc.php ('. __LINE__ .') add of '. $dn .' failed errorcode: '. ldap_errno($this->ds) .' ('. ldap_error($this->ds) .')');
error_log(print_r($ldapContact,true));
error_log(array2string($ldapContact));
return $this->_error(__LINE__);
}
}
@ -991,7 +992,7 @@ class addressbook_ldap
if(!@ldap_add($adminDS, $dn, $data))
{
//echo "<p>ldap_add($adminDS,'$dn',".print_r($data,true).")</p>\n";
$err = $this->_error(__LINE__,$adminDS);
$err = lang("Can't create dn %1",$dn).': '.$this->_error(__LINE__,$adminDS);
$adminLDAP->ldapDisconnect();
return $err;
}

View File

@ -530,7 +530,7 @@ class addressbook_so
// which need to be the account_lid for accounts!
$data['id'] = $GLOBALS['egw']->accounts->id2name($contact['account_id']);
}
ExecMethod('addressbook.addressbook_ldap.save',$data);
$error_nr = ExecMethod('addressbook.addressbook_ldap.save',$data);
}
}
}
@ -582,7 +582,7 @@ class addressbook_so
function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null,$join='')
{
//echo '<p>'.__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter,true).",'$join')</p>\n";
//error_log(__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter,true).",'$join')");
//error_log(__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',".array2string($start).','.array2string($filter,true).",'$join')");
// Handle 'None' country option
if(is_array($filter) && $filter['adr_one_countrycode'] == '-custom-')