Ran real LDAP testing of pop3 accounts and bank account information. The bank accoun...
authorGunnar Wrobel <p@rdus.de>
Tue, 14 Apr 2009 20:32:45 +0000 (22:32 +0200)
committerGunnar Wrobel <p@rdus.de>
Tue, 14 Apr 2009 20:32:45 +0000 (22:32 +0200)
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabgermanbankarrangement.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabpop3account.php
framework/Kolab_Server/test/Horde/Kolab/Server/KolabgermanbankarrangementTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Kolabpop3accountTest.php

index 3e75cf9..f1e1a81 100644 (file)
@@ -69,6 +69,14 @@ class Horde_Kolab_Server_Object_Kolabgermanbankarrangement extends Horde_Kolab_S
                 'method' => 'getParentUid',
             ),
         ),
+        'collapsed' => array(
+            self::ATTRIBUTE_OWNERUID => array(
+                'base' => array(
+                    self::ATTRIBUTE_OWNERUID
+                ),
+                'method' => 'removeAttribute',
+            ),
+        ),
         'required' => array(
             self::ATTRIBUTE_NUMBER,
             self::ATTRIBUTE_BANKCODE,
@@ -90,14 +98,17 @@ class Horde_Kolab_Server_Object_Kolabgermanbankarrangement extends Horde_Kolab_S
     public function generateId(&$info)
     {
         if (!isset($info[self::ATTRIBUTE_OWNERUID])) {
-            throw new Horde_Kolab_Server_Exception(_("No parent object provided!"),
-                                                   Horde_Kolab_Server_Exception::INVALID_INFORMATION);
-        }
-
-        if (is_array($info[self::ATTRIBUTE_OWNERUID])) {
-            $uid = $info[self::ATTRIBUTE_OWNERUID][0];
+            $uid = $this->get(self::ATTRIBUTE_OWNERUID);
+            if (empty($uid)) {
+                throw new Horde_Kolab_Server_Exception(_("No parent object provided!"),
+                                                       Horde_Kolab_Server_Exception::INVALID_INFORMATION);
+            }
         } else {
-            $uid = $info[self::ATTRIBUTE_OWNERUID];
+            if (is_array($info[self::ATTRIBUTE_OWNERUID])) {
+                $uid = $info[self::ATTRIBUTE_OWNERUID][0];
+            } else {
+                $uid = $info[self::ATTRIBUTE_OWNERUID];
+            }
         }
 
         $object = $this->server->fetch($uid);
@@ -119,6 +130,8 @@ class Horde_Kolab_Server_Object_Kolabgermanbankarrangement extends Horde_Kolab_S
 
         $base = substr($uid, 0, strpos($uid, $this->server->getBaseUid()) - 1);
 
+       unset($info[self::ATTRIBUTE_OWNERUID]);
+
         return self::ATTRIBUTE_NUMBER . '=' . $this->server->structure->quoteForUid($number) . ',' . $base;
     }
 
index 34dfdd2..0309fb5 100644 (file)
@@ -96,6 +96,14 @@ class Horde_Kolab_Server_Object_Kolabpop3account extends Horde_Kolab_Server_Obje
                 'method' => 'getParentUid',
             ),
         ),
