Empty Prefs in LDAP changed from Today's little ldap schema witch project and a horde.schema diff.

Edwin Culp eculp@encontacto.net
Thu, 11 Apr 2002 06:48:09 -0700


Jon,

I've got a meeting and when I'm finished I'll try your patch as is.
Because of the pressure to get to the meeting I changed a couple of
lines and am only checking for not empty values as I mentioned in
my first email today.  This is the same as I was trying to do yesterday
but was receiving a "class name error" and with this I get 

Fatal error: Undefined class name 'pref' in /usr/src/horde/lib/Prefs/ldap.php on
line 312

I don't know why but I'm sure that you do:-)

I'll get back on this after my meeting.

Thanks

ed

# cvs diff ldap.php
Index: ldap.php
===================================================================
RCS file: /repository/horde/lib/Prefs/ldap.php,v
retrieving revision 1.24
diff -u -r1.24 ldap.php
--- ldap.php    2 Apr 2002 01:31:52 -0000       1.24
+++ ldap.php    11 Apr 2002 13:39:51 -0000
@@ -306,13 +306,17 @@
          * Build a hash of the preferences and their values that need to be
          * stored in the LDAP server.
          */
-        $new_values = array();
+        $entry = array();
         foreach($dirty_prefs as $pref) {
-            $new_values[$this->map($pref)] = utf8_encode(Prefs::getValue($pref));
+
+            $value = Pref::getValue($pref);
+            if (!empty($value)) {
+                $entry[$this->map($pref)] = utf8_encode($value);
+            }
         }

         /* Send the hash to the LDAP server. */
-        if (!@ldap_modify($this->connection, $this->dn, $new_values)) {
+        if (!@ldap_modify($this->connection, $this->dn, $entry)) {
             Horde::fatal(new PEAR_Error(sprintf(_("Unable to modify
preferences: [%d] %s"), ldap_errno($this->connection),
ldap_error($this->connection))), __FILE__, __LINE__);
         }



-------------------------------------------------------------
 http://insourcery.com - Mergence of Business and Technology  
          a "Griffin Plaza Partners, LLC" Company