From 66bea738726f1e60c830b0818abf7f37ca69467b Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Thu, 22 Mar 2001 09:36:51 +0000 Subject: [PATCH] Editing now working via update function --- addressbook/inc/class.contacts_ldap.inc.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addressbook/inc/class.contacts_ldap.inc.php b/addressbook/inc/class.contacts_ldap.inc.php index 7981be9a4d..06f3dcfb88 100644 --- a/addressbook/inc/class.contacts_ldap.inc.php +++ b/addressbook/inc/class.contacts_ldap.inc.php @@ -542,7 +542,7 @@ if ($ldap_fields[0]['dn']) { $dn = $ldap_fields[0]['dn']; list($stock_fields,$stock_fieldnames,$extra_fields) = $this->split_stock_and_extras($fields); - if (count($stock_fields)) { + if (gettype($stock_fieldnames) == "array") { $stock_fields['phpgwowner'] = $owner; // Check each value, add our extra attributes if they are missing, and // otherwise fix the entry while we can @@ -590,10 +590,13 @@ $err = ldap_mod_add($this->ldap,$dn,array('objectclass' => $stock_fields['objectclass'])); } - while ( list($fname,$fvalue) = each($this->stock_contact_fields) ) { - if (empty($ldap_fields[0][$fvalue])) { + // OK, just add the data already + while ( list($fname,$fvalue) = each($stock_fieldnames) ) { + if ($ldap_fields[0][$fvalue]) { + //echo "
".$fname." was there"; $err = ldap_modify($this->ldap,$dn,array($fvalue => $stock_fields[$fname])); } elseif (!$ldap_fields[0][$fvalue]) { + //echo "
".$fname." not there"; $err = ldap_mod_add($this->ldap,$dn,array($fvalue => $stock_fields[$fname])); } }