+        'collapsed' => array(
+            self::ATTRIBUTE_OWNERUID => array(
+                'base' => array(
+                    self::ATTRIBUTE_OWNERUID
+                ),
+                'method' => 'removeAttribute',
+            ),
+        ),
         'required' => array(
             self::ATTRIBUTE_CN,
             self::ATTRIBUTE_SERVER,
@@ -110,23 +118,24 @@ class Horde_Kolab_Server_Object_Kolabpop3account extends Horde_Kolab_Server_Obje
     /**
      * Generates an ID for the given information.
      *
-     * @param array $info The data of the object.
-     *
-     * @static
+     * @param array &$info The data of the object.
      *
      * @return string|PEAR_Error The ID.
      */
     public function generateId(&$info)
     {
         if (!isset($info[self::ATTRIBUTE_OWNERUID])) {
-            throw new Horde_Kolab_Server_Exception(_("No parent object provided!"),
-                                                   Horde_Kolab_Server_Exception::INVALID_INFORMATION);
-        }
-
-        if (is_array($info[self::ATTRIBUTE_OWNERUID])) {
-            $uid = $info[self::ATTRIBUTE_OWNERUID][0];
+            $uid = $this->get(self::ATTRIBUTE_OWNERUID);
+            if (empty($uid)) {
+                throw new Horde_Kolab_Server_Exception(_("No parent object provided!"),
+                                                       Horde_Kolab_Server_Exception::INVALID_INFORMATION);
+            }
         } else {
-            $uid = $info[self::ATTRIBUTE_OWNERUID];
+            if (is_array($info[self::ATTRIBUTE_OWNERUID])) {
+                $uid = $info[self::ATTRIBUTE_OWNERUID][0];
+            } else {
+                $uid = $info[self::ATTRIBUTE_OWNERUID];
+            }
         }
 
         $object = $this->server->fetch($uid);
@@ -159,6 +168,8 @@ class Horde_Kolab_Server_Object_Kolabpop3account extends Horde_Kolab_Server_Obje
 
         $base = substr($uid, 0, strpos($uid, $this->server->getBaseUid()) - 1);
 
+       unset($info[self::ATTRIBUTE_OWNERUID]);
+
         return self::ATTRIBUTE_CN . '=' . $this->server->structure->quoteForUid($cn) . ',' . $base;
     }
 
index 17949b1..6f160e0 100644 (file)
@@ -65,7 +65,7 @@ class Horde_Kolab_Server_KolabgermanbankarrangementTest extends Horde_Kolab_Test
          * We always use the test server
          */
         $servers[] = array($this->prepareEmptyKolabServer());
-        if (false) {
+        if (true) {
             $real = $this->prepareLdapKolabServer();
             if (!empty($real)) {
                 $servers[] = array($real);
index af5ebe7..68e3db7 100644 (file)
@@ -66,7 +66,7 @@ class Horde_Kolab_Server_Kolabpop3accountTest extends Horde_Kolab_Test_Server
          * We always use the test server
          */
         $servers[] = array($this->prepareEmptyKolabServer());
-        if (false) {
+        if (true) {
             $real = $this->prepareLdapKolabServer();
             if (!empty($real)) {
                 $servers[] = array($real);
@@ -126,15 +126,11 @@ class Horde_Kolab_Server_Kolabpop3accountTest extends Horde_Kolab_Test_Server
                                         Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_PASSWORD => array(
                                             'something',
                                             'somewhere',
-                                            null,
-                                            array('a', 'b'),
-                                            '',
                                         ),
                                         Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_DESCRIPTION => array(
                                             'something',
                                             'somewhere',
                                             null,
-                                            array('a', 'b'),
                                             '',
                                         ),
                                         Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_MAIL => array(
@@ -148,21 +144,18 @@ class Horde_Kolab_Server_Kolabpop3accountTest extends Horde_Kolab_Test_Server
                                             '110',
                                             '111',
                                             null,
-                                            array('20', '21'),
                                             '',
                                         ),
                                         Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_USESSL => array(
                                             'TRUE',
                                             'FALSE',
                                             null,
-                                            array('TRUE', 'FALSE'),
                                             '',
                                         ),
                                         Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_USETLS => array(
                                             'TRUE',
                                             'FALSE',
                                             null,
-                                            array('TRUE', 'FALSE'),
                                             '',
                                         ),
                                         Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_LOGINMETHOD => array(
@@ -176,14 +169,12 @@ class Horde_Kolab_Server_Kolabpop3accountTest extends Horde_Kolab_Test_Server
                                             'TRUE',
                                             'FALSE',
                                             null,
-                                            array('TRUE', 'FALSE'),
                                             '',
                                         ),
                                         Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_KEEPMAILONSERVER => array(
                                             'TRUE',
                                             'FALSE',
                                             null,
-                                            array('TRUE', 'FALSE'),
                                             '',
                                         ),
                                     )