DataObjects/ProjectDirectory.php
[Pman.Core] / DataObjects / Core_enum.php
index 1a3662c..c3e23e9 100644 (file)
@@ -9,14 +9,41 @@ class Pman_Core_DataObjects_Core_enum extends DB_DataObject
     ###START_AUTOCODE
     /* the code below is auto generated do not remove the above tag */
 
-    public $__table = 'core_enum';               // table name
+    public $__table = 'core_enum';                       // table name
     public $id;                              // int(11)  not_null primary_key auto_increment
-    public $name;                            // string(64)  not_null
-    public $otype;                            // string(64)  not_null
-    public $seqid;                            // string(64)  not_null
-    public $active;                            // string(64)  not_null
-
+    public $etype;                           // string(32)  not_null
+    public $name;                            // string(255)  not_null
+    public $active;                          // int(2)  not_null
+    public $seqid;                           // int(11)  not_null multiple_key
+    public $seqmax;                           // int(11)  not_null multiple_key
+    public $display_name;
     
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
+    function applyFilters($q, $au)
+    {
+        
+        //DB_DataObject::debugLevel(1);
+        if (!empty($q['query']['empty_etype'])) {
+            $this->whereAdd("etype = ''");
+        }
+    }
+    
+    function onUpdate($old, $req)
+    {
+        $x = $this->factory($this->tableName());
+        $x->query("SELECT core_enum_seqmax_update('". $this->escape($this->etype) ."')");
+        if ($old->etype != $this->etype) {
+            $x->query("SELECT core_enum_seqmax_update('". $this->escape($old->etype) ."')");
+        }
+        
+    }
+    
+    function onInsert($req)
+    {
+        $x = $this->factory($this->tableName());
+        $x->query("SELECT core_enum_seqmax_update('". $this->escape($this->etype) ."')");
+         
+    }
+    
 }