Fixes saving of profesionnel phones.
[platal.git] / classes / direnum.php
index 2cd0f41..90fb331 100644 (file)
@@ -30,6 +30,7 @@ class DirEnum
      * being DE_$basename).
      */
     const NAMETYPES      = 'nametypes';
+    const NAMES          = 'names';
 
     const BINETS         = 'binets';
     const GROUPESX       = 'groupesx';
@@ -93,8 +94,10 @@ class DirEnum
             self::init($type);
         }
         $obj = self::$enumerations[$type];
+        $args = func_get_args();
+        array_shift($args);
         if ($obj->capabilities & DirEnumeration::HAS_OPTIONS) {
-            return call_user_func(array($obj, 'getOptionsIter'));
+            return call_user_func_array(array($obj, 'getOptionsIter'), $args);
         } else {
             return PlIteratorUtils::fromArray(array());
         }
@@ -343,7 +346,7 @@ abstract class DE_WithSuboption extends DirEnumeration
         } else if (array_key_exists($subid, $this->suboptions)) {
             return $this->suboptions[$subid];
         } else {
-            return false;
+            return array();
         }
     }
 
@@ -427,6 +430,18 @@ class DE_NameTypes extends DirEnumeration
 }
 // }}}
 
+// {{{ class DE_Names
+// returns 'system' names ('lastname', 'lastname_marital', ...)
+class DE_Names extends DirEnumeration
+{
+    public $capabilities = 0x005; // self::HAS_OPTIONS | self::SAVE_IN_SESSION;
+
+    protected $from     = 'profile_name_enum';
+    protected $idfield  = 'type';
+    protected $valfield = 'name';
+}
+// }}}
+
 /** GROUPS
  */
 // {{{ class DE_Binets