fix API
[Pman.Core] / DataObjects / Core_project.php
index fb49521..3061770 100644 (file)
@@ -87,7 +87,7 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject
      * 
      */
     
-    function applyFilters($q, $au)
+    function applyFilters($q, $au, $roo)
     {
          
         $tn = $this->tableName();
@@ -106,7 +106,7 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject
                 case 'A': // all
                     break; 
                 case 'C': // current
-                     $this->whereAdd("{$tn}.close_date >= NOW()");
+                     $this->whereAdd("{$tn}.close_date is NULL OR {$tn}.close_date >= NOW()");
                     break;
                 case 'O': // old
                     $this->whereAdd("{$tn}.close_date < NOW()");
@@ -130,7 +130,7 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject
         
         //&& $au->hasPerm('Documents.Documents','S') << this is dependant on the doc modules
           
-        if (!$au->hasPerm('Core.Projects_All','S') ) {
+        if (php_sapi_name() != 'cli' && !$au->hasPerm('Core.Projects_All','S') ) {
             
             
             
@@ -175,7 +175,7 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject
         
     }
  
-    function onInsert()
+    function onInsert($request,$roo,$event)
     {
         $oo = clone($this);
         if (empty($this->code)) {
@@ -186,7 +186,7 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject
         }
     }
     
-    function onUpdate($old)
+    function onUpdate($old, $request, $roo,$event)
     {
         $oo = clone($this);
         if (empty($this->code)) {
@@ -321,4 +321,23 @@ class Pman_Core_DataObjects_Core_project extends DB_DataObject
         return $au->hasPerm("Core.Projects_Member_Of",$lvl) || $au->hasPerm("Core.Projects_All",$lvl);
     }
     
+    static $cache = array();
+    function cacheLoad($id)
+    {
+        if (isset(self::$cache[$id])) {
+            return self::$cache[$id];
+        }
+        $n = $this->factorySelf();
+        $n->get($id);
+        $n->cacheSave();
+        return $n;
+    }
+    
+    function cacheSave()
+    {
+        self::$cache[$this->id] = $this;
+    }
+    
+    
+    
 }